@dxos/app-framework 0.8.4-main.422d1c7879 → 0.8.4-main.4f23b4e393

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 (272) hide show
  1. package/dist/lib/browser/{capability-DOMNPRJP.mjs → capability-5RRH3WIB.mjs} +11 -11
  2. package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
  3. package/dist/lib/browser/{capability-KSNT34SN.mjs → capability-LUKGKUQH.mjs} +10 -10
  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-I34GF4NG.mjs → chunk-45CHLTBV.mjs} +2 -2
  9. package/dist/lib/browser/{chunk-QSXYHXCE.mjs → chunk-66IXTIVK.mjs} +1 -1
  10. package/dist/lib/browser/{chunk-QSXYHXCE.mjs.map → chunk-66IXTIVK.mjs.map} +2 -2
  11. package/dist/lib/browser/{chunk-QRTB4Q3U.mjs → chunk-7VZJR2OA.mjs} +4 -17
  12. package/dist/lib/browser/chunk-7VZJR2OA.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
  14. package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
  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-FO3IYSLV.mjs +68 -0
  18. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-BMIAYUWT.mjs → chunk-JD3Z5NEF.mjs} +147 -75
  20. package/dist/lib/browser/chunk-JD3Z5NEF.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
  22. package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-JKWMHZP6.mjs → chunk-WBHCSOBW.mjs} +2 -2
  24. package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-GDWTW4ZW.mjs → chunk-Z55LVAGN.mjs} +76 -11
  26. package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
  27. package/dist/lib/browser/{chunk-F7FW2RK2.mjs → chunk-ZGJAZSNE.mjs} +7 -32
  28. package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
  29. package/dist/lib/browser/cli/index.mjs +14 -28
  30. package/dist/lib/browser/cli/index.mjs.map +3 -3
  31. package/dist/lib/browser/common/activation-events.mjs +7 -7
  32. package/dist/lib/browser/common/capabilities.mjs +7 -7
  33. package/dist/lib/browser/core/activation-event.mjs +1 -1
  34. package/dist/lib/browser/core/capability.mjs +1 -1
  35. package/dist/lib/browser/core/plugin-manager.mjs +8 -4
  36. package/dist/lib/browser/core/plugin.mjs +10 -2
  37. package/dist/lib/browser/core/url-loader.mjs +13 -5
  38. package/dist/lib/browser/index.mjs +34 -17
  39. package/dist/lib/browser/index.mjs.map +3 -3
  40. package/dist/lib/browser/{invoker-capability-VCMPQOIA.mjs → invoker-capability-K4GHUFXF.mjs} +12 -11
  41. package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/testing/index.mjs +20 -32
  44. package/dist/lib/browser/testing/index.mjs.map +3 -3
  45. package/dist/lib/browser/testing/react.mjs +11 -11
  46. package/dist/lib/browser/ui/index.mjs +14 -12
  47. package/dist/lib/node-esm/{capability-EOQTORML.mjs → capability-FCGZVIEG.mjs} +10 -10
  48. package/dist/lib/node-esm/{capability-KJTQIWDK.mjs → capability-JOIQ2MQE.mjs} +11 -11
  49. package/dist/lib/node-esm/capability-JOIQ2MQE.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-WZ6DHQER.mjs → chunk-DRZKO5UZ.mjs} +147 -75
  56. package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-HI3YBICQ.mjs → chunk-HTBJU5FX.mjs} +76 -11
  58. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
  60. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
  62. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
  63. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs → chunk-SBS2YMPT.mjs} +3 -3
  64. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs.map → chunk-SBS2YMPT.mjs.map} +1 -1
  65. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs → chunk-SDJ4B2LU.mjs} +1 -1
  66. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs.map → chunk-SDJ4B2LU.mjs.map} +1 -1
  67. package/dist/lib/node-esm/{chunk-JPWVIQ5I.mjs → chunk-V24UWT36.mjs} +4 -17
  68. package/dist/lib/node-esm/chunk-V24UWT36.mjs.map +7 -0
  69. package/dist/lib/node-esm/{chunk-G3RTFSNG.mjs → chunk-WFSRZKBP.mjs} +2 -2
  70. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
  71. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  72. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  73. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs → chunk-XOCUANHO.mjs} +1 -1
  74. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs.map → chunk-XOCUANHO.mjs.map} +2 -2
  75. package/dist/lib/node-esm/cli/index.mjs +14 -28
  76. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  77. package/dist/lib/node-esm/common/activation-events.mjs +7 -7
  78. package/dist/lib/node-esm/common/capabilities.mjs +7 -7
  79. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  80. package/dist/lib/node-esm/core/capability.mjs +1 -1
  81. package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
  82. package/dist/lib/node-esm/core/plugin.mjs +10 -2
  83. package/dist/lib/node-esm/core/url-loader.mjs +13 -5
  84. package/dist/lib/node-esm/index.mjs +34 -17
  85. package/dist/lib/node-esm/index.mjs.map +3 -3
  86. package/dist/lib/node-esm/{invoker-capability-EGA3XW6J.mjs → invoker-capability-XEPW5LMJ.mjs} +12 -11
  87. package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
  88. package/dist/lib/node-esm/meta.json +1 -1
  89. package/dist/lib/node-esm/testing/index.mjs +20 -32
  90. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  91. package/dist/lib/node-esm/testing/react.mjs +11 -11
  92. package/dist/lib/node-esm/ui/index.mjs +14 -12
  93. package/dist/plugin/node-esm/index.mjs +136 -37
  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/annotations.d.ts +1 -0
  97. package/dist/types/src/common/annotations.d.ts.map +1 -0
  98. package/dist/types/src/common/capabilities.d.ts +2 -1
  99. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  100. package/dist/types/src/common/operations.d.ts +1 -1
  101. package/dist/types/src/common/operations.d.ts.map +1 -1
  102. package/dist/types/src/core/activation-event.d.ts +4 -4
  103. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  104. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  105. package/dist/types/src/core/capability.d.ts +2 -2
  106. package/dist/types/src/core/capability.d.ts.map +1 -1
  107. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  108. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  109. package/dist/types/src/core/index.d.ts +5 -0
  110. package/dist/types/src/core/index.d.ts.map +1 -1
  111. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  112. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  113. package/dist/types/src/core/plugin-manager.d.ts +163 -2
  114. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  115. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  116. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  117. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  118. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  119. package/dist/types/src/core/plugin.d.ts +80 -0
  120. package/dist/types/src/core/plugin.d.ts.map +1 -1
  121. package/dist/types/src/core/registry.d.ts +101 -0
  122. package/dist/types/src/core/registry.d.ts.map +1 -0
  123. package/dist/types/src/core/url-loader.d.ts +88 -3
  124. package/dist/types/src/core/url-loader.d.ts.map +1 -1
  125. package/dist/types/src/helpers.d.ts.map +1 -1
  126. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
  127. package/dist/types/src/plugin-operation/history/errors.d.ts +6 -6
  128. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
  129. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
  130. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
  131. package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
  132. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
  133. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
  134. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  135. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
  136. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
  137. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  138. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
  139. package/dist/types/src/plugin-operation/meta.d.ts.map +1 -1
  140. package/dist/types/src/plugin-operation/testing.d.ts +2 -1
  141. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
  142. package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
  143. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  144. package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -1
  145. package/dist/types/src/testing/harness.d.ts +1 -1
  146. package/dist/types/src/testing/harness.d.ts.map +1 -1
  147. package/dist/types/src/testing/react.d.ts.map +1 -1
  148. package/dist/types/src/testing/service.d.ts.map +1 -1
  149. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  150. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  151. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  152. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  153. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  154. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  155. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  156. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  157. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  158. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  159. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  160. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  161. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -1
  162. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
  163. package/dist/types/src/ui/components/Surface/index.d.ts +1 -1
  164. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  165. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  166. package/dist/types/src/ui/components/index.d.ts +1 -0
  167. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  168. package/dist/types/src/ui/hooks/useApp.d.ts +30 -3
  169. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  170. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  171. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  172. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  173. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +20 -36
  174. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -1
  175. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +1 -50
  176. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -1
  177. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
  178. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
  179. package/dist/types/src/vite-plugin/composer/index.d.ts +12 -12
  180. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -1
  181. package/dist/types/src/vite-plugin/import-map/index.d.ts +13 -1
  182. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -1
  183. package/dist/types/src/vite-plugin/manifest.d.ts +30 -5
  184. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -1
  185. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
  186. package/dist/types/tsconfig.tsbuildinfo +1 -1
  187. package/package.json +27 -23
  188. package/src/cli/cli.ts +1 -1
  189. package/src/common/annotations.ts +3 -0
  190. package/src/common/capabilities.ts +2 -1
  191. package/src/common/operations.ts +1 -1
  192. package/src/core/capability.ts +1 -1
  193. package/src/core/edge-registry-plugin-provider.ts +92 -0
  194. package/src/core/index.ts +5 -0
  195. package/src/core/plugin-asset-cache.ts +60 -0
  196. package/src/core/plugin-manager.test.ts +533 -4
  197. package/src/core/plugin-manager.ts +470 -28
  198. package/src/core/plugin-manifest.test.ts +75 -0
  199. package/src/core/plugin-manifest.ts +134 -0
  200. package/src/core/plugin.ts +103 -0
  201. package/src/core/registry.ts +157 -0
  202. package/src/core/url-loader.test.ts +115 -6
  203. package/src/core/url-loader.ts +253 -43
  204. package/src/plugin-operation/history/capability.ts +1 -1
  205. package/src/plugin-operation/history/history-tracker.test.ts +2 -1
  206. package/src/plugin-operation/history/history-tracker.ts +1 -1
  207. package/src/plugin-operation/history/types.ts +1 -1
  208. package/src/plugin-operation/history/undo-mapping.ts +1 -1
  209. package/src/plugin-operation/history/undo-registry.ts +1 -1
  210. package/src/plugin-operation/invoker-capability.ts +2 -1
  211. package/src/plugin-operation/meta.ts +1 -0
  212. package/src/plugin-operation/testing.ts +2 -1
  213. package/src/plugin-runtime/meta.ts +1 -0
  214. package/src/testing/harness.ts +2 -2
  215. package/src/testing/service.ts +1 -1
  216. package/src/testing/withPluginManager.stories.tsx +1 -1
  217. package/src/ui/components/App/App.stories.tsx +2 -6
  218. package/src/ui/components/App/App.tsx +12 -1
  219. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  220. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  221. package/src/ui/components/Placeholder/index.ts +5 -0
  222. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +4 -2
  223. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +1 -1
  224. package/src/ui/components/Surface/SurfaceComponent.tsx +2 -2
  225. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
  226. package/src/ui/components/index.ts +1 -0
  227. package/src/ui/hooks/useApp.test.tsx +1 -1
  228. package/src/ui/hooks/useApp.tsx +161 -26
  229. package/src/ui/hooks/useLoading.tsx +14 -6
  230. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +208 -100
  231. package/src/vite-plugin/boot-loader/boot-loader.css +248 -45
  232. package/src/vite-plugin/boot-loader/boot-loader.js +309 -39
  233. package/src/vite-plugin/boot-loader/index.ts +1 -95
  234. package/src/vite-plugin/boot-loader/loader.ts +123 -0
  235. package/src/vite-plugin/composer/index.ts +61 -39
  236. package/src/vite-plugin/import-map/index.ts +42 -5
  237. package/src/vite-plugin/index.ts +2 -2
  238. package/src/vite-plugin/manifest.test.ts +27 -4
  239. package/src/vite-plugin/manifest.ts +42 -5
  240. package/src/vite-plugin/packages.ts +8 -2
  241. package/tsconfig.json +16 -1
  242. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  243. package/dist/lib/browser/capability-DOMNPRJP.mjs.map +0 -7
  244. package/dist/lib/browser/chunk-7B6AJK4D.mjs +0 -964
  245. package/dist/lib/browser/chunk-7B6AJK4D.mjs.map +0 -7
  246. package/dist/lib/browser/chunk-BMIAYUWT.mjs.map +0 -7
  247. package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +0 -7
  248. package/dist/lib/browser/chunk-GDWTW4ZW.mjs.map +0 -7
  249. package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +0 -7
  250. package/dist/lib/browser/chunk-QRTB4Q3U.mjs.map +0 -7
  251. package/dist/lib/browser/chunk-RFSO3JRG.mjs +0 -1
  252. package/dist/lib/browser/chunk-RFSO3JRG.mjs.map +0 -7
  253. package/dist/lib/browser/chunk-Y543KCO7.mjs +0 -174
  254. package/dist/lib/browser/chunk-Y543KCO7.mjs.map +0 -7
  255. package/dist/lib/browser/invoker-capability-VCMPQOIA.mjs.map +0 -7
  256. package/dist/lib/node-esm/capability-KJTQIWDK.mjs.map +0 -7
  257. package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs +0 -965
  258. package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs.map +0 -7
  259. package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs +0 -175
  260. package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs.map +0 -7
  261. package/dist/lib/node-esm/chunk-EL3R25OQ.mjs +0 -2
  262. package/dist/lib/node-esm/chunk-EL3R25OQ.mjs.map +0 -7
  263. package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +0 -7
  264. package/dist/lib/node-esm/chunk-HI3YBICQ.mjs.map +0 -7
  265. package/dist/lib/node-esm/chunk-JPWVIQ5I.mjs.map +0 -7
  266. package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +0 -7
  267. package/dist/lib/node-esm/chunk-WZ6DHQER.mjs.map +0 -7
  268. package/dist/lib/node-esm/invoker-capability-EGA3XW6J.mjs.map +0 -7
  269. /package/dist/lib/browser/{capability-KSNT34SN.mjs.map → capability-LUKGKUQH.mjs.map} +0 -0
  270. /package/dist/lib/browser/{chunk-I34GF4NG.mjs.map → chunk-45CHLTBV.mjs.map} +0 -0
  271. /package/dist/lib/node-esm/{capability-EOQTORML.mjs.map → capability-FCGZVIEG.mjs.map} +0 -0
  272. /package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs.map → chunk-6XW6LET6.mjs.map} +0 -0
