@dxos/app-framework 0.8.4-main.c4373fc → 0.8.4-main.cb12b3f963

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 (580) hide show
  1. package/.storybook/main.mts +2 -4
  2. package/.storybook/preview.mts +2 -2
  3. package/dist/lib/browser/capability-5RRH3WIB.mjs +35 -0
  4. package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
  5. package/dist/lib/browser/capability-LUKGKUQH.mjs +38 -0
  6. package/dist/lib/browser/capability-LUKGKUQH.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-23D4SJUE.mjs +42 -0
  8. package/dist/lib/browser/chunk-23D4SJUE.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-3JWJXGLK.mjs +79 -0
  10. package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
  12. package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-66IXTIVK.mjs +48 -0
  14. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
  16. package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
  18. package/dist/lib/browser/chunk-FJ4765WW.mjs.map +7 -0
  19. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  20. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  21. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  22. package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
  23. package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
  25. package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
  26. package/dist/lib/browser/chunk-PC4NOADA.mjs +471 -0
  27. package/dist/lib/browser/chunk-PC4NOADA.mjs.map +7 -0
  28. package/dist/lib/browser/chunk-WBHCSOBW.mjs +80 -0
  29. package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
  30. package/dist/lib/browser/chunk-Z55LVAGN.mjs +213 -0
  31. package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
  32. package/dist/lib/browser/chunk-ZGJAZSNE.mjs +142 -0
  33. package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
  34. package/dist/lib/browser/cli/index.mjs +76 -0
  35. package/dist/lib/browser/cli/index.mjs.map +7 -0
  36. package/dist/lib/browser/common/activation-events.mjs +24 -0
  37. package/dist/lib/browser/common/capabilities.mjs +46 -0
  38. package/dist/lib/browser/core/activation-event.mjs +20 -0
  39. package/dist/lib/browser/core/capability.mjs +30 -0
  40. package/dist/lib/browser/core/capability.mjs.map +7 -0
  41. package/dist/lib/browser/core/plugin-manager.mjs +19 -0
  42. package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
  43. package/dist/lib/browser/core/plugin.mjs +37 -0
  44. package/dist/lib/browser/core/plugin.mjs.map +7 -0
  45. package/dist/lib/browser/core/url-loader.mjs +24 -0
  46. package/dist/lib/browser/core/url-loader.mjs.map +7 -0
  47. package/dist/lib/browser/index.mjs +102 -148
  48. package/dist/lib/browser/index.mjs.map +4 -4
  49. package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs +44 -0
  50. package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
  51. package/dist/lib/browser/meta.json +1 -1
  52. package/dist/lib/browser/testing/index.mjs +231 -41
  53. package/dist/lib/browser/testing/index.mjs.map +4 -4
  54. package/dist/lib/browser/testing/react.mjs +78 -0
  55. package/dist/lib/browser/testing/react.mjs.map +7 -0
  56. package/dist/lib/browser/ui/index.mjs +48 -0
  57. package/dist/lib/browser/ui/index.mjs.map +7 -0
  58. package/dist/lib/node-esm/capability-FCGZVIEG.mjs +39 -0
  59. package/dist/lib/node-esm/capability-FCGZVIEG.mjs.map +7 -0
  60. package/dist/lib/node-esm/capability-JOIQ2MQE.mjs +36 -0
  61. package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +10 -0
  63. package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-42J2ZUQQ.mjs +472 -0
  65. package/dist/lib/node-esm/chunk-42J2ZUQQ.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
  67. package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-D347W3KO.mjs +143 -0
  69. package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  71. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs +214 -0
  73. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
  75. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
  77. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
  78. package/dist/lib/node-esm/chunk-SBS2YMPT.mjs +43 -0
  79. package/dist/lib/node-esm/chunk-SBS2YMPT.mjs.map +7 -0
  80. package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs +80 -0
  81. package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
  82. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs +81 -0
  83. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
  84. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  85. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  86. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
  87. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
  88. package/dist/lib/node-esm/chunk-XOCUANHO.mjs +49 -0
  89. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
  90. package/dist/lib/node-esm/cli/index.mjs +77 -0
  91. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  92. package/dist/lib/node-esm/common/activation-events.mjs +25 -0
  93. package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
  94. package/dist/lib/node-esm/common/capabilities.mjs +47 -0
  95. package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
  96. package/dist/lib/node-esm/core/activation-event.mjs +21 -0
  97. package/dist/lib/node-esm/core/activation-event.mjs.map +7 -0
  98. package/dist/lib/node-esm/core/capability.mjs +31 -0
  99. package/dist/lib/node-esm/core/capability.mjs.map +7 -0
  100. package/dist/lib/node-esm/core/plugin-manager.mjs +20 -0
  101. package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
  102. package/dist/lib/node-esm/core/plugin.mjs +38 -0
  103. package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
  104. package/dist/lib/node-esm/core/url-loader.mjs +25 -0
  105. package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
  106. package/dist/lib/node-esm/index.mjs +102 -148
  107. package/dist/lib/node-esm/index.mjs.map +4 -4
  108. package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs +45 -0
  109. package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
  110. package/dist/lib/node-esm/meta.json +1 -1
  111. package/dist/lib/node-esm/testing/index.mjs +231 -41
  112. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  113. package/dist/lib/node-esm/testing/react.mjs +79 -0
  114. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  115. package/dist/lib/node-esm/ui/index.mjs +49 -0
  116. package/dist/lib/node-esm/ui/index.mjs.map +7 -0
  117. package/dist/plugin/node-esm/index.mjs +875 -0
  118. package/dist/plugin/node-esm/index.mjs.map +7 -0
  119. package/dist/plugin/node-esm/meta.json +1 -0
  120. package/dist/types/src/cli/cli.d.ts +39 -0
  121. package/dist/types/src/cli/cli.d.ts.map +1 -0
  122. package/dist/types/src/cli/index.d.ts +2 -0
  123. package/dist/types/src/cli/index.d.ts.map +1 -0
  124. package/dist/types/src/common/activation-events.d.ts +27 -0
  125. package/dist/types/src/common/activation-events.d.ts.map +1 -0
  126. package/dist/types/src/common/annotations.d.ts +1 -0
  127. package/dist/types/src/common/annotations.d.ts.map +1 -0
  128. package/dist/types/src/common/capabilities.d.ts +110 -200
  129. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  130. package/dist/types/src/common/index.d.ts +4 -8
  131. package/dist/types/src/common/index.d.ts.map +1 -1
  132. package/dist/types/src/common/operations.d.ts +19 -0
  133. package/dist/types/src/common/operations.d.ts.map +1 -0
  134. package/dist/types/src/common/translations.d.ts +7 -7
  135. package/dist/types/src/common/translations.d.ts.map +1 -1
  136. package/dist/types/src/context.d.ts +5 -0
  137. package/dist/types/src/context.d.ts.map +1 -0
  138. package/dist/types/src/core/{events.d.ts → activation-event.d.ts} +11 -11
  139. package/dist/types/src/core/activation-event.d.ts.map +1 -0
  140. package/dist/types/src/core/capability-manager.d.ts +48 -0
  141. package/dist/types/src/core/capability-manager.d.ts.map +1 -0
  142. package/dist/types/src/core/capability-manager.test.d.ts +2 -0
  143. package/dist/types/src/core/capability-manager.test.d.ts.map +1 -0
  144. package/dist/types/src/core/capability.d.ts +156 -0
  145. package/dist/types/src/core/capability.d.ts.map +1 -0
  146. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  147. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  148. package/dist/types/src/core/index.d.ts +11 -4
  149. package/dist/types/src/core/index.d.ts.map +1 -1
  150. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  151. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  152. package/dist/types/src/core/plugin-manager.d.ts +239 -0
  153. package/dist/types/src/core/plugin-manager.d.ts.map +1 -0
  154. package/dist/types/src/core/plugin-manager.test.d.ts +2 -0
  155. package/dist/types/src/core/plugin-manager.test.d.ts.map +1 -0
  156. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  157. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  158. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  159. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  160. package/dist/types/src/core/plugin.d.ts +207 -39
  161. package/dist/types/src/core/plugin.d.ts.map +1 -1
  162. package/dist/types/src/core/registry.d.ts +101 -0
  163. package/dist/types/src/core/registry.d.ts.map +1 -0
  164. package/dist/types/src/core/url-loader.d.ts +127 -0
  165. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  166. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  167. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  168. package/dist/types/src/helpers.d.ts.map +1 -1
  169. package/dist/types/src/index.d.ts +3 -4
  170. package/dist/types/src/index.d.ts.map +1 -1
  171. package/dist/types/src/plugin-operation/OperationPlugin.d.ts +3 -0
  172. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -0
  173. package/dist/types/src/plugin-operation/history/capability.d.ts +7 -0
  174. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -0
  175. package/dist/types/src/plugin-operation/history/errors.d.ts +32 -0
  176. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -0
  177. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +18 -0
  178. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -0
  179. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts +2 -0
  180. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +1 -0
  181. package/dist/types/src/plugin-operation/history/index.d.ts +6 -0
  182. package/dist/types/src/plugin-operation/history/index.d.ts.map +1 -0
  183. package/dist/types/src/plugin-operation/history/types.d.ts +13 -0
  184. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -0
  185. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +101 -0
  186. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -0
  187. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +23 -0
  188. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -0
  189. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts +2 -0
  190. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +1 -0
  191. package/dist/types/src/plugin-operation/index.d.ts +3 -0
  192. package/dist/types/src/plugin-operation/index.d.ts.map +1 -0
  193. package/dist/types/src/plugin-operation/invoker-capability.d.ts +6 -0
  194. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -0
  195. package/dist/types/src/plugin-operation/meta.d.ts +3 -0
  196. package/dist/types/src/plugin-operation/meta.d.ts.map +1 -0
  197. package/dist/types/src/plugin-operation/testing.d.ts +59 -0
  198. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -0
  199. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +3 -0
  200. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -0
  201. package/dist/types/src/plugin-runtime/capability.d.ts +6 -0
  202. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -0
  203. package/dist/types/src/plugin-runtime/index.d.ts +2 -0
  204. package/dist/types/src/plugin-runtime/index.d.ts.map +1 -0
  205. package/dist/types/src/plugin-runtime/meta.d.ts +3 -0
  206. package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -0
  207. package/dist/types/src/testing/harness.d.ts +67 -0
  208. package/dist/types/src/testing/harness.d.ts.map +1 -0
  209. package/dist/types/src/testing/index.d.ts +2 -0
  210. package/dist/types/src/testing/index.d.ts.map +1 -1
  211. package/dist/types/src/testing/react.d.ts +27 -0
  212. package/dist/types/src/testing/react.d.ts.map +1 -0
  213. package/dist/types/src/testing/react.test.d.ts +2 -0
  214. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  215. package/dist/types/src/testing/service.d.ts +8 -0
  216. package/dist/types/src/testing/service.d.ts.map +1 -0
  217. package/dist/types/src/testing/withPluginManager.d.ts +7 -6
  218. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  219. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  220. package/dist/types/src/ui/components/App/App.d.ts +9 -0
  221. package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
  222. package/dist/types/src/ui/components/App/App.stories.d.ts +19 -0
  223. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
  224. package/dist/types/src/ui/components/App/index.d.ts +2 -0
  225. package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
  226. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  227. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  228. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  229. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  230. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  231. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  232. package/dist/types/src/{playground/playground.stories.d.ts → ui/components/PluginManager/PluginManagerContext.stories.d.ts} +5 -3
  233. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
  234. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts +10 -0
  235. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
  236. package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
  237. package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
  238. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +24 -0
  239. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
  240. package/dist/types/src/{components/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
  241. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
  242. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +11 -0
  243. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
  244. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  245. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  246. package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
  247. package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
  248. package/dist/types/src/ui/components/Surface/index.d.ts +36 -0
  249. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
  250. package/dist/types/src/ui/components/Surface/types.d.ts +197 -0
  251. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
  252. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  253. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  254. package/dist/types/src/ui/components/index.d.ts +5 -0
  255. package/dist/types/src/ui/components/index.d.ts.map +1 -0
  256. package/dist/types/src/ui/hooks/index.d.ts +6 -0
  257. package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
  258. package/dist/types/src/ui/hooks/useApp.d.ts +89 -0
  259. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
  260. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  261. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  262. package/dist/types/src/ui/hooks/useCapabilities.d.ts +31 -0
  263. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
  264. package/dist/types/src/{components → ui/hooks}/useLoading.d.ts +1 -2
  265. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
  266. package/dist/types/src/ui/hooks/useSettingsState.d.ts +10 -0
  267. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
  268. package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
  269. package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
  270. package/dist/types/src/ui/index.d.ts +3 -0
  271. package/dist/types/src/ui/index.d.ts.map +1 -0
  272. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
  273. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
  274. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +52 -0
  275. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  276. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  277. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  278. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  279. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  280. package/dist/types/src/vite-plugin/index.d.ts +5 -0
  281. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  282. package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
  283. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  284. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  285. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  286. package/dist/types/src/vite-plugin/packages.d.ts +13 -0
  287. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  288. package/dist/types/tsconfig.tsbuildinfo +1 -1
  289. package/moon.yml +25 -6
  290. package/package.json +114 -55
  291. package/src/cli/cli.ts +107 -0
  292. package/src/{components → cli}/index.ts +1 -1
  293. package/src/common/activation-events.ts +44 -0
  294. package/src/{playground/layout/index.ts → common/annotations.ts} +0 -2
  295. package/src/common/capabilities.ts +169 -213
  296. package/src/common/index.ts +4 -8
  297. package/src/common/operations.ts +35 -0
  298. package/src/common/translations.ts +17 -9
  299. package/src/context.ts +9 -0
  300. package/src/core/{events.ts → activation-event.ts} +10 -7
  301. package/src/core/capability-manager.test.ts +151 -0
  302. package/src/core/capability-manager.ts +192 -0
  303. package/src/core/capability.ts +247 -0
  304. package/src/core/edge-registry-plugin-provider.ts +92 -0
  305. package/src/core/index.ts +11 -4
  306. package/src/core/plugin-asset-cache.ts +60 -0
  307. package/src/core/plugin-manager.test.ts +1671 -0
  308. package/src/core/plugin-manager.ts +1335 -0
  309. package/src/core/plugin-manifest.test.ts +75 -0
  310. package/src/core/plugin-manifest.ts +134 -0
  311. package/src/core/plugin.ts +365 -45
  312. package/src/core/registry.ts +157 -0
  313. package/src/core/url-loader.test.ts +221 -0
  314. package/src/core/url-loader.ts +388 -0
  315. package/src/index.ts +3 -4
  316. package/src/plugin-operation/OperationPlugin.ts +24 -0
  317. package/src/plugin-operation/history/capability.ts +36 -0
  318. package/src/plugin-operation/history/errors.ts +7 -0
  319. package/src/plugin-operation/history/history-tracker.test.ts +374 -0
  320. package/src/plugin-operation/history/history-tracker.ts +128 -0
  321. package/src/plugin-operation/history/index.ts +9 -0
  322. package/src/plugin-operation/history/types.ts +17 -0
  323. package/src/plugin-operation/history/undo-mapping.ts +135 -0
  324. package/src/plugin-operation/history/undo-registry.test.ts +72 -0
  325. package/src/plugin-operation/history/undo-registry.ts +54 -0
  326. package/src/plugin-operation/index.ts +6 -0
  327. package/src/plugin-operation/invoker-capability.ts +55 -0
  328. package/src/plugin-operation/meta.ts +11 -0
  329. package/src/plugin-operation/testing.ts +155 -0
  330. package/src/plugin-runtime/RuntimePlugin.ts +19 -0
  331. package/src/plugin-runtime/capability.ts +53 -0
  332. package/src/plugin-runtime/index.ts +5 -0
  333. package/src/plugin-runtime/meta.ts +11 -0
  334. package/src/testing/harness.ts +229 -0
  335. package/src/testing/index.ts +2 -0
  336. package/src/testing/react.test.tsx +48 -0
  337. package/src/testing/react.tsx +113 -0
  338. package/src/testing/service.ts +52 -0
  339. package/src/testing/withPluginManager.stories.tsx +8 -9
  340. package/src/testing/withPluginManager.tsx +68 -40
  341. package/src/ui/components/App/App.stories.tsx +92 -0
  342. package/src/ui/components/App/App.tsx +81 -0
  343. package/src/{playground/debug → ui/components/App}/index.ts +1 -1
  344. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  345. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  346. package/src/{playground/logger → ui/components/Placeholder}/index.ts +1 -1
  347. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +185 -0
  348. package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +3 -3
  349. package/src/ui/components/PluginManager/index.ts +5 -0
  350. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +144 -0
  351. package/src/ui/components/Surface/SurfaceComponent.tsx +303 -0
  352. package/src/ui/components/Surface/SurfaceInfo.tsx +107 -0
  353. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  354. package/src/ui/components/Surface/context.ts +12 -0
  355. package/src/ui/components/Surface/index.ts +54 -0
  356. package/src/ui/components/Surface/types.test.ts +126 -0
  357. package/src/ui/components/Surface/types.ts +269 -0
  358. package/src/ui/components/index.ts +8 -0
  359. package/src/ui/hooks/index.ts +9 -0
  360. package/src/ui/hooks/useApp.test.tsx +159 -0
  361. package/src/ui/hooks/useApp.tsx +424 -0
  362. package/src/ui/hooks/useCapabilities.ts +67 -0
  363. package/src/{components → ui/hooks}/useLoading.tsx +16 -10
  364. package/src/ui/hooks/useSettingsState.ts +26 -0
  365. package/src/ui/hooks/useSurface.ts +13 -0
  366. package/src/ui/index.ts +6 -0
  367. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
  368. package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
  369. package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
  370. package/src/vite-plugin/boot-loader/index.ts +112 -0
  371. package/src/vite-plugin/composer/index.ts +306 -0
  372. package/src/vite-plugin/import-map/index.ts +524 -0
  373. package/src/vite-plugin/index.ts +10 -0
  374. package/src/vite-plugin/manifest.test.ts +46 -0
  375. package/src/vite-plugin/manifest.ts +57 -0
  376. package/src/vite-plugin/packages.ts +188 -0
  377. package/tsconfig.json +24 -15
  378. package/tsconfig.node.json +2 -4
  379. package/typedoc.json +2 -4
  380. package/vitest.config.ts +1 -1
  381. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  382. package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
  383. package/dist/lib/browser/app-graph-builder-77MY7KAY.mjs +0 -138
  384. package/dist/lib/browser/app-graph-builder-77MY7KAY.mjs.map +0 -7
  385. package/dist/lib/browser/chunk-4NFLRSTX.mjs +0 -467
  386. package/dist/lib/browser/chunk-4NFLRSTX.mjs.map +0 -7
  387. package/dist/lib/browser/chunk-OKF2PAWO.mjs +0 -1646
  388. package/dist/lib/browser/chunk-OKF2PAWO.mjs.map +0 -7
  389. package/dist/lib/browser/chunk-SCPE4ZO2.mjs +0 -35
  390. package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +0 -7
  391. package/dist/lib/browser/intent-dispatcher-Y4LZNOBC.mjs +0 -11
  392. package/dist/lib/browser/intent-resolver-XO5OYWVD.mjs +0 -39
  393. package/dist/lib/browser/intent-resolver-XO5OYWVD.mjs.map +0 -7
  394. package/dist/lib/browser/store-E3YSBPJQ.mjs +0 -30
  395. package/dist/lib/browser/store-E3YSBPJQ.mjs.map +0 -7
  396. package/dist/lib/browser/worker.mjs +0 -77
  397. package/dist/lib/node-esm/app-graph-builder-WK7WBM6I.mjs +0 -139
  398. package/dist/lib/node-esm/app-graph-builder-WK7WBM6I.mjs.map +0 -7
  399. package/dist/lib/node-esm/chunk-7DNZQ6H2.mjs +0 -1648
  400. package/dist/lib/node-esm/chunk-7DNZQ6H2.mjs.map +0 -7
  401. package/dist/lib/node-esm/chunk-AHCD4UYO.mjs +0 -468
  402. package/dist/lib/node-esm/chunk-AHCD4UYO.mjs.map +0 -7
  403. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs +0 -37
  404. package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +0 -7
  405. package/dist/lib/node-esm/intent-dispatcher-R4CCPBHO.mjs +0 -12
  406. package/dist/lib/node-esm/intent-resolver-NVYY6BQA.mjs +0 -40
  407. package/dist/lib/node-esm/intent-resolver-NVYY6BQA.mjs.map +0 -7
  408. package/dist/lib/node-esm/store-QA5DGTOS.mjs +0 -31
  409. package/dist/lib/node-esm/store-QA5DGTOS.mjs.map +0 -7
  410. package/dist/lib/node-esm/worker.mjs +0 -78
  411. package/dist/types/src/common/collaboration.d.ts +0 -20
  412. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  413. package/dist/types/src/common/events.d.ts +0 -52
  414. package/dist/types/src/common/events.d.ts.map +0 -1
  415. package/dist/types/src/common/file.d.ts +0 -14
  416. package/dist/types/src/common/file.d.ts.map +0 -1
  417. package/dist/types/src/common/graph.d.ts +0 -21
  418. package/dist/types/src/common/graph.d.ts.map +0 -1
  419. package/dist/types/src/common/layout.d.ts +0 -279
  420. package/dist/types/src/common/layout.d.ts.map +0 -1
  421. package/dist/types/src/common/surface.d.ts +0 -59
  422. package/dist/types/src/common/surface.d.ts.map +0 -1
  423. package/dist/types/src/components/App.d.ts +0 -10
  424. package/dist/types/src/components/App.d.ts.map +0 -1
  425. package/dist/types/src/components/App.stories.d.ts.map +0 -1
  426. package/dist/types/src/components/DefaultFallback.d.ts +0 -8
  427. package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
  428. package/dist/types/src/components/index.d.ts +0 -2
  429. package/dist/types/src/components/index.d.ts.map +0 -1
  430. package/dist/types/src/components/useApp.d.ts +0 -44
  431. package/dist/types/src/components/useApp.d.ts.map +0 -1
  432. package/dist/types/src/components/useLoading.d.ts.map +0 -1
  433. package/dist/types/src/core/capabilities.d.ts +0 -117
  434. package/dist/types/src/core/capabilities.d.ts.map +0 -1
  435. package/dist/types/src/core/capabilities.test.d.ts +0 -2
  436. package/dist/types/src/core/capabilities.test.d.ts.map +0 -1
  437. package/dist/types/src/core/events.d.ts.map +0 -1
  438. package/dist/types/src/core/manager.d.ts +0 -126
  439. package/dist/types/src/core/manager.d.ts.map +0 -1
  440. package/dist/types/src/core/manager.test.d.ts +0 -2
  441. package/dist/types/src/core/manager.test.d.ts.map +0 -1
  442. package/dist/types/src/playground/debug/Debug.d.ts +0 -6
  443. package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
  444. package/dist/types/src/playground/debug/index.d.ts +0 -2
  445. package/dist/types/src/playground/debug/index.d.ts.map +0 -1
  446. package/dist/types/src/playground/debug/plugin.d.ts +0 -2
  447. package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
  448. package/dist/types/src/playground/generator/Main.d.ts +0 -6
  449. package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
  450. package/dist/types/src/playground/generator/Toolbar.d.ts +0 -6
  451. package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
  452. package/dist/types/src/playground/generator/generator.d.ts +0 -7
  453. package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
  454. package/dist/types/src/playground/generator/index.d.ts +0 -3
  455. package/dist/types/src/playground/generator/index.d.ts.map +0 -1
  456. package/dist/types/src/playground/generator/plugin.d.ts +0 -2
  457. package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
  458. package/dist/types/src/playground/layout/Layout.d.ts +0 -8
  459. package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
  460. package/dist/types/src/playground/layout/index.d.ts +0 -2
  461. package/dist/types/src/playground/layout/index.d.ts.map +0 -1
  462. package/dist/types/src/playground/layout/plugin.d.ts +0 -2
  463. package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
  464. package/dist/types/src/playground/logger/Toolbar.d.ts +0 -6
  465. package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
  466. package/dist/types/src/playground/logger/index.d.ts +0 -2
  467. package/dist/types/src/playground/logger/index.d.ts.map +0 -1
  468. package/dist/types/src/playground/logger/plugin.d.ts +0 -2
  469. package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
  470. package/dist/types/src/playground/logger/schema.d.ts +0 -13
  471. package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
  472. package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
  473. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +0 -2
  474. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +0 -1
  475. package/dist/types/src/plugin-intent/actions.d.ts +0 -36
  476. package/dist/types/src/plugin-intent/actions.d.ts.map +0 -1
  477. package/dist/types/src/plugin-intent/errors.d.ts +0 -16
  478. package/dist/types/src/plugin-intent/errors.d.ts.map +0 -1
  479. package/dist/types/src/plugin-intent/index.d.ts +0 -6
  480. package/dist/types/src/plugin-intent/index.d.ts.map +0 -1
  481. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +0 -139
  482. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +0 -1
  483. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +0 -2
  484. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
  485. package/dist/types/src/plugin-intent/intent.d.ts +0 -63
  486. package/dist/types/src/plugin-intent/intent.d.ts.map +0 -1
  487. package/dist/types/src/plugin-intent/meta.d.ts +0 -3
  488. package/dist/types/src/plugin-intent/meta.d.ts.map +0 -1
  489. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -2
  490. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  491. package/dist/types/src/plugin-settings/actions.d.ts +0 -25
  492. package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
  493. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -4
  494. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
  495. package/dist/types/src/plugin-settings/index.d.ts +0 -3
  496. package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
  497. package/dist/types/src/plugin-settings/intent-resolver.d.ts +0 -4
  498. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +0 -1
  499. package/dist/types/src/plugin-settings/meta.d.ts +0 -3
  500. package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
  501. package/dist/types/src/plugin-settings/store.d.ts +0 -5
  502. package/dist/types/src/plugin-settings/store.d.ts.map +0 -1
  503. package/dist/types/src/plugin-settings/translations.d.ts +0 -11
  504. package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
  505. package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
  506. package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
  507. package/dist/types/src/react/IntentContext.d.ts +0 -8
  508. package/dist/types/src/react/IntentContext.d.ts.map +0 -1
  509. package/dist/types/src/react/PluginManagerProvider.d.ts +0 -10
  510. package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
  511. package/dist/types/src/react/Surface.d.ts +0 -12
  512. package/dist/types/src/react/Surface.d.ts.map +0 -1
  513. package/dist/types/src/react/Surface.stories.d.ts +0 -17
  514. package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
  515. package/dist/types/src/react/common.d.ts +0 -13
  516. package/dist/types/src/react/common.d.ts.map +0 -1
  517. package/dist/types/src/react/index.d.ts +0 -7
  518. package/dist/types/src/react/index.d.ts.map +0 -1
  519. package/dist/types/src/react/useCapabilities.d.ts +0 -13
  520. package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
  521. package/dist/types/src/react/useIntentResolver.d.ts +0 -3
  522. package/dist/types/src/react/useIntentResolver.d.ts.map +0 -1
  523. package/dist/types/src/worker.d.ts +0 -4
  524. package/dist/types/src/worker.d.ts.map +0 -1
  525. package/src/common/collaboration.ts +0 -18
  526. package/src/common/events.ts +0 -79
  527. package/src/common/file.ts +0 -22
  528. package/src/common/graph.ts +0 -30
  529. package/src/common/layout.ts +0 -277
  530. package/src/common/surface.ts +0 -83
  531. package/src/components/App.stories.tsx +0 -33
  532. package/src/components/App.tsx +0 -59
  533. package/src/components/DefaultFallback.tsx +0 -26
  534. package/src/components/useApp.tsx +0 -164
  535. package/src/core/capabilities.test.ts +0 -136
  536. package/src/core/capabilities.ts +0 -259
  537. package/src/core/manager.test.ts +0 -516
  538. package/src/core/manager.ts +0 -604
  539. package/src/playground/debug/Debug.tsx +0 -39
  540. package/src/playground/debug/plugin.ts +0 -16
  541. package/src/playground/generator/Main.tsx +0 -71
  542. package/src/playground/generator/Toolbar.tsx +0 -47
  543. package/src/playground/generator/generator.ts +0 -48
  544. package/src/playground/generator/index.ts +0 -6
  545. package/src/playground/generator/plugin.ts +0 -22
  546. package/src/playground/layout/Layout.tsx +0 -33
  547. package/src/playground/layout/plugin.ts +0 -18
  548. package/src/playground/logger/Toolbar.tsx +0 -30
  549. package/src/playground/logger/plugin.ts +0 -41
  550. package/src/playground/logger/schema.ts +0 -12
  551. package/src/playground/playground.stories.tsx +0 -46
  552. package/src/plugin-intent/IntentPlugin.ts +0 -20
  553. package/src/plugin-intent/actions.ts +0 -31
  554. package/src/plugin-intent/errors.ts +0 -40
  555. package/src/plugin-intent/index.ts +0 -9
  556. package/src/plugin-intent/intent-dispatcher.test.ts +0 -286
  557. package/src/plugin-intent/intent-dispatcher.ts +0 -337
  558. package/src/plugin-intent/intent.ts +0 -154
  559. package/src/plugin-intent/meta.ts +0 -10
  560. package/src/plugin-settings/SettingsPlugin.ts +0 -34
  561. package/src/plugin-settings/actions.ts +0 -25
  562. package/src/plugin-settings/app-graph-builder.ts +0 -160
  563. package/src/plugin-settings/index.ts +0 -6
  564. package/src/plugin-settings/intent-resolver.ts +0 -35
  565. package/src/plugin-settings/meta.ts +0 -10
  566. package/src/plugin-settings/store.ts +0 -33
  567. package/src/plugin-settings/translations.ts +0 -19
  568. package/src/react/ErrorBoundary.tsx +0 -56
  569. package/src/react/IntentContext.tsx +0 -35
  570. package/src/react/Surface.stories.tsx +0 -101
  571. package/src/react/Surface.tsx +0 -86
  572. package/src/react/common.ts +0 -13
  573. package/src/react/index.ts +0 -10
  574. package/src/react/useCapabilities.ts +0 -31
  575. package/src/react/useIntentResolver.ts +0 -22
  576. package/src/worker.ts +0 -11
  577. /package/dist/lib/browser/{intent-dispatcher-Y4LZNOBC.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  578. /package/dist/lib/browser/{worker.mjs.map → common/activation-events.mjs.map} +0 -0
  579. /package/dist/lib/{node-esm/intent-dispatcher-R4CCPBHO.mjs.map → browser/common/capabilities.mjs.map} +0 -0
  580. /package/dist/lib/{node-esm/worker.mjs.map → browser/core/activation-event.mjs.map} +0 -0
@@ -0,0 +1,422 @@
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
+ getInstalledVersion: () => getInstalledVersion,
13
+ getRemoteEntries: () => getRemoteEntries,
14
+ isLocalUrl: () => isLocalUrl,
15
+ make: () => make,
16
+ preload: () => preload,
17
+ setInstalledVersion: () => setInstalledVersion,
18
+ uninstall: () => uninstall
19
+ });
20
+ import * as Effect3 from "effect/Effect";
21
+ import * as Option from "effect/Option";
22
+ import { BaseError as BaseError3 } from "@dxos/errors";
23
+ import { log } from "@dxos/log";
24
+
25
+ // src/core/plugin-asset-cache.ts
26
+ var plugin_asset_cache_exports = {};
27
+ __export(plugin_asset_cache_exports, {
28
+ PluginAssetCacheError: () => PluginAssetCacheError,
29
+ noop: () => noop
30
+ });
31
+ import * as Effect from "effect/Effect";
32
+ import { BaseError } from "@dxos/errors";
33
+ var PluginAssetCacheError = class extends BaseError.extend("PluginAssetCacheError", "Plugin asset cache operation failed") {
34
+ };
35
+ var noop = () => ({
36
+ cache: () => Effect.void,
37
+ evict: () => Effect.void,
38
+ resolve: (_pluginId, url) => Effect.succeed(url),
39
+ list: () => Effect.succeed([])
40
+ });
41
+
42
+ // src/core/plugin-manifest.ts
43
+ var plugin_manifest_exports = {};
44
+ __export(plugin_manifest_exports, {
45
+ Manifest: () => Manifest,
46
+ PLUGIN_DEV_SERVER_PORT: () => PLUGIN_DEV_SERVER_PORT,
47
+ PluginManifestError: () => PluginManifestError,
48
+ fetchManifest: () => fetchManifest,
49
+ parse: () => parse
50
+ });
51
+ import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
52
+ import * as HttpClient from "@effect/platform/HttpClient";
53
+ import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
54
+ import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
55
+ import * as Effect2 from "effect/Effect";
56
+ import * as Schema from "effect/Schema";
57
+ import { BaseError as BaseError2 } from "@dxos/errors";
58
+ import { PLUGIN_ENTRY_FILENAME } from "@dxos/protocols";
59
+ var PLUGIN_DEV_SERVER_PORT = 3967;
60
+ var PluginManifestError = class extends BaseError2.extend("PluginManifestError", "Plugin manifest is invalid") {
61
+ };
62
+ var Manifest = Schema.Struct({
63
+ id: Schema.String,
64
+ name: Schema.String,
65
+ version: Schema.String,
66
+ assets: Schema.Array(Schema.String),
67
+ devEntry: Schema.String.pipe(Schema.optional)
68
+ });
69
+ var resolve = (manifestUrl, manifest) => {
70
+ const dev = manifest.devEntry !== void 0;
71
+ return {
72
+ id: manifest.id,
73
+ name: manifest.name,
74
+ version: manifest.version,
75
+ entryUrl: new URL(dev ? manifest.devEntry : PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),
76
+ assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),
77
+ dev
78
+ };
79
+ };
80
+ var parse = (manifestUrl, payload) => {
81
+ const manifest = Schema.decodeUnknownSync(Manifest)(payload);
82
+ if (manifest.devEntry === void 0 && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
83
+ throw new Error(`Manifest at ${manifestUrl} does not list ${PLUGIN_ENTRY_FILENAME} in assets.`);
84
+ }
85
+ return resolve(manifestUrl, manifest);
86
+ };
87
+ var fetchManifest = (manifestUrl) => Effect2.gen(function* () {
88
+ const response = yield* HttpClientRequest.get(manifestUrl).pipe(HttpClient.execute, Effect2.mapError((cause) => new PluginManifestError({
89
+ context: {
90
+ manifestUrl,
91
+ reason: "fetch-failed"
92
+ },
93
+ cause
94
+ })));
95
+ if (response.status >= 400) {
96
+ return yield* Effect2.fail(new PluginManifestError({
97
+ context: {
98
+ manifestUrl,
99
+ reason: "http-error",
100
+ status: response.status
101
+ }
102
+ }));
103
+ }
104
+ const manifest = yield* HttpClientResponse.schemaBodyJson(Manifest)(response).pipe(Effect2.mapError((cause) => new PluginManifestError({
105
+ context: {
106
+ manifestUrl,
107
+ reason: "parse-failed"
108
+ },
109
+ cause
110
+ })));
111
+ if (manifest.devEntry === void 0 && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
112
+ return yield* Effect2.fail(new PluginManifestError({
113
+ context: {
114
+ manifestUrl,
115
+ reason: "invalid"
116
+ },
117
+ cause: `assets does not include ${PLUGIN_ENTRY_FILENAME}`
118
+ }));
119
+ }
120
+ return resolve(manifestUrl, manifest);
121
+ }).pipe(Effect2.scoped, Effect2.provide(FetchHttpClient.layer));
122
+
123
+ // src/core/url-loader.ts
124
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/url-loader.ts";
125
+ var DEFAULT_KEY = "org.dxos.composer.remote-plugins";
126
+ var RemotePluginLoadError = class extends BaseError3.extend("RemotePluginLoadError", "Failed to load remote plugin") {
127
+ };
128
+ var defaultStorage = () => ({
129
+ get: (key) => localStorage.getItem(key),
130
+ set: (key, value) => localStorage.setItem(key, value)
131
+ });
132
+ var getPersistedRemotePlugins = (storage, key) => {
133
+ try {
134
+ const parsed = JSON.parse(storage.get(key) ?? "[]");
135
+ if (!Array.isArray(parsed)) {
136
+ return [];
137
+ }
138
+ return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.url === "string");
139
+ } catch {
140
+ return [];
141
+ }
142
+ };
143
+ var persistRemotePlugin = (storage, key, entry) => {
144
+ try {
145
+ const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== entry.id);
146
+ entries.push(entry);
147
+ storage.set(key, JSON.stringify(entries));
148
+ } catch (error) {
149
+ log.warn("failed to persist remote plugin entry", {
150
+ entry,
151
+ error
152
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
153
+ }
154
+ };
155
+ var removePersistedRemotePlugin = (storage, key, pluginId) => {
156
+ try {
157
+ const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== pluginId);
158
+ storage.set(key, JSON.stringify(entries));
159
+ } catch (error) {
160
+ log.warn("failed to remove remote plugin entry", {
161
+ pluginId,
162
+ error
163
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 51, S: void 0 });
164
+ }
165
+ };
166
+ var isUrl = (locator) => {
167
+ try {
168
+ const url = new URL(locator);
169
+ return url.protocol === "http:" || url.protocol === "https:";
170
+ } catch {
171
+ return false;
172
+ }
173
+ };
174
+ var isLocalUrl = (locator) => {
175
+ try {
176
+ const hostname = new URL(locator).hostname.toLowerCase();
177
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
178
+ } catch {
179
+ return false;
180
+ }
181
+ };
182
+ var getRemoteEntries = (options = {}) => {
183
+ const storage = options.storage ?? defaultStorage();
184
+ const key = options.key ?? DEFAULT_KEY;
185
+ return getPersistedRemotePlugins(storage, key);
186
+ };
187
+ var setInstalledVersion = (id, version, options = {}) => {
188
+ const storage = options.storage ?? defaultStorage();
189
+ const key = options.key ?? DEFAULT_KEY;
190
+ const entries = getPersistedRemotePlugins(storage, key);
191
+ const index = entries.findIndex((entry) => entry.id === id);
192
+ if (index === -1) {
193
+ return;
194
+ }
195
+ entries[index] = {
196
+ ...entries[index],
197
+ version
198
+ };
199
+ try {
200
+ storage.set(key, JSON.stringify(entries));
201
+ } catch (error) {
202
+ log.warn("failed to update installed version for remote plugin", {
203
+ id,
204
+ version,
205
+ error
206
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 103, S: void 0 });
207
+ }
208
+ };
209
+ var getInstalledVersion = (id, options = {}) => {
210
+ const storage = options.storage ?? defaultStorage();
211
+ const key = options.key ?? DEFAULT_KEY;
212
+ return getPersistedRemotePlugins(storage, key).find((entry) => entry.id === id)?.version;
213
+ };
214
+ var normalizePluginExport = (mod) => {
215
+ const exported = mod.default;
216
+ if (isPlugin(exported)) {
217
+ return exported;
218
+ }
219
+ if (typeof exported === "function") {
220
+ const result = exported();
221
+ if (isPlugin(result)) {
222
+ return result;
223
+ }
224
+ }
225
+ throw new Error("Remote module default export is not a Plugin or a zero-arg plugin factory.");
226
+ };
227
+ var loadStylesheets = (manifest, cache) => Effect3.gen(function* () {
228
+ if (typeof document === "undefined") {
229
+ return;
230
+ }
231
+ const cssUrls = manifest.assetUrls.filter((url) => url.endsWith(".css"));
232
+ for (const url of cssUrls) {
233
+ const resolved = yield* cache.resolve(manifest.id, url);
234
+ if (document.querySelector(`link[data-dxos-plugin-id="${manifest.id}"][href="${resolved}"]`)) {
235
+ continue;
236
+ }
237
+ const link = document.createElement("link");
238
+ link.rel = "stylesheet";
239
+ link.href = resolved;
240
+ link.dataset.dxosPluginId = manifest.id;
241
+ document.head.appendChild(link);
242
+ }
243
+ });
244
+ var loadFromManifest = (manifestUrl, cache) => Effect3.gen(function* () {
245
+ log.info("loading remote plugin", {
246
+ manifestUrl
247
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 152, S: this });
248
+ const manifest = yield* fetchManifest(manifestUrl).pipe(Effect3.mapError((cause) => new RemotePluginLoadError({
249
+ context: {
250
+ locator: manifestUrl,
251
+ reason: "manifest-error"
252
+ },
253
+ cause
254
+ })));
255
+ const wrapCacheError = Effect3.mapError((cause) => new RemotePluginLoadError({
256
+ context: {
257
+ locator: manifestUrl,
258
+ reason: "cache-error"
259
+ },
260
+ cause
261
+ }));
262
+ if (!manifest.dev) {
263
+ const cachedUrls = manifest.assetUrls.indexOf(manifestUrl) === -1 ? [
264
+ manifestUrl,
265
+ ...manifest.assetUrls
266
+ ] : manifest.assetUrls;
267
+ yield* cache.cache(manifest.id, cachedUrls).pipe(wrapCacheError);
268
+ }
269
+ const entryUrl = manifest.dev ? manifest.entryUrl : yield* cache.resolve(manifest.id, manifest.entryUrl).pipe(wrapCacheError);
270
+ const mod = yield* Effect3.tryPromise({
271
+ try: () => import(
272
+ /* @vite-ignore */
273
+ entryUrl
274
+ ),
275
+ catch: (cause) => new RemotePluginLoadError({
276
+ context: {
277
+ locator: manifestUrl,
278
+ reason: "import-failed"
279
+ },
280
+ cause
281
+ })
282
+ });
283
+ const plugin = normalizePluginExport(mod);
284
+ if (!plugin.meta.id || !plugin.meta.name) {
285
+ return yield* Effect3.fail(new RemotePluginLoadError({
286
+ context: {
287
+ locator: manifestUrl,
288
+ reason: "meta-missing"
289
+ }
290
+ }));
291
+ }
292
+ if (plugin.meta.id !== manifest.id) {
293
+ return yield* Effect3.fail(new RemotePluginLoadError({
294
+ context: {
295
+ locator: manifestUrl,
296
+ reason: "meta-mismatch",
297
+ metaId: plugin.meta.id,
298
+ manifestId: manifest.id
299
+ }
300
+ }));
301
+ }
302
+ if (!manifest.dev) {
303
+ yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);
304
+ }
305
+ return {
306
+ plugin,
307
+ manifest
308
+ };
309
+ });
310
+ var preload = (options = {}) => Effect3.gen(function* () {
311
+ const storage = options.storage ?? defaultStorage();
312
+ const key = options.key ?? DEFAULT_KEY;
313
+ const cache = options.cache ?? noop();
314
+ const onPluginLoaded = options.onPluginLoaded;
315
+ const entries = getPersistedRemotePlugins(storage, key);
316
+ if (entries.length === 0) {
317
+ return [];
318
+ }
319
+ log.info("preloading remote plugins", {
320
+ count: entries.length
321
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 240, S: this });
322
+ const total = entries.length;
323
+ let loaded = 0;
324
+ const results = yield* Effect3.all(entries.map((entry) => loadFromManifest(entry.url, cache).pipe(
325
+ Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to preload remote plugin", {
326
+ entry,
327
+ error
328
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 245, S: this }))),
329
+ Effect3.option,
330
+ // Tick the progress hook on both success and recoverable failure so
331
+ // the counter monotonically reaches `total`. The host-supplied
332
+ // callback is best-effort: any synchronous throw flows through
333
+ // `Effect.try` and gets logged + ignored so a buggy hook can't
334
+ // derail the preload.
335
+ Effect3.tap(() => Effect3.sync(() => {
336
+ loaded += 1;
337
+ }).pipe(Effect3.andThen(Effect3.try(() => onPluginLoaded?.(loaded, total))), Effect3.tapError((error) => Effect3.sync(() => log.warn("onPluginLoaded threw", {
338
+ loaded,
339
+ total,
340
+ error
341
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 255, S: this }))), Effect3.ignore))
342
+ )), {
343
+ concurrency: "unbounded"
344
+ });
345
+ return results.flatMap((result) => Option.match(result, {
346
+ onNone: () => [],
347
+ onSome: ({ plugin }) => [
348
+ plugin
349
+ ]
350
+ }));
351
+ });
352
+ var make = (builtinPlugins, options = {}) => {
353
+ const storage = options.storage ?? defaultStorage();
354
+ const key = options.key ?? DEFAULT_KEY;
355
+ const cache = options.cache ?? noop();
356
+ return (locator) => Effect3.gen(function* () {
357
+ const builtin = builtinPlugins.find((plugin2) => plugin2.meta.id === locator);
358
+ if (builtin) {
359
+ return {
360
+ plugin: builtin
361
+ };
362
+ }
363
+ if (!isUrl(locator)) {
364
+ return yield* Effect3.fail(new RemotePluginLoadError({
365
+ context: {
366
+ locator,
367
+ reason: "invalid-locator"
368
+ }
369
+ }));
370
+ }
371
+ const { plugin, manifest } = yield* loadFromManifest(locator, cache);
372
+ if (!manifest.dev) {
373
+ const duplicate = builtinPlugins.find((existing) => existing.meta.id === plugin.meta.id);
374
+ if (duplicate) {
375
+ return yield* Effect3.fail(new RemotePluginLoadError({
376
+ context: {
377
+ locator,
378
+ reason: "duplicate-id",
379
+ id: plugin.meta.id
380
+ }
381
+ }));
382
+ }
383
+ persistRemotePlugin(storage, key, {
384
+ id: plugin.meta.id,
385
+ url: locator
386
+ });
387
+ }
388
+ return {
389
+ plugin,
390
+ dev: manifest.dev
391
+ };
392
+ });
393
+ };
394
+ var uninstall = (pluginId, options = {}) => Effect3.gen(function* () {
395
+ const storage = options.storage ?? defaultStorage();
396
+ const key = options.key ?? DEFAULT_KEY;
397
+ const cache = options.cache ?? noop();
398
+ removePersistedRemotePlugin(storage, key, pluginId);
399
+ if (typeof document !== "undefined") {
400
+ document.querySelectorAll(`link[data-dxos-plugin-id="${pluginId}"]`).forEach((node) => node.remove());
401
+ }
402
+ yield* cache.evict(pluginId).pipe(Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to evict plugin assets", {
403
+ pluginId,
404
+ error
405
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 337, S: this }))), Effect3.ignore);
406
+ });
407
+
408
+ export {
409
+ plugin_asset_cache_exports,
410
+ PLUGIN_DEV_SERVER_PORT,
411
+ plugin_manifest_exports,
412
+ RemotePluginLoadError,
413
+ isLocalUrl,
414
+ getRemoteEntries,
415
+ setInstalledVersion,
416
+ getInstalledVersion,
417
+ preload,
418
+ make,
419
+ uninstall,
420
+ url_loader_exports
421
+ };
422
+ //# sourceMappingURL=chunk-CZ4BIAHH.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 /** Installed version string, e.g. `v1.0.0`. Populated after install from a community catalog entry. */\n version?: string;\n};\n\nconst defaultStorage = (): Storage => ({\n get: (key) => localStorage.getItem(key),\n set: (key, value) => localStorage.setItem(key, value),\n});\n\nconst getPersistedRemotePlugins = (storage: Storage, key: string): 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\n/**\n * Updates the persisted installed version for an already-stored remote plugin entry.\n * Does nothing if the plugin has not been persisted yet.\n */\nexport const setInstalledVersion = (id: string, version: string, options: Options = {}): void => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const entries = getPersistedRemotePlugins(storage, key);\n const index = entries.findIndex((entry) => entry.id === id);\n if (index === -1) {\n return;\n }\n entries[index] = { ...entries[index], version };\n try {\n storage.set(key, JSON.stringify(entries));\n } catch (error) {\n log.warn('failed to update installed version for remote plugin', { id, version, error });\n }\n};\n\n/**\n * Returns the installed version string for the given plugin id, or `undefined` if\n * the plugin was installed without version tracking (legacy install) or is not found.\n */\nexport const getInstalledVersion = (id: string, options: Options = {}): string | undefined => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n return getPersistedRemotePlugins(storage, key).find((entry) => entry.id === id)?.version;\n};\n\nconst normalizePluginExport = (mod: Record<string, unknown>): Plugin.Plugin => {\n const exported = mod.default;\n if (Plugin.isPlugin(exported)) {\n return exported;\n }\n if (typeof exported === 'function') {\n const result = (exported as () => unknown)();\n if (Plugin.isPlugin(result)) {\n return result;\n }\n }\n throw new Error('Remote module default export is not a Plugin or a zero-arg plugin factory.');\n};\n\n/**\n * Loads stylesheets declared in the manifest by appending `<link rel=\"stylesheet\">` elements to the host document.\n * Each link is tagged with `data-dxos-plugin-id` so `uninstall` can clean them up.\n */\nconst loadStylesheets = (\n manifest: PluginManifest.ResolvedManifest,\n cache: PluginAssetCache.Cache,\n): Effect.Effect<void, PluginAssetCache.PluginAssetCacheError> =>\n Effect.gen(function* () {\n if (typeof document === 'undefined') {\n return;\n }\n const cssUrls = manifest.assetUrls.filter((url) => url.endsWith('.css'));\n for (const url of cssUrls) {\n const resolved = yield* cache.resolve(manifest.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 const wrapCacheError = Effect.mapError(\n (cause: PluginAssetCache.PluginAssetCacheError) =>\n new RemotePluginLoadError({ context: { locator: manifestUrl, reason: 'cache-error' }, cause }),\n );\n // Dev-mode manifests (served by `vite dev` via composerPlugin) skip the offline\n // cache: chunks resolve on demand through the dev server, the asset list isn't\n // enumerable up-front, and CSS arrives via runtime <style> injection rather than\n // static <link> tags.\n if (!manifest.dev) {\n // Cache the manifest URL alongside its declared assets. Without it, `preload` on a\n // subsequent reload would fetch the manifest from the network — and fail when the\n // plugin's host is offline, dropping the plugin from the runtime.\n const cachedUrls =\n manifest.assetUrls.indexOf(manifestUrl) === -1 ? [manifestUrl, ...manifest.assetUrls] : manifest.assetUrls;\n yield* cache.cache(manifest.id, cachedUrls).pipe(wrapCacheError);\n }\n const entryUrl = manifest.dev\n ? manifest.entryUrl\n : 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 // In dev mode, Vite injects styles at runtime via the module graph, so static\n // <link> tags would duplicate (or 404, since CSS chunks aren't pre-built).\n if (!manifest.dev) {\n yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);\n }\n return { plugin, manifest };\n });\n\n/**\n * Preloads previously persisted remote plugins from storage. Per-entry failures\n * are logged and swallowed — the returned effect always succeeds with whichever\n * plugins loaded cleanly, so a single bad entry can't block the host's startup.\n */\nexport const preload = (options: PreloadOptions = {}): Effect.Effect<Plugin.Plugin[], never> =>\n Effect.gen(function* () {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const cache = options.cache ?? PluginAssetCache.noop();\n const onPluginLoaded = options.onPluginLoaded;\n\n const entries = getPersistedRemotePlugins(storage, key);\n if (entries.length === 0) {\n return [];\n }\n log.info('preloading remote plugins', { count: entries.length });\n const total = entries.length;\n let loaded = 0;\n const results = yield* Effect.all(\n entries.map((entry) =>\n loadFromManifest(entry.url, cache).pipe(\n Effect.tapError((error) => Effect.sync(() => log.warn('failed to preload remote plugin', { entry, error }))),\n Effect.option,\n // Tick the progress hook on both success and recoverable failure so\n // the counter monotonically reaches `total`. The host-supplied\n // callback is best-effort: any synchronous throw flows through\n // `Effect.try` and gets logged + ignored so a buggy hook can't\n // derail the preload.\n Effect.tap(() =>\n Effect.sync(() => {\n loaded += 1;\n }).pipe(\n Effect.andThen(Effect.try(() => onPluginLoaded?.(loaded, total))),\n Effect.tapError((error) => Effect.sync(() => log.warn('onPluginLoaded threw', { loaded, total, error }))),\n Effect.ignore,\n ),\n ),\n ),\n ),\n { concurrency: 'unbounded' },\n );\n return results.flatMap((result) =>\n Option.match(result, {\n onNone: () => [],\n onSome: ({ plugin }) => [plugin],\n }),\n );\n });\n\n/**\n * Creates a plugin loader that resolves built-in plugins by ID or loads remote plugins from URLs.\n *\n * Remote URLs must point at a plugin manifest (`plugin.json`). The loader fetches the manifest,\n * eagerly persists every declared asset via the configured `PluginAssetCache`, then dynamic-imports\n * the entry module.\n */\nexport const make = (builtinPlugins: Plugin.Plugin[], options: Options = {}) => {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const cache = options.cache ?? PluginAssetCache.noop();\n\n return (locator: string): Effect.Effect<{ plugin: Plugin.Plugin; dev?: boolean }, RemotePluginLoadError> =>\n Effect.gen(function* () {\n const builtin = builtinPlugins.find((plugin) => plugin.meta.id === locator);\n if (builtin) {\n return { plugin: builtin };\n }\n if (!isUrl(locator)) {\n return yield* Effect.fail(new RemotePluginLoadError({ context: { locator, reason: 'invalid-locator' } }));\n }\n const { plugin, manifest } = yield* loadFromManifest(locator, cache);\n // Production manifests can't collide with a builtin id — that would make\n // the registered plugin permanently inaccessible. Dev manifests are\n // allowed to collide because the manager shadow primitive handles the\n // overlap (dev plugin takes the id slot for the session, original is\n // restored on uninstall or page reload).\n if (!manifest.dev) {\n const duplicate = builtinPlugins.find((existing) => existing.meta.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 }\n return { plugin, dev: manifest.dev };\n });\n};\n\n/**\n * Removes a previously installed remote plugin: drops the persisted entry, evicts cached\n * assets, and removes any stylesheet `<link>` tags that {@link loadFromManifest} appended.\n *\n * Cache eviction failures are logged and swallowed — the persisted entry has already been\n * dropped so the user-visible state is consistent regardless of whether the platform\n * cache cooperated.\n */\nexport const uninstall = (pluginId: string, options: Options = {}): Effect.Effect<void, never> =>\n Effect.gen(function* () {\n const storage = options.storage ?? defaultStorage();\n const key = options.key ?? DEFAULT_KEY;\n const cache = options.cache ?? PluginAssetCache.noop();\n\n removePersistedRemotePlugin(storage, key, pluginId);\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`link[data-dxos-plugin-id=\"${pluginId}\"]`).forEach((node) => node.remove());\n }\n yield* cache.evict(pluginId).pipe(\n Effect.tapError((error) => Effect.sync(() => log.warn('failed to evict plugin assets', { pluginId, error }))),\n Effect.ignore,\n );\n });\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { BaseError } from '@dxos/errors';\n\n/**\n * Tagged error for cache operations. Construction sites supply `context.operation`\n * (one of `'cache' | 'evict' | 'resolve' | 'list'`) and `context.pluginId` so\n * downstream handlers can route on the failed call without scanning the message.\n */\nexport class PluginAssetCacheError extends BaseError.extend(\n 'PluginAssetCacheError',\n 'Plugin asset cache operation failed',\n) {}\n\n/**\n * Per-platform offline cache for third-party plugin assets.\n *\n * Implementations live alongside their platform glue (composer-app's\n * `asset-cache/{tauri,service-worker}.ts`); the no-op default is for tests\n * and unsupported environments.\n */\nexport interface Cache {\n /**\n * Persist all listed URLs under the namespace of `pluginId`. Idempotent.\n * The order of `urls` is significant — the first entry is treated as the entry module.\n */\n cache(pluginId: string, urls: readonly string[]): Effect.Effect<void, PluginAssetCacheError>;\n\n /**\n * Drop all assets for a plugin (uninstall).\n */\n evict(pluginId: string): Effect.Effect<void, PluginAssetCacheError>;\n\n /**\n * Resolves a plugin asset URL to a platform-specific cached URL when one is available.\n * Returns the original URL when no cached copy exists or the platform serves cached\n * responses transparently (e.g. service worker fetch interception on web).\n */\n resolve(pluginId: string, url: string): Effect.Effect<string, PluginAssetCacheError>;\n\n /**\n * List currently cached plugin ids (diagnostic).\n */\n list(): Effect.Effect<readonly string[], PluginAssetCacheError>;\n}\n\n/**\n * No-op implementation. Used when no platform cache is registered (tests, unsupported environments).\n * Plugins still load — they just have no offline guarantee.\n */\nexport const noop = (): Cache => ({\n cache: () => Effect.void,\n evict: () => Effect.void,\n resolve: (_pluginId, url) => Effect.succeed(url),\n list: () => Effect.succeed([] as readonly string[]),\n});\n", "//\n// Copyright 2026 DXOS.org\n//\n\nimport * as FetchHttpClient from '@effect/platform/FetchHttpClient';\nimport * as HttpClient from '@effect/platform/HttpClient';\nimport * as HttpClientRequest from '@effect/platform/HttpClientRequest';\nimport * as HttpClientResponse from '@effect/platform/HttpClientResponse';\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { BaseError } from '@dxos/errors';\nimport { PLUGIN_ENTRY_FILENAME } from '@dxos/protocols';\n\n/**\n * Default port the Vite plugin (`composerPlugin`) binds the dev server to.\n *\n * Shared single source of truth — `composerPlugin` reads it as the default\n * port, and the host's \"Load Dev Plugin\" affordance pre-fills the manifest URL\n * with `http://localhost:${PLUGIN_DEV_SERVER_PORT}/manifest.json`. Lives in\n * app-framework rather than `@dxos/protocols` because the constant is a\n * client-side convention (host loader + Vite plugin) rather than a wire-level\n * protocol.\n */\nexport const PLUGIN_DEV_SERVER_PORT = 3967;\n\n/**\n * Tagged error for manifest fetch / parse failures. Construction sites set\n * `context.manifestUrl` and `context.reason` (one of `'fetch-failed' |\n * 'http-error' | 'parse-failed' | 'invalid'`) so handlers can route on the\n * specific failure mode.\n */\nexport class PluginManifestError extends BaseError.extend('PluginManifestError', 'Plugin manifest is invalid') {}\n\n/**\n * Schema for a third-party plugin manifest.\n *\n * Production manifests are published as a sibling of the plugin's entry module\n * ({@link PLUGIN_ENTRY_FILENAME}) and advertise every file the plugin needs at\n * runtime so the host can eagerly cache them for offline use.\n *\n * Dev manifests (served by `vite dev` via {@link composerPlugin}) set `devEntry`\n * to point at the unbundled source entry. The host's loader treats the presence\n * of `devEntry` as the dev-mode signal: it imports the entry directly from the\n * dev server, skips eager asset caching, and skips static stylesheet injection\n * (Vite handles CSS via runtime `<style>` injection during HMR). `assets` is not\n * required to enumerate every file in dev mode — chunks and styles flow through\n * the dev server on demand.\n */\nexport const Manifest = Schema.Struct({\n id: Schema.String,\n name: Schema.String,\n version: Schema.String,\n assets: Schema.Array(Schema.String),\n devEntry: Schema.String.pipe(Schema.optional),\n});\n\nexport type Manifest = Schema.Schema.Type<typeof Manifest>;\n\n/**\n * Resolved manifest with all asset paths converted to absolute URLs.\n *\n * `dev` reflects whether the source manifest declared a `devEntry`. Loaders branch\n * on this to skip offline caching and stylesheet injection — both are no-ops (or\n * actively wrong) when the plugin is being served by a Vite dev server.\n */\nexport type ResolvedManifest = {\n id: string;\n name: string;\n version: string;\n entryUrl: string;\n assetUrls: readonly string[];\n dev: boolean;\n};\n\n/**\n * Resolves a parsed manifest's relative asset paths against the manifest's URL.\n * In dev mode the entry comes from `devEntry`; otherwise it's the canonical\n * {@link PLUGIN_ENTRY_FILENAME} sitting next to the manifest.\n */\nconst resolve = (manifestUrl: string, manifest: Manifest): ResolvedManifest => {\n const dev = manifest.devEntry !== undefined;\n return {\n id: manifest.id,\n name: manifest.name,\n version: manifest.version,\n entryUrl: new URL(dev ? manifest.devEntry! : PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),\n assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),\n dev,\n };\n};\n\n/**\n * Synchronous decode + validate + resolve for an in-memory manifest payload. Used\n * by tests and tooling that have the manifest body already loaded; the runtime\n * path goes through {@link fetchManifest}.\n */\nexport const parse = (manifestUrl: string, payload: unknown): ResolvedManifest => {\n const manifest = Schema.decodeUnknownSync(Manifest)(payload);\n if (manifest.devEntry === undefined && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {\n throw new Error(`Manifest at ${manifestUrl} does not list ${PLUGIN_ENTRY_FILENAME} in assets.`);\n }\n return resolve(manifestUrl, manifest);\n};\n\n/**\n * Fetches and parses a manifest from the given URL via Effect's HTTP client and\n * Schema-driven JSON decoding. All failure modes surface as a single tagged\n * {@link PluginManifestError}; callers route on `error.context.reason`.\n */\nexport const fetchManifest = (manifestUrl: string): Effect.Effect<ResolvedManifest, PluginManifestError> =>\n Effect.gen(function* () {\n const response = yield* HttpClientRequest.get(manifestUrl).pipe(\n HttpClient.execute,\n Effect.mapError((cause) => new PluginManifestError({ context: { manifestUrl, reason: 'fetch-failed' }, cause })),\n );\n if (response.status >= 400) {\n return yield* Effect.fail(\n new PluginManifestError({ context: { manifestUrl, reason: 'http-error', status: response.status } }),\n );\n }\n const manifest = yield* HttpClientResponse.schemaBodyJson(Manifest)(response).pipe(\n Effect.mapError((cause) => new PluginManifestError({ context: { manifestUrl, reason: 'parse-failed' }, cause })),\n );\n if (manifest.devEntry === undefined && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {\n return yield* Effect.fail(\n new PluginManifestError({\n context: { manifestUrl, reason: 'invalid' },\n cause: `assets does not include ${PLUGIN_ENTRY_FILENAME}`,\n }),\n );\n }\n return resolve(manifestUrl, manifest);\n }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer));\n"],
5
+ "mappings": ";;;;;;;;AAAA;;;;;;;;;;;AAIA,YAAYA,aAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,WAAW;;;ACRpB;;;;;AAIA,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAOnB,IAAMC,wBAAN,cAAoCD,UAAUE,OACnD,yBACA,qCAAA,EAAA;AACC;AAsCI,IAAMC,OAAO,OAAc;EAChCC,OAAO,MAAaC;EACpBC,OAAO,MAAaD;EACpBE,SAAS,CAACC,WAAWC,QAAeC,eAAQD,GAAAA;EAC5CE,MAAM,MAAaD,eAAQ,CAAA,CAAE;AAC/B;;;AC3DA;;;;;;;;AAIA,YAAYE,qBAAqB;AACjC,YAAYC,gBAAgB;AAC5B,YAAYC,uBAAuB;AACnC,YAAYC,wBAAwB;AACpC,YAAYC,aAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,6BAA6B;AAY/B,IAAMC,yBAAyB;AAQ/B,IAAMC,sBAAN,cAAkCH,WAAUI,OAAO,uBAAuB,4BAAA,EAAA;AAA+B;AAiBzG,IAAMC,WAAkBC,cAAO;EACpCC,IAAWC;EACXC,MAAaD;EACbE,SAAgBF;EAChBG,QAAeC,aAAaJ,aAAM;EAClCK,UAAiBL,cAAOM,KAAYC,eAAQ;AAC9C,CAAA;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AAAA,sBAAAA;iBAASwB;UAA0B;UAAE,QAAA;QACxG;MACA,CAAA,CAAM;IACN;AACA,UAAA,EAAA,QAAA,SAAA,IAAA,OAAA,iBAAA,SAAA,KAAA;QAME,CAAA,SAAI0B,KAAW;YACb,YAAcN,eACZ,KAAIZ,CAAAA,aAAAA,SAAsB,KAAA,OAAA,OAAA,KAAA,EAAA;qBAAET;sBAAWvB,aAAAA,IAAAA,sBAAAA;mBAASwB;YAAwBnB;YAAmB,QAAA;YAAE,IAAA,OAAA,KAAA;UAEjG;QACA8C,CAAAA,CAAAA;;0BAA6DnD,SAAAA,KAAAA;QAAQ,IAAA,OAAA,KAAA;QACvE,KAAA;MACA,CAAA;;WAAiBoD;MAAkB;MACrC,KAAA,SAAA;IACF;EAEF,CAAA;;AAWI,IAAM/D,YAAcA,CAAAA,UAAOP,UAAAA,CAAAA,MAAAA,YAAAA,aAAAA;AAC3B,QAAM8C,UAAQ3B,QAAQ2B,WAASQ,eAAiBC;AAEhDgB,QAAAA,MAAAA,QAAAA,OAAAA;AACA,QAAI,QAAOtC,QAAAA,SAA0B,KAAA;8BAC1BuC,SAAkB,KAAA,QAAA;AAC7B,MAAA,OAAA,aAAA,aAAA;AACA,aAAaC,iBAAgBb,6BACAE,QAAOY,IAAK,EAAA,QAAUC,CAAAA,SAAK,KAAA,OAAA,CAAA;;eAA6ChE,MAAAA,QAAAA,EAAAA,KAAAA,iBAAAA,CAAAA,UAAAA,aAAAA,MAAAA,IAAAA,KAAAA,iCAAAA;IAAM;IAG1G;;;",
6
+ "names": ["Effect", "Option", "BaseError", "log", "Effect", "BaseError", "PluginAssetCacheError", "extend", "noop", "cache", "void", "evict", "resolve", "_pluginId", "url", "succeed", "list", "FetchHttpClient", "HttpClient", "HttpClientRequest", "HttpClientResponse", "Effect", "Schema", "BaseError", "PLUGIN_ENTRY_FILENAME", "PLUGIN_DEV_SERVER_PORT", "PluginManifestError", "extend", "Manifest", "Struct", "id", "String", "name", "version", "assets", "Array", "devEntry", "pipe", "optional", "resolve", "manifestUrl", "manifest", "dev", "undefined", "entryUrl", "URL", "toString", "assetUrls", "map", "asset", "parse", "payload", "decodeUnknownSync", "includes", "Error", "fetchManifest", "gen", "response", "get", "execute", "mapError", "cause", "context", "reason", "status", "fail", "schemaBodyJson", "scoped", "provide", "layer", "DEFAULT_KEY", "defaultStorage", "BaseError", "value", "localStorage", "getPersistedRemotePlugins", "storage", "key", "get", "parsed", "entries", "error", "log", "entry", "pluginId", "url", "URL", "hostname", "locator", "options", "index", "findIndex", "version", "id", "find", "normalizePluginExport", "mod", "exported", "Plugin", "result", "resolved", "resolve", "manifest", "document", "querySelector", "link", "href", "dataset", "head", "loadFromManifest", "manifestUrl", "context", "reason", "cause", "wrapCacheError", "assetUrls", "cache", "entryUrl", "try", "catch", "RemotePluginLoadError", "plugin", "metaId", "manifestId", "PluginAssetCache", "noop", "onPluginLoaded", "info", "total", "results", "pipe", "andThen", "Effect", "loaded", "flatMap", "onSome", "gen", "builtin", "duplicate", "persistRemotePlugin", "dev", "removePersistedRemotePlugin", "querySelectorAll", "evict", "sync", "warn"]
7
+ }
@@ -0,0 +1,8 @@
1
+ // src/context.ts
2
+ import { createContext } from "@dxos/web-context";
3
+ var PluginManagerContext = createContext("org.dxos.app-framework.plugin-manager");
4
+
5
+ export {
6
+ PluginManagerContext
7
+ };
8
+ //# sourceMappingURL=chunk-FJ4765WW.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/context.ts"],
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,uBAAuBD,cAA2C,uCAAA;",
6
+ "names": ["createContext", "PluginManagerContext"]
7
+ }
@@ -0,0 +1,68 @@
1
+ // src/core/edge-registry-plugin-provider.ts
2
+ import * as Effect from "effect/Effect";
3
+ import { Context } from "@dxos/context";
4
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/edge-registry-plugin-provider.ts";
5
+ var toRegistryPlugin = (entry) => ({
6
+ id: entry.meta.id,
7
+ name: entry.meta.name,
8
+ description: entry.meta.description,
9
+ homePage: entry.meta.homePage,
10
+ source: entry.meta.source,
11
+ screenshots: entry.meta.screenshots ? [
12
+ ...entry.meta.screenshots
13
+ ] : void 0,
14
+ tags: entry.meta.tags ? [
15
+ ...entry.meta.tags
16
+ ] : void 0,
17
+ icon: entry.meta.icon,
18
+ iconHue: entry.meta.iconHue,
19
+ moduleUrl: entry.moduleUrl,
20
+ repo: entry.repo,
21
+ version: entry.releaseTag
22
+ });
23
+ var EdgeRegistryPluginProvider = class {
24
+ _client;
25
+ // Cached on first load so getPlugin/listVersions can resolve without re-fetching.
26
+ #cachedPlugins = [];
27
+ constructor(_client) {
28
+ this._client = _client;
29
+ }
30
+ listPlugins() {
31
+ return Effect.tryPromise({
32
+ try: () => this._client.getRegistryPlugins(Context.default(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 56 })),
33
+ catch: (error) => error instanceof Error ? error : new Error(String(error))
34
+ }).pipe(Effect.map((body) => {
35
+ const plugins = body.plugins.filter((entry) => entry.health === "ok").map(toRegistryPlugin);
36
+ this.#cachedPlugins = plugins;
37
+ return plugins;
38
+ }));
39
+ }
40
+ listVersions(repo) {
41
+ const plugin = this.#cachedPlugins.find((candidate) => candidate.repo === repo);
42
+ if (!plugin) {
43
+ return Effect.fail(new Error(`Plugin not found in catalog: ${repo}`));
44
+ }
45
+ const version = {
46
+ tag: plugin.version,
47
+ moduleUrl: plugin.moduleUrl
48
+ };
49
+ return Effect.succeed([
50
+ version
51
+ ]);
52
+ }
53
+ getPlugin(repo, version) {
54
+ const plugin = this.#cachedPlugins.find((p) => p.repo === repo);
55
+ if (!plugin) {
56
+ return Effect.fail(new Error(`Plugin not found in catalog: ${repo}`));
57
+ }
58
+ if (version && version !== plugin.version) {
59
+ return Effect.fail(new Error(`Version ${version} not available for ${repo}; only ${plugin.version} is cached`));
60
+ }
61
+ return Effect.succeed(plugin);
62
+ }
63
+ };
64
+
65
+ export {
66
+ EdgeRegistryPluginProvider
67
+ };
68
+ //# sourceMappingURL=chunk-FO3IYSLV.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/edge-registry-plugin-provider.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Context } from '@dxos/context';\nimport { type EdgeHttpClient } from '@dxos/edge-client';\nimport { type PluginEntry } from '@dxos/protocols';\n\nimport * as Registry from './registry';\n\n/**\n * Maps a wire-format `PluginEntry` (from `@dxos/protocols`) to a\n * `Registry.Plugin` (the app-framework domain type).\n *\n * This is the only translation seam between the two independently-defined type\n * hierarchies — fields are mapped explicitly, with no shared type between them.\n */\nconst toRegistryPlugin = (entry: PluginEntry): Registry.Plugin => ({\n id: entry.meta.id,\n name: entry.meta.name,\n description: entry.meta.description,\n homePage: entry.meta.homePage,\n source: entry.meta.source,\n screenshots: entry.meta.screenshots ? [...entry.meta.screenshots] : undefined,\n tags: entry.meta.tags ? [...entry.meta.tags] : undefined,\n icon: entry.meta.icon,\n iconHue: entry.meta.iconHue,\n moduleUrl: entry.moduleUrl,\n repo: entry.repo,\n version: entry.releaseTag,\n});\n\n/**\n * Implements `Registry.PluginProvider` against the Edge `/registry` HTTP endpoints.\n *\n * Lives in app-framework (rather than the more obvious home of `@dxos/edge-client`)\n * because edge-client doesn't depend on app-framework; siting the implementation\n * here keeps the dependency arrow `app-framework → edge-client` and avoids a\n * cycle. The class needs only the public `EdgeHttpClient` type, so a one-way\n * type-import is enough.\n *\n * `listVersions` is currently a stub: it returns the single latest version derived\n * from the cached plugin list, so the host's version picker has something to render.\n * The wire contract for the real endpoint already exists — see\n * `GetPluginVersionsResponseBodySchema` in `@dxos/protocols/edge/registry` and\n * {@link EdgeHttpClient.getRegistryPluginVersions} — so once Edge ships\n * `GET /registry/plugins/:repo/versions`, swap this stub for a call to\n * `this._client.getRegistryPluginVersions(...)` and map each entry through a\n * `toRegistryPluginVersion` helper (mirror of {@link toRegistryPlugin}).\n */\nexport class EdgeRegistryPluginProvider implements Registry.PluginProvider {\n // Cached on first load so getPlugin/listVersions can resolve without re-fetching.\n #cachedPlugins: readonly Registry.Plugin[] = [];\n\n constructor(private readonly _client: EdgeHttpClient) {}\n\n listPlugins(): Effect.Effect<readonly Registry.Plugin[], Error> {\n return Effect.tryPromise({\n try: () => this._client.getRegistryPlugins(Context.default()),\n catch: (error) => (error instanceof Error ? error : new Error(String(error))),\n }).pipe(\n Effect.map((body) => {\n const plugins = body.plugins.filter((entry) => entry.health === 'ok').map(toRegistryPlugin);\n this.#cachedPlugins = plugins;\n return plugins;\n }),\n );\n }\n\n listVersions(repo: string): Effect.Effect<readonly Registry.PluginVersion[], Error> {\n // Stub: return only the currently-known version until Edge implements the versions endpoint.\n const plugin = this.#cachedPlugins.find((candidate) => candidate.repo === repo);\n if (!plugin) {\n return Effect.fail(new Error(`Plugin not found in catalog: ${repo}`));\n }\n const version: Registry.PluginVersion = { tag: plugin.version, moduleUrl: plugin.moduleUrl };\n return Effect.succeed([version]);\n }\n\n getPlugin(repo: string, version?: string): Effect.Effect<Registry.Plugin, Error> {\n const plugin = this.#cachedPlugins.find((p) => p.repo === repo);\n if (!plugin) {\n return Effect.fail(new Error(`Plugin not found in catalog: ${repo}`));\n }\n if (version && version !== plugin.version) {\n return Effect.fail(new Error(`Version ${version} not available for ${repo}; only ${plugin.version} is cached`));\n }\n return Effect.succeed(plugin);\n }\n}\n"],
5
+ "mappings": ";AAIA,YAAYA,YAAY;AAExB,SAASC,eAAe;AAMxB,IAAA,eAAA;IASEC,mBAAqB,CAAA,WAAA;EACrBC,IAAAA,MAAAA,KAAaC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aAAWA,YAAAA,IAAYY,MAAAA,gCAAgB,IAAA,EAAA,CAAA;;AAE3C,QAAA,WAAA,YAAA,OAAA,SAAA;AACA,aAAcE,YAAQF,IAAAA,MAAAA,WAAAA,OAAAA,sBAAAA,IAAAA,UAAAA,OAAAA,OAAAA,YAAAA,CAAAA;IACxB;AACF,WAAA,eAAA,MAAA;;;",
6
+ "names": ["Effect", "Context", "name", "description", "entry", "homePage", "meta", "source", "screenshots", "undefined", "tags", "icon", "iconHue", "moduleUrl", "repo", "version", "releaseTag", "_client", "listPlugins", "error", "pipe", "body", "plugins", "filter", "health", "toRegistryPlugin", "listVersions", "plugin", "fail", "succeed", "getPlugin"]
7
+ }
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
10
+ //# sourceMappingURL=chunk-J5LGTIGS.mjs.map