@dxos/app-framework 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef

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 (278) hide show
  1. package/dist/lib/browser/{capability-BBBBAPDI.mjs → capability-Q5XRXRD2.mjs} +10 -10
  2. package/dist/lib/browser/{capability-OP63CD5N.mjs → capability-V7LR4LQN.mjs} +11 -11
  3. package/dist/lib/browser/capability-V7LR4LQN.mjs.map +7 -0
  4. package/dist/lib/browser/{chunk-T3Y4AEKX.mjs → chunk-23D4SJUE.mjs} +3 -3
  5. package/dist/lib/browser/{chunk-T3Y4AEKX.mjs.map → chunk-23D4SJUE.mjs.map} +1 -1
  6. package/dist/lib/browser/{chunk-2CKCJ6PN.mjs → chunk-3JWJXGLK.mjs} +1 -1
  7. package/dist/lib/browser/{chunk-2CKCJ6PN.mjs.map → chunk-3JWJXGLK.mjs.map} +1 -1
  8. package/dist/lib/browser/{chunk-GX4TUNM6.mjs → chunk-3ZS2A3DN.mjs} +170 -226
  9. package/dist/lib/browser/chunk-3ZS2A3DN.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-I34GF4NG.mjs → chunk-45CHLTBV.mjs} +2 -2
  11. package/dist/lib/browser/chunk-5LAIGWLU.mjs +467 -0
  12. package/dist/lib/browser/chunk-5LAIGWLU.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-QSXYHXCE.mjs → chunk-66IXTIVK.mjs} +1 -1
  14. package/dist/lib/browser/{chunk-QSXYHXCE.mjs.map → chunk-66IXTIVK.mjs.map} +2 -2
  15. package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
  16. package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
  17. package/dist/lib/browser/chunk-G7SDBRKH.mjs +1 -0
  18. package/dist/lib/browser/chunk-JXCBZSBJ.mjs +372 -0
  19. package/dist/lib/browser/chunk-JXCBZSBJ.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
  21. package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
  22. package/dist/lib/browser/{chunk-JKWMHZP6.mjs → chunk-WBHCSOBW.mjs} +2 -2
  23. package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
  24. package/dist/lib/browser/{chunk-FU4GAFUQ.mjs → chunk-Z55LVAGN.mjs} +80 -15
  25. package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
  26. package/dist/lib/browser/{chunk-F7FW2RK2.mjs → chunk-ZGJAZSNE.mjs} +7 -32
  27. package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
  28. package/dist/lib/browser/cli/index.mjs +11 -27
  29. package/dist/lib/browser/cli/index.mjs.map +2 -2
  30. package/dist/lib/browser/common/activation-events.mjs +7 -7
  31. package/dist/lib/browser/common/capabilities.mjs +7 -7
  32. package/dist/lib/browser/core/activation-event.mjs +1 -1
  33. package/dist/lib/browser/core/capability.mjs +1 -1
  34. package/dist/lib/browser/core/plugin-manager.mjs +6 -4
  35. package/dist/lib/browser/core/plugin.mjs +10 -2
  36. package/dist/lib/browser/core/url-loader.mjs +13 -5
  37. package/dist/lib/browser/index.mjs +22 -18
  38. package/dist/lib/browser/index.mjs.map +3 -3
  39. package/dist/lib/browser/{invoker-capability-H5PPENOC.mjs → invoker-capability-LNX4CGIV.mjs} +12 -11
  40. package/dist/lib/browser/invoker-capability-LNX4CGIV.mjs.map +7 -0
  41. package/dist/lib/browser/meta.json +1 -1
  42. package/dist/lib/browser/testing/index.mjs +144 -27
  43. package/dist/lib/browser/testing/index.mjs.map +4 -4
  44. package/dist/lib/browser/testing/react.mjs +78 -0
  45. package/dist/lib/browser/testing/react.mjs.map +7 -0
  46. package/dist/lib/browser/ui/index.mjs +18 -14
  47. package/dist/lib/node-esm/{capability-AWBEMRYR.mjs → capability-EW5GJCI6.mjs} +10 -10
  48. package/dist/lib/node-esm/{capability-WFEG6CIZ.mjs → capability-YKBMMD53.mjs} +11 -11
  49. package/dist/lib/node-esm/capability-YKBMMD53.mjs.map +7 -0
  50. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
  51. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
  52. package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs → chunk-6XW6LET6.mjs} +2 -2
  53. package/dist/lib/node-esm/{chunk-URWHJQT2.mjs → chunk-D347W3KO.mjs} +7 -32
  54. package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
  55. package/dist/lib/node-esm/chunk-D5PO2WXX.mjs +373 -0
  56. package/dist/lib/node-esm/chunk-D5PO2WXX.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-ULUEXB7Q.mjs → chunk-HTBJU5FX.mjs} +80 -15
  58. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-KM2F6GH6.mjs +468 -0
  60. package/dist/lib/node-esm/chunk-KM2F6GH6.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs → chunk-OZ7DZA5Z.mjs} +1 -1
  62. package/dist/lib/node-esm/{chunk-BCEOLX47.mjs → chunk-Q7XBFII4.mjs} +170 -226
  63. package/dist/lib/node-esm/chunk-Q7XBFII4.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs → chunk-SBS2YMPT.mjs} +3 -3
  65. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs.map → chunk-SBS2YMPT.mjs.map} +1 -1
  66. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs → chunk-SDJ4B2LU.mjs} +1 -1
  67. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs.map → chunk-SDJ4B2LU.mjs.map} +1 -1
  68. package/dist/lib/node-esm/{chunk-G3RTFSNG.mjs → chunk-WFSRZKBP.mjs} +2 -2
  69. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
  71. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
  72. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs → chunk-XOCUANHO.mjs} +1 -1
  73. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs.map → chunk-XOCUANHO.mjs.map} +2 -2
  74. package/dist/lib/node-esm/cli/index.mjs +11 -27
  75. package/dist/lib/node-esm/cli/index.mjs.map +2 -2
  76. package/dist/lib/node-esm/common/activation-events.mjs +7 -7
  77. package/dist/lib/node-esm/common/capabilities.mjs +7 -7
  78. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  79. package/dist/lib/node-esm/core/capability.mjs +1 -1
  80. package/dist/lib/node-esm/core/plugin-manager.mjs +6 -4
  81. package/dist/lib/node-esm/core/plugin.mjs +10 -2
  82. package/dist/lib/node-esm/core/url-loader.mjs +13 -5
  83. package/dist/lib/node-esm/index.mjs +22 -18
  84. package/dist/lib/node-esm/index.mjs.map +3 -3
  85. package/dist/lib/node-esm/{invoker-capability-S3ZA527J.mjs → invoker-capability-O4T5PHLA.mjs} +12 -11
  86. package/dist/lib/node-esm/invoker-capability-O4T5PHLA.mjs.map +7 -0
  87. package/dist/lib/node-esm/meta.json +1 -1
  88. package/dist/lib/node-esm/testing/index.mjs +144 -27
  89. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  90. package/dist/lib/node-esm/testing/react.mjs +79 -0
  91. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  92. package/dist/lib/node-esm/ui/index.mjs +18 -14
  93. package/dist/plugin/node-esm/index.mjs +480 -32
  94. package/dist/plugin/node-esm/index.mjs.map +4 -4
  95. package/dist/plugin/node-esm/meta.json +1 -1
  96. package/dist/types/src/common/capabilities.d.ts +2 -1
  97. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  98. package/dist/types/src/common/operations.d.ts +1 -1
  99. package/dist/types/src/common/operations.d.ts.map +1 -1
  100. package/dist/types/src/core/activation-event.d.ts +4 -4
  101. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  102. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  103. package/dist/types/src/core/capability.d.ts +2 -2
  104. package/dist/types/src/core/capability.d.ts.map +1 -1
  105. package/dist/types/src/core/index.d.ts +2 -0
  106. package/dist/types/src/core/index.d.ts.map +1 -1
  107. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  108. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  109. package/dist/types/src/core/plugin-manager.d.ts +51 -2
  110. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  111. package/dist/types/src/core/plugin-manifest.d.ts +76 -0
  112. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  113. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  114. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  115. package/dist/types/src/core/plugin.d.ts +107 -6
  116. package/dist/types/src/core/plugin.d.ts.map +1 -1
  117. package/dist/types/src/core/url-loader.d.ts +90 -3
  118. package/dist/types/src/core/url-loader.d.ts.map +1 -1
  119. package/dist/types/src/helpers.d.ts.map +1 -1
  120. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
  121. package/dist/types/src/plugin-operation/history/errors.d.ts +6 -6
  122. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
  123. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
  124. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
  125. package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
  126. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
  127. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
  128. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  129. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
  130. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
  131. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  132. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
  133. package/dist/types/src/plugin-operation/testing.d.ts +2 -1
  134. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
  135. package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
  136. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  137. package/dist/types/src/testing/harness.d.ts +67 -0
  138. package/dist/types/src/testing/harness.d.ts.map +1 -0
  139. package/dist/types/src/testing/index.d.ts +1 -0
  140. package/dist/types/src/testing/index.d.ts.map +1 -1
  141. package/dist/types/src/testing/react.d.ts +27 -0
  142. package/dist/types/src/testing/react.d.ts.map +1 -0
  143. package/dist/types/src/testing/react.test.d.ts +2 -0
  144. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  145. package/dist/types/src/testing/service.d.ts.map +1 -1
  146. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  147. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  148. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  149. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  150. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  151. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  152. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  153. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  154. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  155. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  156. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  157. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  158. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  159. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  160. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
  161. package/dist/types/src/ui/components/Surface/index.d.ts +16 -6
  162. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  163. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  164. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  165. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  166. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  167. package/dist/types/src/ui/components/index.d.ts +1 -0
  168. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  169. package/dist/types/src/ui/hooks/useApp.d.ts +29 -3
  170. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  171. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  172. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  173. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  174. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
  175. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
  176. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +52 -0
  177. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  178. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  179. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  180. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  181. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  182. package/dist/types/src/vite-plugin/index.d.ts +4 -2
  183. package/dist/types/src/vite-plugin/index.d.ts.map +1 -1
  184. package/dist/types/src/vite-plugin/manifest.d.ts +37 -0
  185. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  186. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  187. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  188. package/dist/types/src/vite-plugin/packages.d.ts +10 -4
  189. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
  190. package/dist/types/tsconfig.tsbuildinfo +1 -1
  191. package/moon.yml +1 -0
  192. package/package.json +33 -59
  193. package/src/common/capabilities.ts +2 -1
  194. package/src/common/operations.ts +1 -1
  195. package/src/core/capability.ts +1 -1
  196. package/src/core/index.ts +2 -0
  197. package/src/core/plugin-asset-cache.ts +60 -0
  198. package/src/core/plugin-manager.test.ts +246 -5
  199. package/src/core/plugin-manager.ts +167 -25
  200. package/src/core/plugin-manifest.test.ts +48 -0
  201. package/src/core/plugin-manifest.ts +102 -0
  202. package/src/core/plugin.ts +135 -10
  203. package/src/core/url-loader.test.ts +104 -5
  204. package/src/core/url-loader.ts +226 -37
  205. package/src/plugin-operation/OperationPlugin.ts +2 -2
  206. package/src/plugin-operation/history/capability.ts +1 -1
  207. package/src/plugin-operation/history/history-tracker.test.ts +2 -1
  208. package/src/plugin-operation/history/history-tracker.ts +1 -1
  209. package/src/plugin-operation/history/types.ts +1 -1
  210. package/src/plugin-operation/history/undo-mapping.ts +1 -1
  211. package/src/plugin-operation/history/undo-registry.ts +1 -1
  212. package/src/plugin-operation/invoker-capability.ts +2 -1
  213. package/src/plugin-operation/testing.ts +2 -1
  214. package/src/plugin-runtime/RuntimePlugin.ts +2 -2
  215. package/src/testing/harness.ts +229 -0
  216. package/src/testing/index.ts +1 -0
  217. package/src/testing/react.test.tsx +48 -0
  218. package/src/testing/react.tsx +113 -0
  219. package/src/testing/withPluginManager.stories.tsx +1 -1
  220. package/src/ui/components/App/App.stories.tsx +1 -1
  221. package/src/ui/components/App/App.tsx +25 -2
  222. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  223. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  224. package/src/ui/components/Placeholder/index.ts +5 -0
  225. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +4 -2
  226. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +1 -1
  227. package/src/ui/components/Surface/SurfaceComponent.tsx +83 -46
  228. package/src/ui/components/Surface/index.ts +20 -1
  229. package/src/ui/components/Surface/types.test.ts +126 -0
  230. package/src/ui/components/Surface/types.ts +164 -12
  231. package/src/ui/components/index.ts +1 -0
  232. package/src/ui/hooks/useApp.tsx +165 -41
  233. package/src/ui/hooks/useLoading.tsx +14 -6
  234. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
  235. package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
  236. package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
  237. package/src/vite-plugin/boot-loader/index.ts +112 -0
  238. package/src/vite-plugin/composer/index.ts +277 -0
  239. package/src/vite-plugin/import-map/index.ts +524 -0
  240. package/src/vite-plugin/index.ts +6 -2
  241. package/src/vite-plugin/manifest.test.ts +24 -0
  242. package/src/vite-plugin/manifest.ts +50 -0
  243. package/src/vite-plugin/packages.ts +169 -10
  244. package/tsconfig.json +9 -0
  245. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  246. package/dist/lib/browser/capability-OP63CD5N.mjs.map +0 -7
  247. package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +0 -7
  248. package/dist/lib/browser/chunk-FU4GAFUQ.mjs.map +0 -7
  249. package/dist/lib/browser/chunk-GX4TUNM6.mjs.map +0 -7
  250. package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +0 -7
  251. package/dist/lib/browser/chunk-LVJW5EFU.mjs +0 -157
  252. package/dist/lib/browser/chunk-LVJW5EFU.mjs.map +0 -7
  253. package/dist/lib/browser/chunk-RFSO3JRG.mjs +0 -1
  254. package/dist/lib/browser/chunk-WPE6AL7I.mjs +0 -905
  255. package/dist/lib/browser/chunk-WPE6AL7I.mjs.map +0 -7
  256. package/dist/lib/browser/invoker-capability-H5PPENOC.mjs.map +0 -7
  257. package/dist/lib/node-esm/capability-WFEG6CIZ.mjs.map +0 -7
  258. package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs +0 -158
  259. package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs.map +0 -7
  260. package/dist/lib/node-esm/chunk-BCEOLX47.mjs.map +0 -7
  261. package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +0 -7
  262. package/dist/lib/node-esm/chunk-LQKOTNJW.mjs +0 -906
  263. package/dist/lib/node-esm/chunk-LQKOTNJW.mjs.map +0 -7
  264. package/dist/lib/node-esm/chunk-ULUEXB7Q.mjs.map +0 -7
  265. package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +0 -7
  266. package/dist/lib/node-esm/invoker-capability-S3ZA527J.mjs.map +0 -7
  267. package/dist/types/src/vite-plugin/composer-plugin.d.ts +0 -18
  268. package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +0 -1
  269. package/dist/types/src/vite-plugin/import-map-plugin.d.ts +0 -16
  270. package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +0 -1
  271. package/src/vite-plugin/composer-plugin.ts +0 -128
  272. package/src/vite-plugin/import-map-plugin.ts +0 -314
  273. /package/dist/lib/browser/{capability-BBBBAPDI.mjs.map → capability-Q5XRXRD2.mjs.map} +0 -0
  274. /package/dist/lib/browser/{chunk-I34GF4NG.mjs.map → chunk-45CHLTBV.mjs.map} +0 -0
  275. /package/dist/lib/browser/{chunk-RFSO3JRG.mjs.map → chunk-G7SDBRKH.mjs.map} +0 -0
  276. /package/dist/lib/node-esm/{capability-AWBEMRYR.mjs.map → capability-EW5GJCI6.mjs.map} +0 -0
  277. /package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs.map → chunk-6XW6LET6.mjs.map} +0 -0
  278. /package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs.map → chunk-OZ7DZA5Z.mjs.map} +0 -0