@@ -0,0 +1,75 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { describe, test } from 'vitest';
6
+
7
+ import * as PluginManifest from './plugin-manifest';
8
+
9
+ describe('PluginManifest', () => {
10
+ describe('parse', () => {
11
+ test('resolves entry and assets relative to manifest URL', ({ expect }) => {
12
+ const resolved = PluginManifest.parse('https://example.com/plugins/foo/manifest.json', {
13
+ id: 'com.example.foo',
14
+ name: 'Foo',
15
+ version: '1.0.0',
16
+ assets: ['index.mjs', 'style.css', 'chunks/lib-abc.js'],
17
+ });
18
+ expect(resolved.id).toBe('com.example.foo');
19
+ expect(resolved.dev).toBe(false);
20
+ expect(resolved.entryUrl).toBe('https://example.com/plugins/foo/index.mjs');
21
+ expect(resolved.assetUrls).toEqual([
22
+ 'https://example.com/plugins/foo/index.mjs',
23
+ 'https://example.com/plugins/foo/style.css',
24
+ 'https://example.com/plugins/foo/chunks/lib-abc.js',
25
+ ]);
26
+ });
27
+
28
+ test('throws if the canonical entry filename is not listed in assets', ({ expect }) => {
29
+ expect(() =>
30
+ PluginManifest.parse('https://example.com/manifest.json', {
31
+ id: 'a',
32
+ name: 'A',
33
+ version: '0.0.1',
34
+ assets: ['style.css'],
35
+ }),
36
+ ).toThrow();
37
+ });
38
+
39
+ test('throws on missing required fields', ({ expect }) => {
40
+ expect(() =>
41
+ PluginManifest.parse('https://example.com/manifest.json', {
42
+ name: 'A',
43
+ version: '0.0.1',
44
+ assets: ['index.mjs'],
45
+ }),
46
+ ).toThrow();
47
+ });
48
+
49
+ test('devEntry flips dev mode and resolves the entry against the manifest URL', ({ expect }) => {
50
+ const resolved = PluginManifest.parse('http://localhost:3967/manifest.json', {
51
+ id: 'com.example.foo',
52
+ name: 'Foo',
53
+ version: '0.0.0-dev',
54
+ assets: [],
55
+ devEntry: 'src/plugin.tsx',
56
+ });
57
+ expect(resolved.dev).toBe(true);
58
+ expect(resolved.entryUrl).toBe('http://localhost:3967/src/plugin.tsx');
59
+ expect(resolved.assetUrls).toEqual([]);
60
+ });
61
+
62
+ test('devEntry waives the canonical-entry-in-assets requirement', ({ expect }) => {
63
+ // No `index.mjs` in assets — would throw without devEntry.
64
+ expect(() =>
65
+ PluginManifest.parse('http://localhost:3967/manifest.json', {
66
+ id: 'a',
67
+ name: 'A',
68
+ version: '0.0.0-dev',
69
+ assets: [],
70
+ devEntry: 'src/plugin.tsx',
71
+ }),
72
+ ).not.toThrow();
73
+ });
74
+ });
75
+ });
@@ -0,0 +1,134 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import * as FetchHttpClient from '@effect/platform/FetchHttpClient';
6
+ import * as HttpClient from '@effect/platform/HttpClient';
7
+ import * as HttpClientRequest from '@effect/platform/HttpClientRequest';
8
+ import * as HttpClientResponse from '@effect/platform/HttpClientResponse';
9
+ import * as Effect from 'effect/Effect';
10
+ import * as Schema from 'effect/Schema';
11
+
12
+ import { BaseError } from '@dxos/errors';
13
+ import { PLUGIN_ENTRY_FILENAME } from '@dxos/protocols';
14
+
15
+ /**
16
+ * Default port the Vite plugin (`composerPlugin`) binds the dev server to.
17
+ *
18
+ * Shared single source of truth — `composerPlugin` reads it as the default
19
+ * port, and the host's "Load Dev Plugin" affordance pre-fills the manifest URL
20
+ * with `http://localhost:${PLUGIN_DEV_SERVER_PORT}/manifest.json`. Lives in
21
+ * app-framework rather than `@dxos/protocols` because the constant is a
22
+ * client-side convention (host loader + Vite plugin) rather than a wire-level
23
+ * protocol.
24
+ */
25
+ export const PLUGIN_DEV_SERVER_PORT = 3967;
26
+
27
+ /**
28
+ * Tagged error for manifest fetch / parse failures. Construction sites set
29
+ * `context.manifestUrl` and `context.reason` (one of `'fetch-failed' |
30
+ * 'http-error' | 'parse-failed' | 'invalid'`) so handlers can route on the
31
+ * specific failure mode.
32
+ */
33
+ export class PluginManifestError extends BaseError.extend('PluginManifestError', 'Plugin manifest is invalid') {}
34
+
35
+ /**
36
+ * Schema for a third-party plugin manifest.
37
+ *
38
+ * Production manifests are published as a sibling of the plugin's entry module
39
+ * ({@link PLUGIN_ENTRY_FILENAME}) and advertise every file the plugin needs at
40
+ * runtime so the host can eagerly cache them for offline use.
41
+ *
42
+ * Dev manifests (served by `vite dev` via {@link composerPlugin}) set `devEntry`
43
+ * to point at the unbundled source entry. The host's loader treats the presence
44
+ * of `devEntry` as the dev-mode signal: it imports the entry directly from the
45
+ * dev server, skips eager asset caching, and skips static stylesheet injection
46
+ * (Vite handles CSS via runtime `<style>` injection during HMR). `assets` is not
47
+ * required to enumerate every file in dev mode — chunks and styles flow through
48
+ * the dev server on demand.
49
+ */
50
+ export const Manifest = Schema.Struct({
51
+ id: Schema.String,
52
+ name: Schema.String,
53
+ version: Schema.String,
54
+ assets: Schema.Array(Schema.String),
55
+ devEntry: Schema.String.pipe(Schema.optional),
56
+ });
57
+
58
+ export type Manifest = Schema.Schema.Type<typeof Manifest>;
59
+
60
+ /**
61
+ * Resolved manifest with all asset paths converted to absolute URLs.
62
+ *
63
+ * `dev` reflects whether the source manifest declared a `devEntry`. Loaders branch
64
+ * on this to skip offline caching and stylesheet injection — both are no-ops (or
65
+ * actively wrong) when the plugin is being served by a Vite dev server.
66
+ */
67
+ export type ResolvedManifest = {
68
+ id: string;
69
+ name: string;
70
+ version: string;
71
+ entryUrl: string;
72
+ assetUrls: readonly string[];
73
+ dev: boolean;
74
+ };
75
+
76
+ /**
77
+ * Resolves a parsed manifest's relative asset paths against the manifest's URL.
78
+ * In dev mode the entry comes from `devEntry`; otherwise it's the canonical
79
+ * {@link PLUGIN_ENTRY_FILENAME} sitting next to the manifest.
80
+ */
81
+ const resolve = (manifestUrl: string, manifest: Manifest): ResolvedManifest => {
82
+ const dev = manifest.devEntry !== undefined;
83
+ return {
84
+ id: manifest.id,
85
+ name: manifest.name,
86
+ version: manifest.version,
87
+ entryUrl: new URL(dev ? manifest.devEntry! : PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),
88
+ assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),
89
+ dev,
90
+ };
91
+ };
92
+
93
+ /**
94
+ * Synchronous decode + validate + resolve for an in-memory manifest payload. Used
95
+ * by tests and tooling that have the manifest body already loaded; the runtime
96
+ * path goes through {@link fetchManifest}.
97
+ */
98
+ export const parse = (manifestUrl: string, payload: unknown): ResolvedManifest => {
99
+ const manifest = Schema.decodeUnknownSync(Manifest)(payload);
100
+ if (manifest.devEntry === undefined && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
101
+ throw new Error(`Manifest at ${manifestUrl} does not list ${PLUGIN_ENTRY_FILENAME} in assets.`);
102
+ }
103
+ return resolve(manifestUrl, manifest);
104
+ };
105
+
106
+ /**
107
+ * Fetches and parses a manifest from the given URL via Effect's HTTP client and
108
+ * Schema-driven JSON decoding. All failure modes surface as a single tagged
109
+ * {@link PluginManifestError}; callers route on `error.context.reason`.
110
+ */
111
+ export const fetchManifest = (manifestUrl: string): Effect.Effect<ResolvedManifest, PluginManifestError> =>
112
+ Effect.gen(function* () {
113
+ const response = yield* HttpClientRequest.get(manifestUrl).pipe(
114
+ HttpClient.execute,
115
+ Effect.mapError((cause) => new PluginManifestError({ context: { manifestUrl, reason: 'fetch-failed' }, cause })),
116
+ );
117
+ if (response.status >= 400) {
118
+ return yield* Effect.fail(
119
+ new PluginManifestError({ context: { manifestUrl, reason: 'http-error', status: response.status } }),
120
+ );
121
+ }
122
+ const manifest = yield* HttpClientResponse.schemaBodyJson(Manifest)(response).pipe(
123
+ Effect.mapError((cause) => new PluginManifestError({ context: { manifestUrl, reason: 'parse-failed' }, cause })),
124
+ );
125
+ if (manifest.devEntry === undefined && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
126
+ return yield* Effect.fail(
127
+ new PluginManifestError({
128
+ context: { manifestUrl, reason: 'invalid' },
129
+ cause: `assets does not include ${PLUGIN_ENTRY_FILENAME}`,
130
+ }),
131
+ );
132
+ }
133
+ return resolve(manifestUrl, manifest);
134
+ }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer));
@@ -7,6 +7,7 @@ import * as Effect from 'effect/Effect';
7
7
  import * as Option from 'effect/Option';
8
8
  import * as Pipeable from 'effect/Pipeable';
9
9
 
10
+ import { BaseError } from '@dxos/errors';
10
11
  import { invariant } from '@dxos/invariant';
11
12
 
12
13
  import type * as ActivationEvent from './activation-event';
@@ -353,3 +354,105 @@ export function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {
353
354
 
354
355
  return Object.assign(factory, { meta });
355
356
  }
357
+
358
+ //
359
+ // Lazy plugin loading
360
+ //
361
+
362
+ /**
363
+ * Symbol used to tag lazy plugin stubs with their loader closure.
364
+ * Hidden from enumeration so plugin manager iteration / serialization paths
365
+ * don't trip over it.
366
+ */
367
+ const LazyTag: unique symbol = Symbol.for('@dxos/app-framework/Plugin/Lazy');
368
+
369
+ /**
370
+ * Async loader for a lazy plugin's real implementation.
371
+ * The default export of the loaded module must be a `PluginFactory<T>` —
372
+ * i.e. the same shape `Plugin.make` produces.
373
+ */
374
+ export type LazyLoader<T = void> = () => Promise<{ default: PluginFactory<T> }>;
375
+
376
+ /** Internal: payload carried on a lazy stub. */
377
+ type LazyPayload = { loader: LazyLoader<any>; options: unknown };
378
+
379
+ /**
380
+ * Defines a lazy plugin whose body is loaded on first enable.
381
+ *
382
+ * The returned factory produces a stub `Plugin` that exposes `meta`
383
+ * synchronously (so callers can read `Plugin.meta.id` for free) but defers
384
+ * loading the real plugin's modules until the manager calls
385
+ * `Plugin.resolveLazy`. This lets the plugin's main entry point ship as a
386
+ * tiny meta-only chunk — the heavy capabilities, schema, React surfaces,
387
+ * etc. live behind the dynamic `import()` and become a separate Rollup
388
+ * chunk that is only fetched when the plugin is enabled.
389
+ *
390
+ * @example
391
+ * ```ts
392
+ * // plugin-markdown/src/index.ts
393
+ * import { Plugin } from '@dxos/app-framework';
394
+ * import { meta } from './meta';
395
+ *
396
+ * export const MarkdownPlugin = Plugin.lazy(meta, () => import('./MarkdownPlugin'));
397
+ *
398
+ * // plugin-markdown/src/MarkdownPlugin.tsx
399
+ * export const MarkdownPlugin = Plugin.define(meta).pipe(...heavy modules..., Plugin.make);
400
+ * export default MarkdownPlugin;
401
+ * ```
402
+ */
403
+ export const lazy = <T = void>(meta: Meta, loader: LazyLoader<T>): PluginFactory<T> => {
404
+ const factory = (options: T): Plugin => {
405
+ const stub = new PluginImpl(meta, []);
406
+ Object.defineProperty(stub, LazyTag, {
407
+ value: { loader, options } satisfies LazyPayload,
408
+ enumerable: false,
409
+ });
410
+ return stub;
411
+ };
412
+ return Object.assign(factory, { meta });
413
+ };
414
+
415
+ /**
416
+ * Type guard for lazy plugin stubs produced by {@link lazy}.
417
+ */
418
+ export const isLazy = (plugin: Plugin): boolean => LazyTag in plugin;
419
+
420
+ /**
421
+ * Tagged error for failures during lazy plugin resolution. `context.id` is
422
+ * the lazy plugin's `meta.id`; `context.reason` discriminates the failure
423
+ * mode (`'load-failed' | 'missing-default' | 'invalid-plugin' |
424
+ * 'meta-mismatch'`) so callers can route on it.
425
+ */
426
+ export class LazyPluginError extends BaseError.extend('LazyPluginError', 'Failed to resolve lazy plugin') {}
427
+
428
+ /**
429
+ * Resolves a lazy plugin stub to its real plugin.
430
+ * Returns the plugin unchanged if it is not lazy. Failures surface as
431
+ * {@link LazyPluginError} with `context.reason` indicating the failure mode
432
+ * and (for loader failures) `cause` set to the original error.
433
+ */
434
+ export const resolveLazy = (plugin: Plugin): Effect.Effect<Plugin, LazyPluginError> =>
435
+ Effect.gen(function* () {
436
+ if (!isLazy(plugin)) {
437
+ return plugin;
438
+ }
439
+ const id = plugin.meta.id;
440
+ const { loader, options } = (plugin as unknown as { [LazyTag]: LazyPayload })[LazyTag];
441
+ const mod = yield* Effect.tryPromise({
442
+ try: loader,
443
+ catch: (error) => new LazyPluginError({ context: { id, reason: 'load-failed' }, cause: error }),
444
+ });
445
+ if (!mod || typeof mod.default !== 'function') {
446
+ return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'missing-default' } }));
447
+ }
448
+ const result = mod.default(options);
449
+ if (!isPlugin(result)) {
450
+ return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'invalid-plugin' } }));
451
+ }
452
+ if (result.meta.id !== id) {
453
+ return yield* Effect.fail(
454
+ new LazyPluginError({ context: { id, reason: 'meta-mismatch', returnedId: result.meta.id } }),
455
+ );
456
+ }
457
+ return result;
458
+ });
@@ -0,0 +1,157 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { Atom, type Registry as AtomRegistry } from '@effect-atom/atom-react';
6
+ import * as Effect from 'effect/Effect';
7
+
8
+ import { runAndForwardErrors } from '@dxos/effect';
9
+ import { log } from '@dxos/log';
10
+
11
+ /**
12
+ * A registry plugin entry as seen by the plugin manager layer.
13
+ * Populated from the registry catalog; represents the latest available version of a plugin.
14
+ *
15
+ * Independently defined from @dxos/protocols PluginEntry — similar shape but not the same type.
16
+ * Implementations of {@link PluginProvider} (e.g. {@link EdgeRegistryPluginProvider})
17
+ * are responsible for mapping their wire-format entries to this shape.
18
+ */
19
+ export type Plugin = {
20
+ id: string;
21
+ name: string;
22
+ description?: string;
23
+ homePage?: string;
24
+ source?: string;
25
+ screenshots?: string[];
26
+ tags?: string[];
27
+ icon?: string;
28
+ iconHue?: string;
29
+ /** URL to dynamic-import the latest version of this plugin module. */
30
+ moduleUrl: string;
31
+ /** GitHub repository slug, e.g. `owner/name`. Used to fetch version history. */
32
+ repo: string;
33
+ /**
34
+ * Latest known version string, e.g. `v1.2.0`.
35
+ * Corresponds to releaseTag in the wire-format PluginEntry; named `version` here
36
+ * because the plugin manager layer speaks versions, not release tags.
37
+ */
38
+ version: string;
39
+ };
40
+
41
+ /**
42
+ * A single installable version of a registry plugin.
43
+ */
44
+ export type PluginVersion = {
45
+ /** Version string, e.g. `v1.2.0`. */
46
+ tag: string;
47
+ /** URL to dynamic-import this specific version of the plugin module. */
48
+ moduleUrl: string;
49
+ /** Unix ms of when this version was published (optional; omitted when unknown). */
50
+ releasedAt?: number;
51
+ };
52
+
53
+ /**
54
+ * Abstraction over the plugin registry catalog backend.
55
+ * Implementations may call Edge, a local cache, or a stub.
56
+ *
57
+ * The interface itself is transport-agnostic; concrete implementations live
58
+ * alongside it in this package (see {@link EdgeRegistryPluginProvider}) so we
59
+ * avoid `app-framework ↔ edge-client` cycles, but they only need to satisfy
60
+ * this shape — callers can substitute their own.
61
+ */
62
+ export interface PluginProvider {
63
+ /**
64
+ * Returns all healthy registry plugins (latest version of each).
65
+ */
66
+ listPlugins(): Effect.Effect<readonly Plugin[], Error>;
67
+
68
+ /**
69
+ * Returns all known versions of a plugin identified by its GitHub repo slug.
70
+ * Until the backend implements a versions endpoint, implementations MUST
71
+ * return at least one entry representing the current/latest release.
72
+ */
73
+ listVersions(repo: string): Effect.Effect<readonly PluginVersion[], Error>;
74
+
75
+ /**
76
+ * Returns a single plugin entry for the given repo.
77
+ * If `version` is omitted, returns the latest.
78
+ * Fails if the specified version is not found.
79
+ */
80
+ getPlugin(repo: string, version?: string): Effect.Effect<Plugin, Error>;
81
+ }
82
+
83
+ /**
84
+ * Atomic snapshot of the registry catalog as observed by the host.
85
+ * Exposed via {@link Manager.plugins} so consumers can subscribe reactively
86
+ * (loading state, list contents, last error).
87
+ */
88
+ export type PluginsState = {
89
+ entries: readonly Plugin[];
90
+ loading: boolean;
91
+ error: Error | null;
92
+ };
93
+
94
+ /**
95
+ * Default no-op provider used when no `PluginProvider` is supplied at construction
96
+ * time (e.g. tests, stories, environments without an Edge connection).
97
+ *
98
+ * `listPlugins` returns an empty list (so `Manager.plugins` settles to a stable
99
+ * empty state). `listVersions` and `getPlugin` fail with an explicit error so
100
+ * callers know they need to configure a real provider.
101
+ */
102
+ const NULL_PROVIDER: PluginProvider = {
103
+ listPlugins: () => Effect.succeed([] as readonly Plugin[]),
104
+ listVersions: () => Effect.fail(new Error('No plugin registry provider configured')),
105
+ getPlugin: () => Effect.fail(new Error('No plugin registry provider configured')),
106
+ };
107
+
108
+ /**
109
+ * Owns the cached registry catalog state and forwards `listVersions` / `getPlugin`
110
+ * calls to the underlying {@link PluginProvider}. Lives on the `PluginManager`
111
+ * (as `manager.pluginRegistry`) so consumers can reach it through the manager
112
+ * without a separate capability lookup.
113
+ *
114
+ * On construction the manager kicks off a background fetch via `provider.listPlugins()`
115
+ * and writes the result into the {@link plugins} atom. Subscribers see `loading: true`
116
+ * during the fetch and `loading: false` once it settles.
117
+ */
118
+ export class Manager {
119
+ readonly plugins: Atom.Writable<PluginsState>;
120
+ readonly #provider: PluginProvider;
121
+
122
+ constructor(provider: PluginProvider | undefined, atomRegistry: AtomRegistry.Registry) {
123
+ this.#provider = provider ?? NULL_PROVIDER;
124
+ const initialLoading = provider !== undefined;
125
+ this.plugins = Atom.make<PluginsState>({ entries: [], loading: initialLoading, error: null }).pipe(Atom.keepAlive);
126
+
127
+ if (provider !== undefined) {
128
+ // Fire-and-forget initial load. Errors are surfaced via the atom's `error` field.
129
+ void runAndForwardErrors(
130
+ provider.listPlugins().pipe(
131
+ Effect.match({
132
+ onSuccess: (entries) => atomRegistry.set(this.plugins, { entries, loading: false, error: null }),
133
+ onFailure: (error) => {
134
+ log.catch(error);
135
+ atomRegistry.set(this.plugins, { entries: [], loading: false, error });
136
+ },
137
+ }),
138
+ ),
139
+ );
140
+ }
141
+ }
142
+
143
+ /** Forwards to the underlying provider. */
144
+ listPlugins(): Effect.Effect<readonly Plugin[], Error> {
145
+ return this.#provider.listPlugins();
146
+ }
147
+
148
+ /** Forwards to the underlying provider. */
149
+ listVersions(repo: string): Effect.Effect<readonly PluginVersion[], Error> {
150
+ return this.#provider.listVersions(repo);
151
+ }
152
+
153
+ /** Forwards to the underlying provider. */
154
+ getPlugin(repo: string, version?: string): Effect.Effect<Plugin, Error> {
155
+ return this.#provider.getPlugin(repo, version);
156
+ }
157
+ }
@@ -5,11 +5,49 @@
5
5
  import { assert, describe, it } from '@effect/vitest';