@@ -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/useSettingsState.ts", "../../../src/ui/components/Placeholder/Placeholder.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren, useEffect } from 'react';\n\nimport { Capabilities } from '../../../common';\nimport { topologicalSort } from '../../../helpers';\nimport { LoadingState, type StartupProgress, type UseAppOptions, useCapabilities, useLoading } from '../../hooks';\n\nexport type AppProps = Pick<UseAppOptions, 'placeholder' | 'debounce'> & {\n ready: boolean;\n error: unknown;\n progress?: StartupProgress;\n};\n\nconst FIRST_INTERACTIVE_MARK = 'app-framework:first-interactive';\n\nexport const App = ({ placeholder: Placeholder, 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 // Emit a once-per-app `app-framework:first-interactive` mark the first time\n // the placeholder is dismissed and the real app shell renders. Closes the\n // gap between `Startup` activated and the first interactive paint.\n //\n // Also dismisses the native-DOM boot loader from\n // `@dxos/app-framework/vite-plugin` here — the framework owns the\n // handoff-complete signal, so dismissing in `App` covers both hosts that\n // wire in a `Placeholder` (which may have its own dismiss path) and hosts\n // that don't (the loader would otherwise sit forever as a `z-index: 10`\n // overlay covering the rendered shell).\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 as { __bootLoader?: { dismiss?: () => void } }).__bootLoader?.dismiss?.();\n }, [placeholderDismissed]);\n\n if (error) {\n // This triggers the error boundary to provide UI feedback for the startup error.\n throw error;\n }\n\n // TODO(wittjosiah): Consider using Suspense instead.\n if (!placeholderDismissed) {\n if (!Placeholder) {\n return null;\n }\n\n return <Placeholder stage={stage} progress={progress} />;\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 { runAndForwardErrors } 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 PlaceholderProps = {\n stage?: number;\n progress?: StartupProgress;\n};\n\nexport type UseAppOptions = {\n pluginManager?: PluginManager.PluginManager;\n pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];\n onPluginRemove?: PluginManager.ManagerOptions['onRemove'];\n plugins?: Plugin.Plugin[];\n core?: string[];\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 placeholder?: FC<PlaceholderProps>;\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 core = [LayoutPluginId];\n * const default = [MyPluginId];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = useApp({ plugins, core, default, 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.\n * @param params.core Core plugins which will always be enabled.\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 * @param params.placeholder Placeholder component to render during startup.\n */\nexport const useApp = ({\n pluginManager,\n pluginLoader: pluginLoaderProp,\n onPluginRemove,\n plugins: pluginsProp,\n core: coreProp,\n defaults: defaultsProp,\n setupEvents: setupEventsProp,\n placeholder,\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 core = useDefaultValue(coreProp, () => plugins.map(({ meta }) => meta.id));\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.id === 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 = pluginManager ?? PluginManager.make({ pluginLoader, plugins, core, enabled, onRemove: onPluginRemove });\n log('useApp: useMemo created/reused manager', { provided: !!pluginManager });\n return mgr;\n }, [pluginManager, pluginLoader, plugins, core, enabled, onPluginRemove]);\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 placeholder 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 // host placeholder can decide what to render — 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 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 runAndForwardErrors(Fiber.interrupt(fiber));\n if (!isExternalManager) {\n void 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\n placeholder={placeholder}\n ready={ready}\n error={error}\n debounce={debounce}\n progress={progressRef.current}\n />\n </RegistryContext.Provider>\n </ContextProtocolProvider>\n </PluginManagerProvider>\n </ErrorBoundary>\n ),\n [fallback, manager, placeholder, 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 { type Atom, 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 { usePluginManager } from '../components';\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 */\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 get the current value of an atom capability.\n * Automatically subscribes to changes.\n * @example const settings = useAtomCapability(ThreadCapabilities.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(ThreadCapabilities.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 * 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 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", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type ReactNode, useEffect, useLayoutEffect, useRef } from 'react';\n\nimport { ThemeProvider } from '@dxos/react-ui';\nimport { defaultTx, mx } from '@dxos/ui-theme';\n\nimport { type PlaceholderProps as PlaceholderSlotProps } from '../../hooks';\n\ndeclare global {\n interface Window {\n /**\n * Driver injected by `@dxos/app-framework/vite-plugin`'s `bootLoaderPlugin`.\n * Declared here so the {@link Placeholder} can dismiss the native-DOM\n * loader once the React placeholder commits without each host having to\n * re-declare the type.\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\n * appending a new entry — keeps the visible log compact during long\n * counted phases like plugin chunk-loading or module activation.\n */\n range?: { index: number; total: number };\n }) => void;\n progress: (fraction?: number) => void;\n dismiss: () => void;\n };\n }\n}\n\nexport type PlaceholderComponentProps = PlaceholderSlotProps & {\n /**\n * Brand mark rendered while the React tree settles. Pass either a static\n * `ReactNode` (the framework wraps it in a sizing/animation div) or a\n * render function that receives the precomputed `className` so the host\n * can apply it directly to its logo (e.g. an SVG that accepts `className`\n * — `composer-app` passes `(p) => <Composer {...p} />` from `@dxos/brand`).\n */\n logo?: ReactNode | ((props: { className: string }) => ReactNode);\n};\n\n/**\n * React placeholder. The native-DOM boot loader is the visible UI through\n * stages 0 (Loading) and 1 (FadeIn): we render `null` until `stage >= 2`\n * (FadeOut) and instead feed activation progress + status into the still-\n * alive boot loader. At stage 2 the loader dismisses and the React mark\n * appears for the cross-fade to the real shell:\n *\n * - composer-app fills `0 → 50%` from `getPlugins`'s per-chunk counter.\n * - this component fills `50 → 100%` from `useApp`'s\n * `startupProgress.progress` (`activated / total` modules) and pushes\n * the per-module status text to the loader's status line.\n * - at `stage >= 2` the boot loader is dismissed and the React mark\n * starts its `FadeOut → Done` shrink-and-fade.\n *\n * Stage progression (driven by `useApp`):\n * - `0` — Loading: native-DOM boot loader visible. Placeholder renders nothing.\n * - `1` — FadeIn: same — boot loader still owns the screen.\n * - `2` — FadeOut: boot loader dismissed, React mark visible at full opacity then shrinks.\n */\nexport const Placeholder = ({ stage = 1, progress, logo }: PlaceholderComponentProps) => {\n // Used in tests to exercise the error boundary & reset dialog.\n if (location.search === '?throw') {\n throw new Error('Test error');\n }\n\n // Phase B: feed activation progress + status to the still-visible boot\n // loader. Maps `[0, 1]` activation → `[0.5, 1]` of the ring; forwards\n // the raw activation source (`event` / `module`) plus the pre-humanised\n // label to `__bootLoader.status` so the loader gets to decide how to\n // render and trace each transition (current default policy: \"Activating\n // <humanizedName>\"; trace mode and timings track the structured fields).\n // No-op once the loader has been dismissed (its `status()` early-returns\n // when the boot DOM is gone). Skipping `stage >= 2` lets the dismissal\n // run uncontended.\n useEffect(() => {\n if (stage >= 2) {\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 from the native-DOM boot loader once the placeholder starts\n // fading out — keeping the loader visible through `stage 0` and `stage 1`\n // means the ring stays the visible source of truth for activation\n // progress. `useLayoutEffect` runs before the next paint so the loader\n // DOM is removed in the same frame the cross-fade begins.\n useLayoutEffect(() => {\n if (stage >= 2) {\n window.__bootLoader?.dismiss();\n }\n }, [stage]);\n\n // Backstop for the fast-load path where `useLoading` can skip straight\n // from stage 0 to `Done` (ready=true at the first debounce tick) — the\n // stage-driven effect above never sees `stage >= 2`, so dismiss on\n // unmount instead. The `stageRef` guard is what keeps StrictMode's\n // synthetic mount → cleanup → remount cycle from prematurely dismissing\n // the loader: the synthetic cleanup runs while `stageRef.current === 0`,\n // skips the dismiss, and the real unmount (later, at stage `Done`)\n // performs it.\n const stageRef = useRef(stage);\n stageRef.current = stage;\n useEffect(() => {\n return () => {\n if (stageRef.current >= 3 /* Done */) {\n window.__bootLoader?.dismiss();\n }\n };\n }, []);\n\n // Defer rendering anything until the FadeOut stage. The boot loader owns\n // the screen during stages 0 and 1, so any DOM we render here would just\n // sit invisibly behind it — and rendering null avoids paint cost during\n // the longest part of the loading sequence (plugin activation).\n if (stage < 2) {\n return null;\n }\n\n const logoClassName = mx(\n 'h-[300px] w-[300px] scale-600 transition-all duration-500 ease-in-out filter grayscale opacity-0',\n stage >= 1 && 'scale-100 grayscale-0 opacity-70',\n stage >= 2 && 'scale-50 opacity-0',\n );\n\n return (\n <ThemeProvider tx={defaultTx}>\n <div role='none' className='relative dx-container h-dvh flex flex-col'>\n <div role='none' className='flex flex-col grow justify-center items-center'>\n {typeof logo === 'function' ? (\n logo({ className: logoClassName })\n ) : logo ? (\n <div className={logoClassName}>{logo}</div>\n ) : null}\n </div>\n </div>\n </ThemeProvider>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAIA,OAAOA,UAAiCC,aAAAA,kBAAiB;;;ACAzD,SAASC,uBAAuB;AAChC,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,OAAOC,SAAkBC,aAAaC,WAAWC,SAASC,QAAQC,gBAAgB;AAElF,SAASC,2BAA2B;AACpC,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,eAAeC,qBAAyC;AACjE,SAASC,gBAAgBC,uBAAuB;AAChD,SAASC,+BAA+B;AAOxC,IAAA,eAAMC;;AAwGEC,IAAOC,SAAAA,CAAAA,EAAAA,eAA0B,cAAiB,kBAAoBC,gBAAE,SAAA,aAAA,MAAA,UAAA,UAAA,cAAA,aAAA,iBAAA,aAAA,WAAA,eAAA,eAAA,OAAA,WAAA,OAAA,WAAA,GAAA,UAAA,IAAA,MAAA;AAC9E,QAAMC,UAAAA,gBAAWF,aAAgBG,MAAc,CAAA,CAAM;AACrD,QAAMC,OAAAA,gBAAcJ,UAAgBK,MAAAA,QAAAA,IAAiB,CAAA,EAAM,KAAE,MAAA,KAAA,EAAA,CAAA;AAE7D,QAAMC,WAAAA,gBAEFC,cAAAA,MAAAA,CAAAA,CACC;sBAESC,gBAAiBC,iBAAiBD,MAAOE,CAAAA,CAAAA;uBAC/CC,QAAUH,MAAS,qBAAoBP,CAAI,OAAA,YAAA,MAAA;AAC3C,UAAA,SAAOO,QAAAA,KAAAA,CAAAA,YAAAA,QAAAA,KAAAA,OAAAA,EAAAA;AACR,cACL,QA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AAA;IACvB;EACF,GAAG;IAACd;GAAM;AAUV,QAAMe,WAAWpB,QAAOK,KAAAA;AACxBe,WAASC,UAAUhB;AACnBP,EAAAA,WAAU,MAAA;AACR,WAAO,MAAA;AACL,UAAIsB,SAASC,WAAW,GAAc;AACpCT,eAAOC,cAAcM,QAAAA;MACvB;IACF;EACF,GAAG,CAAA,CAAE;AAML,MAAId,QAAQ,GAAG;AACb,WAAO;EACT;AAEA,QAAMiB,gBAAgBnB,GACpB,oGACAE,SAAS,KAAK,oCACdA,SAAS,KAAK,oBAAA;AAGhB,SACE,gBAAAR,OAAA,cAACI,eAAAA;IAAcsB,IAAIrB;KACjB,gBAAAL,OAAA,cAAC2B,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,gBAAA7B,OAAA,cAAC2B,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACxB,OAAOnB,SAAS,aACfA,KAAK;IAAEmB,WAAWJ;EAAc,CAAA,IAC9Bf,OACF,gBAAAV,OAAA,cAAC2B,OAAAA;IAAIE,WAAWJ;KAAgBf,IAAAA,IAC9B,IAAA,CAAA,CAAA;AAKd;",
6
+ "names": ["React", "useEffect", "RegistryContext", "Effect", "Fiber", "PubSub", "Queue", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "runAndForwardErrors", "invariant", "log", "ErrorBoundary", "ErrorFallback", "useAsyncEffect", "useDefaultValue", "ContextProtocolProvider", "ENABLED_KEY", "core", "useDefaultValue", "id", "defaults", "defaultsProp", "setupEvents", "setupEventsProp", "pluginLoader", "pluginLoaderProp", "plugin", "find", "meta", "invariant", "plugins", "errorRef", "useRef", "error", "setError", "useState", "startupProgress", "setStartupProgress", "activated", "total", "progress", "safeMode", "cacheEnabled", "cached", "pluginManager", "enabled", "onRemove", "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", "Fiber", "Error", "timeout", "clearTimeout", "interrupt", "isExternalManager", "shutdown", "progressRef", "name", "FallbackComponent", "fallback", "value", "ContextProtocolProvider", "PluginManagerContext", "App", "placeholder", "ready", "debounce", "composer", "match", "parts", "pluginSlug", "moduleName", "pluginLabel", "split", "map", "word", "useAtomValue", "useCallback", "invariant", "__dxlog_file", "useAtomValue", "capabilities", "interfaceDef", "invariant", "atom", "useCapability", "atomCapability", "value", "update", "fn", "registry", "set", "useCallback", "useEffect", "useRef", "useState", "LoadingState", "useLoading", "ready", "debounce", "stage", "setStage", "readyRef", "current", "i", "setInterval", "isReady", "clearInterval", "RegistryContext", "useAtomValue", "useCallback", "useContext", "useSettingsState", "atom", "registry", "settings", "updateSettings", "fn", "set", "get", "FIRST_INTERACTIVE_MARK", "App", "placeholder", "Placeholder", "ready", "error", "debounce", "progress", "reactContexts", "useCapabilities", "Capabilities", "ReactContext", "reactRoots", "ReactRoot", "stage", "useLoading", "placeholderDismissed", "LoadingState", "Done", "useEffect", "performance", "getEntriesByName", "length", "mark", "window", "__bootLoader", "dismiss", "React", "ComposedContext", "composeContexts", "map", "id", "root", "Component", "key", "contexts", "children", "topologicalSort", "context", "reduce", "Acc", "Next", "React", "useEffect", "useLayoutEffect", "useRef", "ThemeProvider", "defaultTx", "mx", "Placeholder", "stage", "progress", "logo", "location", "search", "Error", "fraction", "window", "__bootLoader", "humanizedName", "status", "event", "module", "humanized", "dismiss", "stageRef", "current", "logoClassName", "tx", "div", "role", "className"]
7
+ }
@@ -45,4 +45,4 @@ export {
45
45
  getEvents,
46
46
  activation_event_exports
47
47
  };
48
- //# sourceMappingURL=chunk-QSXYHXCE.mjs.map
48
+ //# sourceMappingURL=chunk-66IXTIVK.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/core/activation-event.ts"],
4
4
  "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { compositeKey } from '@dxos/util';\n\n/**\n * A unique string identifier representing an event.\n * This is expected to be a URI, where initial parts are often the id of the plugin whose package defines the event.\n *\n * @example org.dxos.plugin.example.event.ready\n */\nexport type ActivationEvent = {\n id: string;\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.\n */\nexport const make = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\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,oBAAoB;AAwBtB,IAAMC,OAAO,CAACC,IAAYC,cAAAA;AAC/B,SAAO;IAAED;IAAIC;EAAU;AACzB;AAKO,IAAMC,WAAW,CAACC,UACvBA,MAAMF,YAAYG,aAAaD,MAAMH,IAAIG,MAAMF,SAAS,IAAIE,MAAMH;AAK7D,IAAMK,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": ["compositeKey", "make", "id", "specifier", "eventKey", "event", "compositeKey", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents"]
5
+ "mappings": ";;;;;AAAA;;;;;;;;;;AAIA,SAASA,oBAAoB;AAwBtB,IAAMC,OAAO,CAACC,IAAYC,cAAAA;AAC/B,SAAO;IAAED;IAAIC;EAAU;AACzB;AAKO,IAAMC,WAAW,CAACC,UACvBA,MAAMF,YAAYH,aAAaK,MAAMH,IAAIG,MAAMF,SAAS,IAAIE,MAAMH;AAK7D,IAAMI,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": ["compositeKey", "make", "id", "specifier", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents"]
7
7
  }
@@ -5,4 +5,4 @@ var PluginManagerContext = createContext("org.dxos.app-framework.plugin-manager"
5
5
  export {
6
6
  PluginManagerContext
7
7
  };
8
- //# sourceMappingURL=chunk-TGX63LTL.mjs.map
8
+ //# sourceMappingURL=chunk-FJ4765WW.mjs.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/context.ts"],
4
4
  "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('org.dxos.app-framework.plugin-manager');\n"],
5
- "mappings": ";AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBC,cAA2C,uCAAA;",
6
- "names": ["createContext", "PluginManagerContext", "createContext"]
5
+ "mappings": ";AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBD,cAA2C,uCAAA;",
6
+ "names": ["createContext", "PluginManagerContext"]
7
7
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-G7SDBRKH.mjs.map
@@ -0,0 +1,372 @@
1
+ import {
2
+ isPlugin
3
+ } from "./chunk-Z55LVAGN.mjs";
4
+ import {
5
+ __export
6
+ } from "./chunk-J5LGTIGS.mjs";
7
+
8
+ // src/core/url-loader.ts
9
+ var url_loader_exports = {};
10
+ __export(url_loader_exports, {
11
+ RemotePluginLoadError: () => RemotePluginLoadError,
12
+ getRemoteEntries: () => getRemoteEntries,
13
+ isLocalUrl: () => isLocalUrl,
14
+ make: () => make,
15
+ preload: () => preload,
16
+ uninstall: () => uninstall
17
+ });
18
+ import * as Effect3 from "effect/Effect";
19
+ import * as Option from "effect/Option";
20
+ import { BaseError as BaseError3 } from "@dxos/errors";
21
+ import { log } from "@dxos/log";
22
+
23
+ // src/core/plugin-asset-cache.ts
24
+ var plugin_asset_cache_exports = {};
25
+ __export(plugin_asset_cache_exports, {
26
+ PluginAssetCacheError: () => PluginAssetCacheError,
27
+ noop: () => noop
28
+ });
29
+ import * as Effect from "effect/Effect";
30
+ import { BaseError } from "@dxos/errors";
31
+ var PluginAssetCacheError = class extends BaseError.extend("PluginAssetCacheError", "Plugin asset cache operation failed") {
32
+ };
33
+ var noop = () => ({
34
+ cache: () => Effect.void,
35
+ evict: () => Effect.void,
36
+ resolve: (_pluginId, url) => Effect.succeed(url),
37
+ list: () => Effect.succeed([])
38
+ });
39
+
40
+ // src/core/plugin-manifest.ts
41
+ var plugin_manifest_exports = {};
42
+ __export(plugin_manifest_exports, {
43
+ Manifest: () => Manifest,
44
+ PluginManifestError: () => PluginManifestError,
45
+ fetchManifest: () => fetchManifest,
46
+ parse: () => parse
47
+ });
48
+ import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
49
+ import * as HttpClient from "@effect/platform/HttpClient";
50
+ import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
51
+ import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
52
+ import * as Effect2 from "effect/Effect";
53
+ import * as Schema from "effect/Schema";
54
+ import { BaseError as BaseError2 } from "@dxos/errors";
55
+ import { PLUGIN_ENTRY_FILENAME } from "@dxos/protocols";
56
+ var PluginManifestError = class extends BaseError2.extend("PluginManifestError", "Plugin manifest is invalid") {
57
+ };
58
+ var Manifest = Schema.Struct({
59
+ id: Schema.String,
60
+ name: Schema.String,
61
+ version: Schema.String,
62
+ assets: Schema.Array(Schema.String)
63
+ });
64
+ var resolve = (manifestUrl, manifest) => ({
65
+ id: manifest.id,
66
+ name: manifest.name,
67
+ version: manifest.version,
68
+ entryUrl: new URL(PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),
69
+ assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString())
70
+ });
71
+ var parse = (manifestUrl, payload) => {
72
+ const manifest = Schema.decodeUnknownSync(Manifest)(payload);
73
+ if (!manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
74
+ throw new Error(`Manifest at ${manifestUrl} does not list ${PLUGIN_ENTRY_FILENAME} in assets.`);
75
+ }
76
+ return resolve(manifestUrl, manifest);
77
+ };
78
+ var fetchManifest = (manifestUrl) => Effect2.gen(function* () {
79
+ const response = yield* HttpClientRequest.get(manifestUrl).pipe(HttpClient.execute, Effect2.mapError((cause) => new PluginManifestError({
80
+ context: {
81
+ manifestUrl,
82
+ reason: "fetch-failed"
83
+ },
84
+ cause
85
+ })));
86
+ if (response.status >= 400) {
87
+ return yield* Effect2.fail(new PluginManifestError({
88
+ context: {
89
+ manifestUrl,
90
+ reason: "http-error",
91
+ status: response.status
92
+ }
93
+ }));
94
+ }
95
+ const manifest = yield* HttpClientResponse.schemaBodyJson(Manifest)(response).pipe(Effect2.mapError((cause) => new PluginManifestError({
96
+ context: {
97
+ manifestUrl,
98
+ reason: "parse-failed"
99
+ },
100
+ cause
101
+ })));
102
+ if (!manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
103
+ return yield* Effect2.fail(new PluginManifestError({
104
+ context: {
105
+ manifestUrl,
106
+ reason: "invalid"
107
+ },
108
+ cause: `assets does not include ${PLUGIN_ENTRY_FILENAME}`
109
+ }));
110
+ }
111
+ return resolve(manifestUrl, manifest);
112
+ }).pipe(Effect2.scoped, Effect2.provide(FetchHttpClient.layer));
113
+
114
+ // src/core/url-loader.ts
115
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/url-loader.ts";
116
+ var DEFAULT_KEY = "org.dxos.composer.remote-plugins";
117
+ var RemotePluginLoadError = class extends BaseError3.extend("RemotePluginLoadError", "Failed to load remote plugin") {
118
+ };
119
+ var defaultStorage = () => ({
120
+ get: (key) => localStorage.getItem(key),
121
+ set: (key, value) => localStorage.setItem(key, value)
122
+ });
123
+ var getPersistedRemotePlugins = (storage, key) => {
124
+ try {
125
+ const parsed = JSON.parse(storage.get(key) ?? "[]");
126
+ if (!Array.isArray(parsed)) {
127
+ return [];
128
+ }
129
+ return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.url === "string");
130
+ } catch {
131
+ return [];
132
+ }
133
+ };
134
+ var persistRemotePlugin = (storage, key, entry) => {
135
+ try {
136
+ const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== entry.id);
137
+ entries.push(entry);
138
+ storage.set(key, JSON.stringify(entries));
139
+ } catch (error) {
140
+ log.warn("failed to persist remote plugin entry", {
141
+ entry,
142
+ error
143
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
144
+ }
145
+ };
146
+ var removePersistedRemotePlugin = (storage, key, pluginId) => {
147
+ try {
148
+ const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== pluginId);
149
+ storage.set(key, JSON.stringify(entries));
150
+ } catch (error) {
151
+ log.warn("failed to remove remote plugin entry", {
152
+ pluginId,
153
+ error
154
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 51, S: void 0 });
155
+ }
156
+ };
157
+ var isUrl = (locator) => {
158
+ try {
159
+ const url = new URL(locator);
160
+ return url.protocol === "http:" || url.protocol === "https:";
161
+ } catch {
162
+ return false;
163
+ }
164
+ };
165
+ var isLocalUrl = (locator) => {
166
+ try {
167
+ const hostname = new URL(locator).hostname.toLowerCase();
168
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
169
+ } catch {
170
+ return false;
171
+ }
172
+ };
173
+ var getRemoteEntries = (options = {}) => {
174
+ const storage = options.storage ?? defaultStorage();
175
+ const key = options.key ?? DEFAULT_KEY;
176
+ return getPersistedRemotePlugins(storage, key);
177
+ };
178
+ var normalizePluginExport = (mod) => {
179
+ const exported = mod.default;
180
+ if (isPlugin(exported)) {
181
+ return exported;
182
+ }
183
+ if (typeof exported === "function") {
184
+ const result = exported();
185
+ if (isPlugin(result)) {
186
+ return result;
187
+ }
188
+ }
189
+ throw new Error("Remote module default export is not a Plugin or a zero-arg plugin factory.");
190
+ };
191
+ var loadStylesheets = (manifest, cache) => Effect3.gen(function* () {
192
+ if (typeof document === "undefined") {
193
+ return;
194
+ }
195
+ const cssUrls = manifest.assetUrls.filter((url) => url.endsWith(".css"));
196
+ for (const url of cssUrls) {
197
+ const resolved = yield* cache.resolve(manifest.id, url);
198
+ if (document.querySelector(`link[data-dxos-plugin-id="${manifest.id}"][href="${resolved}"]`)) {
199
+ continue;
200
+ }
201
+ const link = document.createElement("link");
202
+ link.rel = "stylesheet";
203
+ link.href = resolved;
204
+ link.dataset.dxosPluginId = manifest.id;
205
+ document.head.appendChild(link);
206
+ }
207
+ });
208
+ var loadFromManifest = (manifestUrl, cache) => Effect3.gen(function* () {
209
+ log.info("loading remote plugin", {
210
+ manifestUrl
211
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 119, S: this });
212
+ const manifest = yield* fetchManifest(manifestUrl).pipe(Effect3.mapError((cause) => new RemotePluginLoadError({
213
+ context: {
214
+ locator: manifestUrl,
215
+ reason: "manifest-error"
216
+ },
217
+ cause
218
+ })));
219
+ const cachedUrls = manifest.assetUrls.indexOf(manifestUrl) === -1 ? [
220
+ manifestUrl,
221
+ ...manifest.assetUrls
222
+ ] : manifest.assetUrls;
223
+ const wrapCacheError = Effect3.mapError((cause) => new RemotePluginLoadError({
224
+ context: {
225
+ locator: manifestUrl,
226
+ reason: "cache-error"
227
+ },
228
+ cause
229
+ }));
230
+ yield* cache.cache(manifest.id, cachedUrls).pipe(wrapCacheError);
231
+ const entryUrl = yield* cache.resolve(manifest.id, manifest.entryUrl).pipe(wrapCacheError);
232
+ const mod = yield* Effect3.tryPromise({
233
+ try: () => import(
234
+ /* @vite-ignore */
235
+ entryUrl
236
+ ),
237
+ catch: (cause) => new RemotePluginLoadError({
238
+ context: {
239
+ locator: manifestUrl,
240
+ reason: "import-failed"
241
+ },
242
+ cause
243
+ })
244
+ });
245
+ const plugin = normalizePluginExport(mod);
246
+ if (!plugin.meta.id || !plugin.meta.name) {
247
+ return yield* Effect3.fail(new RemotePluginLoadError({
248
+ context: {
249
+ locator: manifestUrl,
250
+ reason: "meta-missing"
251
+ }
252
+ }));
253
+ }
254
+ if (plugin.meta.id !== manifest.id) {
255
+ return yield* Effect3.fail(new RemotePluginLoadError({
256
+ context: {
257
+ locator: manifestUrl,
258
+ reason: "meta-mismatch",
259
+ metaId: plugin.meta.id,
260
+ manifestId: manifest.id
261
+ }
262
+ }));
263
+ }
264
+ yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);
265
+ return {
266
+ plugin,
267
+ manifest
268
+ };
269
+ });
270
+ var preload = (options = {}) => Effect3.gen(function* () {
271
+ const storage = options.storage ?? defaultStorage();
272
+ const key = options.key ?? DEFAULT_KEY;
273
+ const cache = options.cache ?? noop();
274
+ const onPluginLoaded = options.onPluginLoaded;
275
+ const entries = getPersistedRemotePlugins(storage, key);
276
+ if (entries.length === 0) {
277
+ return [];
278
+ }
279
+ log.info("preloading remote plugins", {
280
+ count: entries.length
281
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 197, S: this });
282
+ const total = entries.length;
283
+ let loaded = 0;
284
+ const results = yield* Effect3.all(entries.map((entry) => loadFromManifest(entry.url, cache).pipe(
285
+ Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to preload remote plugin", {
286
+ entry,
287
+ error
288
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 202, S: this }))),
289
+ Effect3.option,
290
+ // Tick the progress hook on both success and recoverable failure so
291
+ // the counter monotonically reaches `total`. The host-supplied
292
+ // callback is best-effort: any synchronous throw flows through
293
+ // `Effect.try` and gets logged + ignored so a buggy hook can't
294
+ // derail the preload.
295
+ Effect3.tap(() => Effect3.sync(() => {
296
+ loaded += 1;
297
+ }).pipe(Effect3.andThen(Effect3.try(() => onPluginLoaded?.(loaded, total))), Effect3.tapError((error) => Effect3.sync(() => log.warn("onPluginLoaded threw", {
298
+ loaded,
299
+ total,
300
+ error
301
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 212, S: this }))), Effect3.ignore))
302
+ )), {
303
+ concurrency: "unbounded"
304
+ });
305
+ return results.flatMap((result) => Option.match(result, {
306
+ onNone: () => [],
307
+ onSome: ({ plugin }) => [
308
+ plugin
309
+ ]
310
+ }));
311
+ });
312
+ var make = (builtinPlugins, options = {}) => {
313
+ const storage = options.storage ?? defaultStorage();
314
+ const key = options.key ?? DEFAULT_KEY;
315
+ const cache = options.cache ?? noop();
316
+ return (locator) => Effect3.gen(function* () {
317
+ const builtin = builtinPlugins.find((plugin2) => plugin2.meta.id === locator);
318
+ if (builtin) {
319
+ return builtin;
320
+ }
321
+ if (!isUrl(locator)) {
322
+ return yield* Effect3.fail(new RemotePluginLoadError({
323
+ context: {
324
+ locator,
325
+ reason: "invalid-locator"
326
+ }
327
+ }));
328
+ }
329
+ const { plugin } = yield* loadFromManifest(locator, cache);
330
+ const duplicate = builtinPlugins.find((existing) => existing.meta.id === plugin.meta.id);
331
+ if (duplicate) {
332
+ return yield* Effect3.fail(new RemotePluginLoadError({
333
+ context: {
334
+ locator,
335
+ reason: "duplicate-id",
336
+ id: plugin.meta.id
337
+ }
338
+ }));
339
+ }
340
+ persistRemotePlugin(storage, key, {
341
+ id: plugin.meta.id,
342
+ url: locator
343
+ });
344
+ return plugin;
345
+ });
346
+ };
347
+ var uninstall = (pluginId, options = {}) => Effect3.gen(function* () {
348
+ const storage = options.storage ?? defaultStorage();
349
+ const key = options.key ?? DEFAULT_KEY;
350
+ const cache = options.cache ?? noop();
351
+ removePersistedRemotePlugin(storage, key, pluginId);
352
+ if (typeof document !== "undefined") {
353
+ document.querySelectorAll(`link[data-dxos-plugin-id="${pluginId}"]`).forEach((node) => node.remove());
354
+ }
355
+ yield* cache.evict(pluginId).pipe(Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to evict plugin assets", {
356
+ pluginId,
357
+ error
358
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 282, S: this }))), Effect3.ignore);
359
+ });
360
+
361
+ export {
362
+ plugin_asset_cache_exports,
363
+ plugin_manifest_exports,
364
+ RemotePluginLoadError,
365
+ isLocalUrl,
366
+ getRemoteEntries,
367
+ preload,
368
+ make,
369
+ uninstall,
370
+ url_loader_exports
371
+ };
372
+ //# sourceMappingURL=chunk-JXCBZSBJ.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 RemotePluginEntry = {\n id: string;\n url: 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): RemotePluginEntry[] => {\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 RemotePluginEntry =>\n typeof entry === 'object' && entry !== null && typeof entry.id === 'string' && typeof entry.url === 'string',\n );\n } catch {\n return [];\n }\n};\n\nconst persistRemotePlugin = (storage: Storage, key: string, entry: RemotePluginEntry): 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 RemotePluginEntry[] => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n return getPersistedRemotePlugins(storage, key);\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.id, url);\n if (document.querySelector(`link[data-dxos-plugin-id=\"${manifest.id}\"][href=\"${resolved}\"]`)) {\n continue;\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = resolved;\n link.dataset.dxosPluginId = manifest.id;\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 // 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 const wrapCacheError = Effect.mapError(\n (cause: PluginAssetCache.PluginAssetCacheError) =>\n new RemotePluginLoadError({ context: { locator: manifestUrl, reason: 'cache-error' }, cause }),\n );\n yield* cache.cache(manifest.id, cachedUrls).pipe(wrapCacheError);\n const entryUrl = yield* cache.resolve(manifest.id, 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.id || !plugin.meta.name) {\n return yield* Effect.fail(\n new RemotePluginLoadError({ context: { locator: manifestUrl, reason: 'meta-missing' } }),\n );\n }\n if (plugin.meta.id !== manifest.id) {\n return yield* Effect.fail(\n new RemotePluginLoadError({\n context: {\n locator: manifestUrl,\n reason: 'meta-mismatch',\n metaId: plugin.meta.id,\n manifestId: manifest.id,\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 yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);\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, RemotePluginLoadError> =>\n Effect.gen(function* () {\n const builtin = builtinPlugins.find((plugin) => plugin.meta.id === locator);\n if (builtin) {\n return builtin;\n }\n if (!isUrl(locator)) {\n return yield* Effect.fail(new RemotePluginLoadError({ context: { locator, reason: 'invalid-locator' } }));\n }\n const { plugin } = yield* loadFromManifest(locator, cache);\n const duplicate = builtinPlugins.find((existing) => existing.meta.id === plugin.meta.id);\n if (duplicate) {\n return yield* Effect.fail(\n new RemotePluginLoadError({ context: { locator, reason: 'duplicate-id', id: plugin.meta.id } }),\n );\n }\n persistRemotePlugin(storage, key, { id: plugin.meta.id, url: locator });\n return plugin;\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 } from '@dxos/protocols';\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 * The manifest is published as a sibling of the plugin's entry module\n * ({@link PLUGIN_ENTRY_FILENAME}) and advertises every file the plugin needs at\n * runtime so the host can eagerly cache them for offline use.\n */\nexport const Manifest = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n version: Schema.String,\n assets: Schema.Array(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 */\nexport type ResolvedManifest = {\n id: string;\n name: string;\n version: string;\n entryUrl: string;\n assetUrls: readonly string[];\n};\n\n/**\n * Resolves a parsed manifest's relative asset paths against the manifest's URL.\n */\nconst resolve = (manifestUrl: string, manifest: Manifest): ResolvedManifest => ({\n id: manifest.id,\n name: manifest.name,\n version: manifest.version,\n entryUrl: new URL(PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),\n assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),\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.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.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;;;;;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EAAA;mBAAEX;oBAAWlB,aAAAA,IAAAA,sBAAAA;iBAASmB;UAAwB4B;UAAmB,QAAA;UAAE,IAAA,OAAA,KAAA;QAEjG;MACAC,CAAAA,CAAAA;;wBAA6DhD,SAAAA,KAAAA;MAAQ,IAAA,OAAA,KAAA;MACrE,KAAO8B;IACT,CAAA;AACF,WAAA;EAEF,CAAA;;AAWI,IAAMzC,YAAcA,CAAAA,UAAOP,UAAAA,CAAAA,MAAAA,YAAAA,aAAAA;AAC3B,QAAMyC,UAAQtB,QAAQsB,WAASU,eAAiBC;AAEhDe,QAAAA,MAAAA,QAAAA,OAAAA;AACA,QAAI,QAAOvC,QAAAA,SAA0B,KAAA;8BAC1BwC,SAAkB,KAAA,QAAA;AAC7B,MAAA,OAAA,aAAA,aAAA;AACA,aAAaC,iBAAgBZ,6BACAd,QAAO2B,IAAK,EAAA,QAAUC,CAAAA,SAAK,KAAA,OAAA,CAAA;;eAA6C5D,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", "PluginManifestError", "extend", "Manifest", "Struct", "id", "String", "name", "version", "assets", "Array", "resolve", "manifestUrl", "manifest", "entryUrl", "URL", "toString", "assetUrls", "map", "asset", "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", "normalizePluginExport", "mod", "exported", "Plugin", "result", "resolved", "resolve", "manifest", "document", "querySelector", "link", "href", "dataset", "head", "loadFromManifest", "manifestUrl", "context", "reason", "cause", "assetUrls", "wrapCacheError", "cache", "entryUrl", "Effect", "tryPromise", "try", "catch", "RemotePluginLoadError", "plugin", "metaId", "manifestId", "PluginAssetCache", "noop", "onPluginLoaded", "info", "total", "results", "pipe", "andThen", "loaded", "flatMap", "onSome", "gen", "builtin", "duplicate", "id", "persistRemotePlugin", "removePersistedRemotePlugin", "querySelectorAll", "evict", "sync", "warn"]
7
+ }