6
6
  import * as Effect from 'effect/Effect';
7
7
 
8
+ import { runAndForwardErrors } from '@dxos/effect';
9
+
8
10
  import * as Plugin from './plugin';
11
+ import * as PluginAssetCache from './plugin-asset-cache';
9
12
  import * as UrlLoader from './url-loader';
10
13
 
11
14
  const testMeta = { id: 'org.dxos.plugin.test', name: 'Test' };
12
15
 
16
+ const memoryStorage = (initial: string | null = null): UrlLoader.Storage => {
17
+ let value = initial;
18
+ return {
19
+ get: () => value,
20
+ set: (_key, next) => {
21
+ value = next;
22
+ },
23
+ };
24
+ };
25
+
26
+ type CacheCall = { method: 'cache' | 'evict' | 'resolve'; pluginId: string; urls?: readonly string[]; url?: string };
27
+
28
+ const recordingCache = (): { cache: PluginAssetCache.Cache; calls: CacheCall[] } => {
29
+ const calls: CacheCall[] = [];
30
+ return {
31
+ calls,
32
+ cache: {
33
+ cache: (pluginId, urls) =>
34
+ Effect.sync(() => {
35
+ calls.push({ method: 'cache', pluginId, urls });
36
+ }),
37
+ evict: (pluginId) =>
38
+ Effect.sync(() => {
39
+ calls.push({ method: 'evict', pluginId });
40
+ }),
41
+ resolve: (pluginId, url) =>
42
+ Effect.sync(() => {
43
+ calls.push({ method: 'resolve', pluginId, url });
44
+ return url;
45
+ }),
46
+ list: () => Effect.succeed([] as readonly string[]),
47
+ },
48
+ };
49
+ };
50
+
13
51
  describe('UrlLoader', () => {
14
52
  describe('isLocalUrl', () => {
15
53
  it('matches localhost, 127.0.0.1, and ::1', ({ expect }) => {
@@ -44,13 +82,56 @@ describe('UrlLoader', () => {
44
82
  });
45
83
  });
46
84
 
85
+ describe('setInstalledVersion / getInstalledVersion', () => {
86
+ it('stores and retrieves an installed version', ({ expect }) => {
87
+ const stored: Record<string, string> = {};
88
+ const storage: UrlLoader.Storage = {
89
+ get: (key) => stored[key] ?? null,
90
+ set: (key, value) => {
91
+ stored[key] = value;
92
+ },
93
+ };
94
+
95
+ // Seed a remote entry without a version.
96
+ storage.set('test-key', JSON.stringify([{ id: 'org.dxos.plugin.foo', url: 'http://example.com/p.mjs' }]));
97
+
98
+ UrlLoader.setInstalledVersion('org.dxos.plugin.foo', 'v1.0.0', { storage, key: 'test-key' });
99
+
100
+ expect(UrlLoader.getInstalledVersion('org.dxos.plugin.foo', { storage, key: 'test-key' })).toBe('v1.0.0');
101
+ });
102
+
103
+ it('returns undefined when plugin is not persisted', ({ expect }) => {
104
+ const storage: UrlLoader.Storage = { get: () => null, set: () => {} };
105
+ expect(UrlLoader.getInstalledVersion('org.dxos.plugin.missing', { storage })).toBeUndefined();
106
+ });
107
+
108
+ it('overwrites an existing version when called again', ({ expect }) => {
109
+ const stored: Record<string, string> = {};
110
+ const storage: UrlLoader.Storage = {
111
+ get: (key) => stored[key] ?? null,
112
+ set: (key, value) => {
113
+ stored[key] = value;
114
+ },
115
+ };
116
+ storage.set(
117
+ 'test-key',
118
+ JSON.stringify([{ id: 'org.dxos.plugin.foo', url: 'http://example.com/p.mjs', version: 'v1.0.0' }]),
119
+ );
120
+
121
+ UrlLoader.setInstalledVersion('org.dxos.plugin.foo', 'v2.0.0', { storage, key: 'test-key' });
122
+ expect(UrlLoader.getInstalledVersion('org.dxos.plugin.foo', { storage, key: 'test-key' })).toBe('v2.0.0');
123
+ });
124
+ });
125
+
47
126
  describe('make', () => {
48
127
  it.effect('resolves built-in plugins by meta.id', () =>
49
128
  Effect.gen(function* () {
50
129
  const testPlugin = Plugin.make(Plugin.define(testMeta))();
51
130
  const loader = UrlLoader.make([testPlugin]);
52
131
  const result = yield* loader(testMeta.id);
53
- assert.strictEqual(result.meta.id, testMeta.id);
132
+ assert.strictEqual(result.plugin.meta.id, testMeta.id);
133
+ // Builtins are not dev plugins.
134
+ assert.notOk(result.dev);
54
135
  }),
55
136
  );
56
137
 
@@ -69,7 +150,7 @@ describe('UrlLoader', () => {
69
150
  get: () => null,
70
151
  set: () => {},
71
152
  };
72
- const result = await UrlLoader.preload({ storage });
153
+ const result = await runAndForwardErrors(UrlLoader.preload({ storage }));
73
154
  expect(result).toEqual([]);
74
155
  });
75
156
 
@@ -78,7 +159,7 @@ describe('UrlLoader', () => {
78
159
  get: () => '{{invalid json',
79
160
  set: () => {},
80
161
  };
81
- const result = await UrlLoader.preload({ storage });
162
+ const result = await runAndForwardErrors(UrlLoader.preload({ storage }));
82
163
  expect(result).toEqual([]);
83
164
  });
84
165
 
@@ -87,7 +168,7 @@ describe('UrlLoader', () => {
87
168
  get: () => 'null',
88
169
  set: () => {},
89
170
  };
90
- const result = await UrlLoader.preload({ storage });
171
+ const result = await runAndForwardErrors(UrlLoader.preload({ storage }));
91
172
  expect(result).toEqual([]);
92
173
  });
93
174
 
@@ -96,7 +177,7 @@ describe('UrlLoader', () => {
96
177
  get: () => '{}',
97
178
  set: () => {},
98
179
  };
99
- const result = await UrlLoader.preload({ storage });
180
+ const result = await runAndForwardErrors(UrlLoader.preload({ storage }));
100
181
  expect(result).toEqual([]);
101
182
  });
102
183
 
@@ -105,8 +186,36 @@ describe('UrlLoader', () => {
105
186
  get: () => '[{"title":"no url"}]',
106
187
  set: () => {},
107
188
  };
108
- const result = await UrlLoader.preload({ storage });
189
+ const result = await runAndForwardErrors(UrlLoader.preload({ storage }));
109
190
  expect(result).toEqual([]);
110
191
  });
111
192
  });
193
+
194
+ describe('uninstall', () => {
195
+ it('removes the persisted entry and evicts cached assets', async ({ expect }) => {
196
+ const storage = memoryStorage('[{"id":"p1","url":"https://x/p1.json"},{"id":"p2","url":"https://x/p2.json"}]');
197
+ const { cache, calls } = recordingCache();
198
+ await runAndForwardErrors(UrlLoader.uninstall('p1', { storage, cache }));
199
+ expect(UrlLoader.getRemoteEntries({ storage })).toEqual([{ id: 'p2', url: 'https://x/p2.json' }]);
200
+ expect(calls).toEqual([{ method: 'evict', pluginId: 'p1' }]);
201
+ });
202
+
203
+ it('still removes entry when cache eviction fails', async ({ expect }) => {
204
+ const storage = memoryStorage('[{"id":"p1","url":"https://x/p1.json"}]');
205
+ const cache: PluginAssetCache.Cache = {
206
+ cache: () => Effect.void,
207
+ evict: () =>
208
+ Effect.fail(
209
+ new PluginAssetCache.PluginAssetCacheError({
210
+ context: { operation: 'evict', pluginId: 'p1' },
211
+ cause: 'boom',
212
+ }),
213
+ ),
214
+ resolve: (_id, url) => Effect.succeed(url),
215
+ list: () => Effect.succeed([] as readonly string[]),
216
+ };
217
+ await runAndForwardErrors(UrlLoader.uninstall('p1', { storage, cache }));
218
+ expect(UrlLoader.getRemoteEntries({ storage })).toEqual([]);
219
+ });
220
+ });
112
221
  });