@dxos/app-framework 0.8.4-main.c85a9c8dae → 0.8.4-main.d05539e30a

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 (387) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/{capability-7RLVE42K.mjs → capability-K5XIVCQU.mjs} +12 -11
  4. package/dist/lib/browser/capability-K5XIVCQU.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-5AHASNDW.mjs +95 -0
  6. package/dist/lib/browser/chunk-5AHASNDW.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-5GY3YOEL.mjs +28 -0
  8. package/dist/lib/browser/chunk-5GY3YOEL.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-66IXTIVK.mjs} +3 -2
  10. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-ZRWBPIZG.mjs → chunk-BRK6GYNB.mjs} +14 -42
  12. package/dist/lib/browser/chunk-BRK6GYNB.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
  14. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-FJ4765WW.mjs.map} +3 -3
  15. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  16. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-YNFPIQGB.mjs → chunk-IW44C7UL.mjs} +9 -2
  18. package/dist/lib/browser/chunk-IW44C7UL.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-5RJNZV7K.mjs → chunk-KFDF7KR3.mjs} +11 -13
  20. package/dist/lib/browser/{chunk-5RJNZV7K.mjs.map → chunk-KFDF7KR3.mjs.map} +3 -3
  21. package/dist/lib/browser/chunk-KLHQNYJ2.mjs +422 -0
  22. package/dist/lib/browser/chunk-KLHQNYJ2.mjs.map +7 -0
  23. package/dist/lib/browser/chunk-QLML5QFJ.mjs +581 -0
  24. package/dist/lib/browser/chunk-QLML5QFJ.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-FNKT2QQ2.mjs → chunk-SLX73WRZ.mjs} +90 -17
  26. package/dist/lib/browser/chunk-SLX73WRZ.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-UVTGHZQF.mjs +513 -0
  28. package/dist/lib/browser/chunk-UVTGHZQF.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-VJ5PFAWC.mjs +1446 -0
  30. package/dist/lib/browser/chunk-VJ5PFAWC.mjs.map +7 -0
  31. package/dist/lib/browser/cli/index.mjs +17 -32
  32. package/dist/lib/browser/cli/index.mjs.map +3 -3
  33. package/dist/lib/browser/common/activation-events.mjs +11 -14
  34. package/dist/lib/browser/common/capabilities.mjs +19 -8
  35. package/dist/lib/browser/core/activation-event.mjs +1 -1
  36. package/dist/lib/browser/core/capability.mjs +5 -1
  37. package/dist/lib/browser/core/plugin-manager.mjs +8 -4
  38. package/dist/lib/browser/core/plugin.mjs +16 -4
  39. package/dist/lib/browser/core/url-loader.mjs +24 -0
  40. package/dist/lib/browser/index.mjs +47 -49
  41. package/dist/lib/browser/index.mjs.map +4 -4
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs +89 -0
  44. package/dist/lib/browser/process-manager-capability-JIWLN7SU.mjs.map +7 -0
  45. package/dist/lib/browser/testing/index.mjs +199 -56
  46. package/dist/lib/browser/testing/index.mjs.map +4 -4
  47. package/dist/lib/browser/testing/react.mjs +78 -0
  48. package/dist/lib/browser/testing/react.mjs.map +7 -0
  49. package/dist/lib/browser/ui/index.mjs +24 -15
  50. package/dist/lib/node-esm/{capability-EVZK4REM.mjs → capability-RLKFFLTB.mjs} +12 -11
  51. package/dist/lib/node-esm/capability-RLKFFLTB.mjs.map +7 -0
  52. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-37Z53PXZ.mjs} +2 -2
  53. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-37Z53PXZ.mjs.map} +3 -3
  54. package/dist/lib/node-esm/chunk-42UNAKYO.mjs +423 -0
  55. package/dist/lib/node-esm/chunk-42UNAKYO.mjs.map +7 -0
  56. package/dist/lib/node-esm/{chunk-CJCQS2YL.mjs → chunk-6S45OMUP.mjs} +90 -17
  57. package/dist/lib/node-esm/chunk-6S45OMUP.mjs.map +7 -0
  58. package/dist/lib/node-esm/{chunk-2A4PRBIX.mjs → chunk-BYHYYJZH.mjs} +14 -42
  59. package/dist/lib/node-esm/chunk-BYHYYJZH.mjs.map +7 -0
  60. package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-CTKEZHKF.mjs} +9 -2
  61. package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-JNT72ZCN.mjs +514 -0
  63. package/dist/lib/node-esm/chunk-JNT72ZCN.mjs.map +7 -0
  64. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs +29 -0
  65. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +7 -0
  66. package/dist/lib/node-esm/chunk-LJNUFNDO.mjs +582 -0
  67. package/dist/lib/node-esm/chunk-LJNUFNDO.mjs.map +7 -0
  68. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs → chunk-OUEMWPIW.mjs} +11 -13
  69. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs.map → chunk-OUEMWPIW.mjs.map} +3 -3
  70. package/dist/lib/node-esm/chunk-PW2VYGOS.mjs +96 -0
  71. package/dist/lib/node-esm/chunk-PW2VYGOS.mjs.map +7 -0
  72. package/dist/lib/node-esm/chunk-SFYCO3PT.mjs +1447 -0
  73. package/dist/lib/node-esm/chunk-SFYCO3PT.mjs.map +7 -0
  74. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  75. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  76. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-XOCUANHO.mjs} +3 -2
  77. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
  78. package/dist/lib/node-esm/cli/index.mjs +17 -32
  79. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  80. package/dist/lib/node-esm/common/activation-events.mjs +11 -14
  81. package/dist/lib/node-esm/common/capabilities.mjs +19 -8
  82. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  83. package/dist/lib/node-esm/core/capability.mjs +5 -1
  84. package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
  85. package/dist/lib/node-esm/core/plugin.mjs +16 -4
  86. package/dist/lib/node-esm/core/url-loader.mjs +25 -0
  87. package/dist/lib/node-esm/index.mjs +47 -49
  88. package/dist/lib/node-esm/index.mjs.map +4 -4
  89. package/dist/lib/node-esm/meta.json +1 -1
  90. package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs +90 -0
  91. package/dist/lib/node-esm/process-manager-capability-PHKLO2BL.mjs.map +7 -0
  92. package/dist/lib/node-esm/testing/index.mjs +199 -56
  93. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  94. package/dist/lib/node-esm/testing/react.mjs +79 -0
  95. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  96. package/dist/lib/node-esm/ui/index.mjs +24 -15
  97. package/dist/plugin/node-esm/index.mjs +893 -0
  98. package/dist/plugin/node-esm/index.mjs.map +7 -0
  99. package/dist/plugin/node-esm/meta.json +1 -0
  100. package/dist/types/src/cli/cli.d.ts +1 -3
  101. package/dist/types/src/cli/cli.d.ts.map +1 -1
  102. package/dist/types/src/common/activation-events.d.ts +10 -13
  103. package/dist/types/src/common/activation-events.d.ts.map +1 -1
  104. package/dist/types/src/common/annotations.d.ts +1 -0
  105. package/dist/types/src/common/annotations.d.ts.map +1 -0
  106. package/dist/types/src/common/capabilities.d.ts +113 -12
  107. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  108. package/dist/types/src/common/operations.d.ts +8 -22
  109. package/dist/types/src/common/operations.d.ts.map +1 -1
  110. package/dist/types/src/core/activation-event.d.ts +5 -5
  111. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  112. package/dist/types/src/core/capability-manager.d.ts +5 -0
  113. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  114. package/dist/types/src/core/capability.d.ts +13 -2
  115. package/dist/types/src/core/capability.d.ts.map +1 -1
  116. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  117. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  118. package/dist/types/src/core/index.d.ts +6 -0
  119. package/dist/types/src/core/index.d.ts.map +1 -1
  120. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  121. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  122. package/dist/types/src/core/plugin-manager.d.ts +238 -7
  123. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  124. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  125. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  126. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  127. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  128. package/dist/types/src/core/plugin.d.ts +182 -7
  129. package/dist/types/src/core/plugin.d.ts.map +1 -1
  130. package/dist/types/src/core/registry.d.ts +107 -0
  131. package/dist/types/src/core/registry.d.ts.map +1 -0
  132. package/dist/types/src/core/url-loader.d.ts +127 -0
  133. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  134. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  135. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  136. package/dist/types/src/helpers.d.ts.map +1 -1
  137. package/dist/types/src/index.d.ts +1 -2
  138. package/dist/types/src/index.d.ts.map +1 -1
  139. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts +3 -0
  140. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts.map +1 -0
  141. package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -0
  142. package/dist/types/src/plugin-process-manager/history/errors.d.ts +32 -0
  143. package/dist/types/src/plugin-process-manager/history/errors.d.ts.map +1 -0
  144. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.d.ts +1 -1
  145. package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts.map +1 -0
  146. package/dist/types/src/plugin-process-manager/history/history-tracker.test.d.ts.map +1 -0
  147. package/dist/types/src/plugin-process-manager/history/index.d.ts.map +1 -0
  148. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/types.d.ts +1 -1
  149. package/dist/types/src/plugin-process-manager/history/types.d.ts.map +1 -0
  150. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.d.ts +1 -1
  151. package/dist/types/src/plugin-process-manager/history/undo-mapping.d.ts.map +1 -0
  152. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.d.ts +1 -1
  153. package/dist/types/src/plugin-process-manager/history/undo-registry.d.ts.map +1 -0
  154. package/dist/types/src/plugin-process-manager/history/undo-registry.test.d.ts.map +1 -0
  155. package/dist/types/src/plugin-process-manager/index.d.ts +3 -0
  156. package/dist/types/src/plugin-process-manager/index.d.ts.map +1 -0
  157. package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -0
  158. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +8 -0
  159. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -0
  160. package/dist/types/src/plugin-process-manager/testing.d.ts +59 -0
  161. package/dist/types/src/plugin-process-manager/testing.d.ts.map +1 -0
  162. package/dist/types/src/testing/harness.d.ts +79 -0
  163. package/dist/types/src/testing/harness.d.ts.map +1 -0
  164. package/dist/types/src/testing/index.d.ts +1 -0
  165. package/dist/types/src/testing/index.d.ts.map +1 -1
  166. package/dist/types/src/testing/react.d.ts +27 -0
  167. package/dist/types/src/testing/react.d.ts.map +1 -0
  168. package/dist/types/src/testing/react.test.d.ts +2 -0
  169. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  170. package/dist/types/src/testing/service.d.ts.map +1 -1
  171. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  172. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  173. package/dist/types/src/ui/components/App/App.d.ts +3 -2
  174. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  175. package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
  176. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  177. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  178. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  179. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  180. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  181. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  182. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  183. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  184. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  185. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  186. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  187. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -1
  188. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  189. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  190. package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
  191. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  192. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  193. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  194. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  195. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  196. package/dist/types/src/ui/components/index.d.ts +1 -0
  197. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  198. package/dist/types/src/ui/hooks/index.d.ts +1 -1
  199. package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
  200. package/dist/types/src/ui/hooks/useApp.d.ts +47 -11
  201. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  202. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  203. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  204. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  205. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  206. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts +24 -0
  207. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts.map +1 -0
  208. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  209. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
  210. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
  211. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
  212. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  213. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
  214. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
  215. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  216. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  217. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  218. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  219. package/dist/types/src/vite-plugin/index.d.ts +5 -0
  220. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  221. package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
  222. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  223. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  224. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  225. package/dist/types/src/vite-plugin/packages.d.ts +13 -0
  226. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  227. package/dist/types/tsconfig.tsbuildinfo +1 -1
  228. package/moon.yml +15 -0
  229. package/package.json +53 -54
  230. package/src/cli/cli.ts +4 -9
  231. package/src/common/activation-events.ts +12 -17
  232. package/src/common/annotations.ts +3 -0
  233. package/src/common/capabilities.ts +160 -29
  234. package/src/common/operations.ts +7 -10
  235. package/src/context.ts +1 -1
  236. package/src/core/activation-event.ts +5 -2
  237. package/src/core/capability-manager.test.ts +1 -1
  238. package/src/core/capability-manager.ts +22 -1
  239. package/src/core/capability.ts +20 -2
  240. package/src/core/edge-registry-plugin-provider.ts +92 -0
  241. package/src/core/index.ts +6 -0
  242. package/src/core/plugin-asset-cache.ts +60 -0
  243. package/src/core/plugin-manager.test.ts +1085 -31
  244. package/src/core/plugin-manager.ts +1170 -198
  245. package/src/core/plugin-manifest.test.ts +75 -0
  246. package/src/core/plugin-manifest.ts +134 -0
  247. package/src/core/plugin.ts +194 -12
  248. package/src/core/registry.ts +163 -0
  249. package/src/core/url-loader.test.ts +221 -0
  250. package/src/core/url-loader.ts +388 -0
  251. package/src/index.ts +1 -2
  252. package/src/plugin-process-manager/ProcessManagerPlugin.ts +24 -0
  253. package/src/{plugin-operation → plugin-process-manager}/history/capability.ts +1 -2
  254. package/src/plugin-process-manager/history/errors.ts +7 -0
  255. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.ts +37 -43
  256. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.ts +1 -2
  257. package/src/{plugin-operation → plugin-process-manager}/history/types.ts +1 -1
  258. package/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.ts +1 -1
  259. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.ts +3 -4
  260. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.ts +1 -1
  261. package/src/{plugin-operation → plugin-process-manager}/index.ts +1 -1
  262. package/src/plugin-process-manager/meta.ts +14 -0
  263. package/src/plugin-process-manager/process-manager-capability.ts +178 -0
  264. package/src/{plugin-operation → plugin-process-manager}/testing.ts +26 -45
  265. package/src/testing/harness.ts +247 -0
  266. package/src/testing/index.ts +1 -0
  267. package/src/testing/react.test.tsx +48 -0
  268. package/src/testing/react.tsx +113 -0
  269. package/src/testing/service.ts +4 -4
  270. package/src/testing/withPluginManager.stories.tsx +1 -2
  271. package/src/testing/withPluginManager.tsx +45 -20
  272. package/src/ui/components/App/App.stories.tsx +7 -13
  273. package/src/ui/components/App/App.tsx +29 -5
  274. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  275. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  276. package/src/{plugin-runtime → ui/components/Placeholder}/index.ts +1 -1
  277. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +8 -7
  278. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +16 -15
  279. package/src/ui/components/Surface/SurfaceComponent.tsx +111 -55
  280. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
  281. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  282. package/src/ui/components/Surface/index.ts +35 -1
  283. package/src/ui/components/Surface/types.test.ts +126 -0
  284. package/src/ui/components/Surface/types.ts +164 -12
  285. package/src/ui/components/index.ts +1 -0
  286. package/src/ui/hooks/index.ts +1 -1
  287. package/src/ui/hooks/useApp.test.tsx +159 -0
  288. package/src/ui/hooks/useApp.tsx +229 -24
  289. package/src/ui/hooks/useLoading.tsx +14 -6
  290. package/src/ui/hooks/useProcessManagerRuntime.ts +68 -0
  291. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +270 -0
  292. package/src/vite-plugin/boot-loader/boot-loader.css +320 -0
  293. package/src/vite-plugin/boot-loader/boot-loader.js +325 -0
  294. package/src/vite-plugin/boot-loader/index.ts +5 -0
  295. package/src/vite-plugin/boot-loader/loader.ts +123 -0
  296. package/src/vite-plugin/composer/index.ts +306 -0
  297. package/src/vite-plugin/import-map/index.ts +527 -0
  298. package/src/vite-plugin/index.ts +10 -0
  299. package/src/vite-plugin/manifest.test.ts +46 -0
  300. package/src/vite-plugin/manifest.ts +57 -0
  301. package/src/vite-plugin/packages.ts +187 -0
  302. package/tsconfig.json +25 -1
  303. package/tsconfig.node.json +1 -1
  304. package/vitest.config.ts +1 -1
  305. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  306. package/dist/lib/browser/capability-2GL5JAGJ.mjs +0 -37
  307. package/dist/lib/browser/capability-2GL5JAGJ.mjs.map +0 -7
  308. package/dist/lib/browser/capability-7RLVE42K.mjs.map +0 -7
  309. package/dist/lib/browser/chunk-4CTRO67U.mjs +0 -703
  310. package/dist/lib/browser/chunk-4CTRO67U.mjs.map +0 -7
  311. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  312. package/dist/lib/browser/chunk-FNKT2QQ2.mjs.map +0 -7
  313. package/dist/lib/browser/chunk-HE27PNNQ.mjs +0 -824
  314. package/dist/lib/browser/chunk-HE27PNNQ.mjs.map +0 -7
  315. package/dist/lib/browser/chunk-NPUEVX42.mjs +0 -34
  316. package/dist/lib/browser/chunk-NPUEVX42.mjs.map +0 -7
  317. package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
  318. package/dist/lib/browser/chunk-REORGDJT.mjs +0 -80
  319. package/dist/lib/browser/chunk-REORGDJT.mjs.map +0 -7
  320. package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
  321. package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
  322. package/dist/lib/browser/chunk-ZRWBPIZG.mjs.map +0 -7
  323. package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs +0 -36
  324. package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs.map +0 -7
  325. package/dist/lib/node-esm/capability-CHIMU6LX.mjs +0 -38
  326. package/dist/lib/node-esm/capability-CHIMU6LX.mjs.map +0 -7
  327. package/dist/lib/node-esm/capability-EVZK4REM.mjs.map +0 -7
  328. package/dist/lib/node-esm/chunk-2A4PRBIX.mjs.map +0 -7
  329. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs +0 -704
  330. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs.map +0 -7
  331. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
  332. package/dist/lib/node-esm/chunk-CJCQS2YL.mjs.map +0 -7
  333. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs +0 -825
  334. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs.map +0 -7
  335. package/dist/lib/node-esm/chunk-JAZVHID3.mjs +0 -35
  336. package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +0 -7
  337. package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
  338. package/dist/lib/node-esm/chunk-UFW652GS.mjs +0 -81
  339. package/dist/lib/node-esm/chunk-UFW652GS.mjs.map +0 -7
  340. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
  341. package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs +0 -37
  342. package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs.map +0 -7
  343. package/dist/types/src/plugin-operation/OperationPlugin.d.ts +0 -3
  344. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +0 -1
  345. package/dist/types/src/plugin-operation/history/capability.d.ts.map +0 -1
  346. package/dist/types/src/plugin-operation/history/errors.d.ts +0 -5
  347. package/dist/types/src/plugin-operation/history/errors.d.ts.map +0 -1
  348. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +0 -1
  349. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +0 -1
  350. package/dist/types/src/plugin-operation/history/index.d.ts.map +0 -1
  351. package/dist/types/src/plugin-operation/history/types.d.ts.map +0 -1
  352. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +0 -1
  353. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +0 -1
  354. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +0 -1
  355. package/dist/types/src/plugin-operation/index.d.ts +0 -3
  356. package/dist/types/src/plugin-operation/index.d.ts.map +0 -1
  357. package/dist/types/src/plugin-operation/invoker-capability.d.ts +0 -6
  358. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +0 -1
  359. package/dist/types/src/plugin-operation/meta.d.ts.map +0 -1
  360. package/dist/types/src/plugin-operation/testing.d.ts +0 -109
  361. package/dist/types/src/plugin-operation/testing.d.ts.map +0 -1
  362. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +0 -3
  363. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +0 -1
  364. package/dist/types/src/plugin-runtime/capability.d.ts +0 -6
  365. package/dist/types/src/plugin-runtime/capability.d.ts.map +0 -1
  366. package/dist/types/src/plugin-runtime/index.d.ts +0 -2
  367. package/dist/types/src/plugin-runtime/index.d.ts.map +0 -1
  368. package/dist/types/src/plugin-runtime/meta.d.ts +0 -3
  369. package/dist/types/src/plugin-runtime/meta.d.ts.map +0 -1
  370. package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
  371. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
  372. package/src/plugin-operation/OperationPlugin.ts +0 -25
  373. package/src/plugin-operation/history/errors.ts +0 -11
  374. package/src/plugin-operation/invoker-capability.ts +0 -40
  375. package/src/plugin-operation/meta.ts +0 -11
  376. package/src/plugin-runtime/RuntimePlugin.ts +0 -20
  377. package/src/plugin-runtime/capability.ts +0 -53
  378. package/src/plugin-runtime/meta.ts +0 -11
  379. package/src/ui/hooks/useOperationResolver.ts +0 -40
  380. /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
  381. /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
  382. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/capability.d.ts +0 -0
  383. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.d.ts +0 -0
  384. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/index.d.ts +0 -0
  385. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.d.ts +0 -0
  386. /package/dist/types/src/{plugin-operation → plugin-process-manager}/meta.d.ts +0 -0
  387. /package/src/{plugin-operation → plugin-process-manager}/history/index.ts +0 -0
@@ -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;EACbC,MAAAA,MAAUD,KAAME;EAChBC,aAAQH,MAAWG,KAAAA;EACnBC,UAAAA,MAAaJ,KAAME;UAAuBF,MAAME,KAAKE;eAAeC,MAAAA,KAAAA,cAAAA;IACpEC,GAAMN,MAAME,KAAKI;;QAA8BD,MAAAA,KAAAA,OAAAA;IAC/CE,GAAMP,MAAME,KAAKK;EACjBC,IAAAA;EACAC,MAAAA,MAAWT,KAAMS;EACjBC,SAAMV,MAAMU,KAAI;EAChBC,WAASX,MAAMY;EACjB,MAAA,MAAA;EAEA,SAAA,MAAA;;AAmBE,IAAA,6BAAA,MAAA;EACA;;mBAE6BC,CAAAA;EAA0B,YAAA,SAAA;AAEvDC,SAAAA,UAAgE;;gBAEvD;WACGC,kBAAWA;MAClBC,KACDpB,MAAAA,KAAU,QAAEqB,mBAAAA,QAAAA,QAAAA,QAAAA,EAAAA,YAAAA,YAAAA,GAAAA,cAAAA,GAAAA,GAAAA,CAAAA,CAAAA;MACV,OAAMC,CAAAA,UAAUD,iBAAaE,QAAQnB,QAAUA,IAAMoB,MAAM,OAAK,KAAS,CAACC;YACrE,WAAA,CAAA,SAAiBH;AACtB,YAAA,UAAOA,KAAAA,QAAAA,OAAAA,CAAAA,UAAAA,MAAAA,WAAAA,IAAAA,EAAAA,IAAAA,gBAAAA;AACT,WAAA,iBAAA;AAEJ,aAAA;IAEAI,CAAAA,CAAAA;;eAEQC,MAAS;UAEb,SAAO3B,KAAO4B,eAAgB,KAAA,CAAA,cAAA,UAA6B,SAAQ,IAAA;AACrE,QAAA,CAAA,QAAA;AACA,aAAwC,YAAA,IAAA,MAAA,gCAAA,IAAA,EAAA,CAAA;;UAAuBf,UAAWc;MAAiB,KAAA,OAAA;MAC3F,WAAcE,OAAQ;;WAAS,eAAA;MACjC;IAEAC,CAAAA;;YAEOH,MAAAA,SAAQ;UACX,SAAO3B,KAAO4B,eAAgB,KAAA,CAAA,MAAA,EAAA,SAAA,IAAA;AAChC,QAAA,CAAA,QAAA;AACIb,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
+ }
@@ -7,7 +7,9 @@ var capability_exports = {};
7
7
  __export(capability_exports, {
8
8
  ModuleTag: () => ModuleTag,
9
9
  Service: () => Service,
10
+ asLayer: () => asLayer,
10
11
  atom: () => atom,
12
+ atomByModule: () => atomByModule,
11
13
  contributes: () => contributes,
12
14
  get: () => get,
13
15
  getAll: () => getAll,
@@ -19,6 +21,7 @@ __export(capability_exports, {
19
21
  });
20
22
  import * as Context from "effect/Context";
21
23
  import * as Effect from "effect/Effect";
24
+ import * as Layer from "effect/Layer";
22
25
  var Service = class extends Context.Tag("@dxos/app-framework/CapabilityManager")() {
23
26
  };
24
27
  var get = (interfaceDef) => Effect.flatMap(Service, (manager) => Effect.try({
@@ -28,6 +31,8 @@ var get = (interfaceDef) => Effect.flatMap(Service, (manager) => Effect.try({
28
31
  var getAll = (interfaceDef) => Effect.map(Service, (manager) => manager.getAll(interfaceDef));
29
32
  var waitFor = (interfaceDef) => Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));
30
33
  var atom = (interfaceDef) => Effect.map(Service, (manager) => manager.atom(interfaceDef));
34
+ var atomByModule = (interfaceDef) => Effect.map(Service, (manager) => manager.atomByModule(interfaceDef));
35
+ var asLayer = (interfaceDef, tag) => Layer.effect(tag, get(interfaceDef).pipe(Effect.orDie));
31
36
  var ModuleTag = /* @__PURE__ */ Symbol.for("@dxos/app-framework/ModuleTag");
32
37
  var make = (identifier) => {
33
38
  return {
@@ -43,7 +48,7 @@ var contributes = (interfaceDef, implementation, deactivate) => {
43
48
  };
44
49
  var lazy = (name, c) => {
45
50
  const lazyFn = (props) => Effect.gen(function* () {
46
- const { default: getCapability } = yield* Effect.tryPromise(() => c());
51
+ const { default: getCapability } = yield* Effect.promise(() => c());
47
52
  const result = yield* getCapability(props);
48
53
  const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [
49
54
  result
@@ -65,6 +70,8 @@ export {
65
70
  getAll,
66
71
  waitFor,
67
72
  atom,
73
+ atomByModule,
74
+ asLayer,
68
75
  ModuleTag,
69
76
  make,
70
77
  contributes,
@@ -73,4 +80,4 @@ export {
73
80
  makeModule,
74
81
  capability_exports
75
82
  };
76
- //# sourceMappingURL=chunk-YNFPIQGB.mjs.map
83
+ //# sourceMappingURL=chunk-IW44C7UL.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/capability.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport type * as CapabilityManager from './capability-manager';\nimport type * as Plugin from './plugin';\n\n//\n// Capability Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing CapabilityManager via the Effect layer system.\n * This allows capability modules to access the capability manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/CapabilityManager')<\n Service,\n CapabilityManager.CapabilityManager\n>() {}\n\n/**\n * Get a single capability from the capability manager.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation.\n * @throws If no capability is found.\n */\n// TODO(wittjosiah): Add custom tagged errors (Data.TaggedError) for app-framework to enable\n// type-safe error handling with Effect. Consider CapabilityNotFoundError, ModuleActivationError, etc.\nexport const get = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) =>\n Effect.try({\n try: () => manager.get(interfaceDef),\n catch: (error) => (error instanceof Error ? error : new Error(String(error))),\n }),\n );\n\n/**\n * Get all capabilities from the capability manager for a given interface.\n * @param interfaceDef The interface definition of the capability.\n * @returns An array of capability implementations.\n */\nexport const getAll = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T[], never, Service> =>\n Effect.map(Service, (manager) => manager.getAll(interfaceDef));\n\n/**\n * Wait for a capability to be available.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation once available.\n */\nexport const waitFor = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));\n\n/**\n * Get the Atom reference to capabilities for reactive access.\n * @param interfaceDef The interface definition of the capability.\n * @returns An Atom containing the array of capability implementations.\n */\nexport const atom = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<Atom.Atom<T[]>, never, Service> =>\n Effect.map(Service, (manager) => manager.atom(interfaceDef));\n\n/**\n * Get capabilities grouped by the module that contributed them.\n * @param interfaceDef The interface definition of the capability.\n * @returns An Atom containing a record from module ID to capability implementations.\n */\nexport const atomByModule = <T>(\n interfaceDef: InterfaceDef<T>,\n): Effect.Effect<Atom.Atom<Record<string, T[]>>, never, Service> =>\n Effect.map(Service, (manager) => manager.atomByModule(interfaceDef));\n\n/**\n * Constructs a layer that will request its interface implementation from the capability manager.\n */\nexport const asLayer = <T, I>(interfaceDef: InterfaceDef<T>, tag: Context.Tag<I, T>): Layer.Layer<I, never, Service> =>\n Layer.effect(tag, get(interfaceDef).pipe(Effect.orDie));\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * Symbol used to tag lazy capability functions with their module ID.\n */\nexport const ModuleTag: unique symbol = Symbol.for('@dxos/app-framework/ModuleTag');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\nexport namespace InterfaceDef {\n export type Implementation<I extends InterfaceDef<any>> = I extends InterfaceDef<infer T> ? T : never;\n}\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const make = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * A unique string identifier with a Typescript type associated with it.\n * When a capability is contributed to the application an implementation of the interface is provided.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n readonly interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n readonly implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n readonly deactivate?: () => Effect.Effect<void, Error>;\n};\n\nexport type Any = Capability<any>;\n\n/**\n * Union type representing all valid return types for a capability module.\n * Supports single capabilities, arrays, and tuples of different capability types.\n */\nexport type ModuleReturn = void | Any | Any[] | readonly Any[] | [Any, ...Any[]] | readonly [Any, ...Any[]];\n\n/**\n * Helper to define the implementation of a capability.\n */\n// TODO(dmaretskyi): Make the return type non-generic so capabilities are non-discernable.\nexport const contributes = <I extends InterfaceDef<any>>(\n interfaceDef: I,\n implementation: Capability<InterfaceDef.Implementation<I>>['implementation'],\n deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],\n): Capability<I> => {\n return {\n interface: interfaceDef,\n implementation,\n deactivate,\n } satisfies Capability<I>;\n};\n\ntype LoadCapability<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\ntype LoadCapabilities<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\n\ntype NormalizeReturn<R> = R extends readonly (infer A)[]\n ? A[]\n : R extends (infer A)[]\n ? A[]\n : R extends Any\n ? [R]\n : Any[];\n\nexport type LazyCapability<Props = void, Capabilities extends ModuleReturn = ModuleReturn, E extends Error = Error> = (\n props: Props,\n) => Effect.Effect<NormalizeReturn<Capabilities>, E, Service | Plugin.Service | never>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n * Supports single capabilities, arrays, and tuples of different capability types.\n * @param name The export name (e.g., 'AppGraphBuilder') - used to auto-compute module IDs.\n * @param loader The lazy loader function.\n * @returns A lazy capability function with ModuleTag symbol attached.\n */\nexport const lazy = <T = void, R extends ModuleReturn = ModuleReturn>(\n name: string,\n c: LoadCapability<T, R> | LoadCapabilities<T, R>,\n): LazyCapability<T, R> => {\n const lazyFn: LazyCapability<T, R> = (props: T) =>\n Effect.gen(function* () {\n const { default: getCapability } = yield* Effect.promise(() => c());\n const result = yield* getCapability(props);\n const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [result];\n return normalized as NormalizeReturn<R>;\n });\n\n return Object.assign(lazyFn, { [ModuleTag]: name });\n};\n\n/**\n * Gets the module tag (export name) from a lazy capability function.\n * @param capability The lazy capability function.\n * @returns The module tag if present, undefined otherwise.\n */\n// TODO(wittjosiah): Stricter type for capability.\nexport const getModuleTag = (capability: unknown): string | undefined => {\n return capability && typeof capability === 'function' && ModuleTag in capability\n ? String(capability[ModuleTag])\n : undefined;\n};\n\n/**\n * Helper to define a capability module with explicit typing.\n * Wraps the default export function to provide better type inference and make the pattern explicit.\n *\n * This helper provides explicit typing for the module activation function,\n * making it clear that the function should:\n * - Access CapabilityManager via the Effect layer system (Capability.get, Capability.getAll, etc.)\n * - Return a capability, array of capabilities, or tuple of different capability types (sync or async)\n *\n * Supports returning multiple capabilities of different types as a tuple, which will be normalized\n * to an array at runtime for compatibility with the plugin system.\n *\n * @example\n * ```ts\n * // Module without options - single capability\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * const client = yield* Capability.get(ClientCapabilities.Client);\n * return contributes(Capabilities.SettingsStore, store);\n * })\n * );\n *\n * // Module with multiple capabilities\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * return [\n * contributes(Capabilities.SettingsStore, store),\n * contributes(Capabilities.Translations, translations),\n * ];\n * })\n * );\n *\n * // Module with required options (context accessed via layer)\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* (props: { observability: boolean }) {\n * const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n * return contributes(Capabilities.OperationHandler, ...);\n * })\n * );\n * ```\n */\nexport const makeModule = <\n TProps = void,\n TReturn extends ModuleReturn = ModuleReturn,\n E extends Error = Error,\n R extends Service | Plugin.Service | never = Service,\n>(\n fn: (props: TProps) => Effect.Effect<TReturn, E, R>,\n): ((props: TProps) => Effect.Effect<TReturn, E, R>) => fn;\n"],
5
+ "mappings": ";;;;;AAAA;;;;;;;;;;;;;;;;AAKA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AAahB,IAAMC,UAAN,cAA8BC,YAAI,uCAAA,EAAA,EAAA;AAGpC;AAUE,IAAMC,MAAM,CAAIC,iBACdC,eAAQJ,SAAS,CAACK,YAChBC,WAAI;EACTA,KAAK,MAAMD,QAAQH,IAAIC,YAAAA;EACvBI,OAAO,CAACC,UAAWA,iBAAiBC,QAAQD,QAAQ,IAAIC,MAAMC,OAAOF,KAAAA,CAAAA;AACvE,CAAA,CAAA;AAQG,IAAMG,SAAS,CAAIR,iBACjBS,WAAIZ,SAAS,CAACK,YAAYA,QAAQM,OAAOR,YAAAA,CAAAA;AAO3C,IAAMU,UAAU,CAAIV,iBAClBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQQ,QAAQV,YAAAA,CAAAA;AAOhD,IAAMW,OAAO,CAAIX,iBACfS,WAAIZ,SAAS,CAACK,YAAYA,QAAQS,KAAKX,YAAAA,CAAAA;AAOzC,IAAMY,eAAe,CAC1BZ,iBAEOS,WAAIZ,SAAS,CAACK,YAAYA,QAAQU,aAAaZ,YAAAA,CAAAA;AAKjD,IAAMa,UAAU,CAAOb,cAA+Bc,QACrDC,aAAOD,KAAKf,IAAIC,YAAAA,EAAcgB,KAAYC,YAAK,CAAA;AAOhD,IAAMC,YAA2BC,uBAAOC,IAAI,+BAAA;AAiB5C,IAAMC,OAAO,CAAIC,eAAAA;AACtB,SAAO;IAAEA;EAAW;AACtB;AAmCO,IAAMC,cAAc,CACzBC,cACAC,gBACAC,eAAAA;AAEA,SAAO;IACLC,WAAWH;IACXC;IACAC;EACF;AACF;AA4BO,IAAME,OAAO,CAClBC,MACAC,MAAAA;AAEA,QAAMC,SAA+B,CAACC,UAC7BC,WAAI,aAAA;AACT,UAAM,EAAEC,SAASC,cAAa,IAAK,OAAcC,eAAQ,MAAMN,EAAAA,CAAAA;AAC/D,UAAMO,SAAS,OAAOF,cAAcH,KAAAA;AACpC,UAAMM,aAAaD,UAAU,OAAO,CAAA,IAAKE,MAAMC,QAAQH,MAAAA,IAAUE,MAAME,KAAKJ,MAAAA,IAAU;MAACA;;AACvF,WAAOC;EACT,CAAA;AAEF,SAAOI,OAAOC,OAAOZ,QAAQ;IAAE,CAACb,SAAAA,GAAYW;EAAK,CAAA;AACnD;AAQO,IAAMe,eAAe,CAACC,eAAAA;AAC3B,SAAOA,cAAc,OAAOA,eAAe,cAAc3B,aAAa2B,aAClEC,OAAOD,WAAW3B,SAAAA,CAAU,IAC5B6B;AACN;AA2CO,IAAMC,aAAa,CAMxBC,OACsDA;",
6
+ "names": ["Context", "Effect", "Layer", "Service", "Tag", "get", "interfaceDef", "flatMap", "manager", "try", "catch", "error", "Error", "String", "getAll", "map", "waitFor", "atom", "atomByModule", "asLayer", "tag", "effect", "pipe", "orDie", "ModuleTag", "Symbol", "for", "make", "identifier", "contributes", "interfaceDef", "implementation", "deactivate", "interface", "lazy", "name", "c", "lazyFn", "props", "gen", "default", "getCapability", "promise", "result", "normalized", "Array", "isArray", "from", "Object", "assign", "getModuleTag", "capability", "String", "undefined", "makeModule", "fn"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  capability_exports
3
- } from "./chunk-YNFPIQGB.mjs";
3
+ } from "./chunk-IW44C7UL.mjs";
4
4
 
5
5
  // src/common/translations.ts
6
6
  import * as Schema from "effect/Schema";
@@ -12,12 +12,12 @@ var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.Strin
12
12
 
13
13
  // src/common/operations.ts
14
14
  import * as Schema2 from "effect/Schema";
15
- import { Operation } from "@dxos/operation";
16
- var UNDO_NAMESPACE = "dxos.org/app-framework/undo";
15
+ import { Operation } from "@dxos/compute";
16
+ var UNDO_NAMESPACE = "org.dxos.app-framework.undo";
17
17
  (function(UndoOperation2) {
18
18
  UndoOperation2.ShowUndo = Operation.make({
19
19
  meta: {
20
- key: `${UNDO_NAMESPACE}/operation/show-undo`,
20
+ key: `${UNDO_NAMESPACE}.operation.show-undo`,
21
21
  name: "Show Undo",
22
22
  description: "Show an undo toast notification."
23
23
  },
@@ -25,14 +25,12 @@ var UNDO_NAMESPACE = "dxos.org/app-framework/undo";
25
25
  services: [
26
26
  capability_exports.Service
27
27
  ],
28
- schema: {
29
- input: Schema2.Struct({
30
- message: Schema2.optional(Label.annotations({
31
- description: "The message to display in the undo toast."
32
- }))
33
- }),
34
- output: Schema2.Void
35
- }
28
+ input: Schema2.Struct({
29
+ message: Schema2.optional(Label.annotations({
30
+ description: "The message to display in the undo toast."
31
+ }))
32
+ }),
33
+ output: Schema2.Void
36
34
  });
37
35
  })(UndoOperation || (UndoOperation = {}));
38
36
  var UndoOperation;
@@ -41,4 +39,4 @@ export {
41
39
  Label,
42
40
  UndoOperation
43
41
  };
44
- //# sourceMappingURL=chunk-5RJNZV7K.mjs.map
42
+ //# sourceMappingURL=chunk-KFDF7KR3.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/common/translations.ts", "../../../src/common/operations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * A Label represents translatable text - either a simple string or a tuple of [key, options].\n */\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Capability } from '../core';\n\nimport { Label } from './translations';\n\nconst UNDO_NAMESPACE = 'dxos.org/app-framework/undo';\n\n/**\n * Operations related to undo/history functionality.\n */\nexport namespace UndoOperation {\n /**\n * Show an undo toast notification.\n * Fired by HistoryTracker when an undoable operation is tracked.\n */\n export const ShowUndo = Operation.make({\n meta: {\n key: `${UNDO_NAMESPACE}/operation/show-undo`,\n name: 'Show Undo',\n description: 'Show an undo toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n message: Schema.optional(Label.annotations({ description: 'The message to display in the undo toast.' })),\n }),\n output: Schema.Void,\n },\n });\n}\n"],
5
- "mappings": ";;;;;AAIA,YAAYA,YAAY;AAKjB,IAAMC,QAAeC,aACnBC,eACAC,eACEC,aACEF,eACAC,eACEE,cAAO;EACZC,IAAWJ;EACXK,OAAcC,gBAAgBC,aAAM;EACpCC,cAAqBF,gBAAgBN,aAAM;AAC7C,CAAA,CAAA,CAAA,CAAA,CAAA;;;ACfR,YAAYS,aAAY;AAExB,SAASC,iBAAiB;AAM1B,IAAMC,iBAAiB;UAKNC,gBAAAA;iBAKFC,WAAWC,UAAUC,KAAK;IACrCC,MAAM;MACJC,KAAK,GAAGN,cAAAA;MACRO,MAAM;MACNC,aAAa;IACf;IACAC,eAAe;IACfC,UAAU;MAACC,mBAAWC;;IACtBC,QAAQ;MACNC,OAAcC,eAAO;QACnBC,SAAgBC,iBAASC,MAAMC,YAAY;UAAEX,aAAa;QAA4C,CAAA,CAAA;MACxG,CAAA;MACAY,QAAeC;IACjB;EACF,CAAA;AACF,GApBiBpB,kBAAAA,gBAAAA,CAAAA,EAAAA;;",
6
- "names": ["Schema", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "defaultValue", "Schema", "Operation", "UNDO_NAMESPACE", "UndoOperation", "ShowUndo", "Operation", "make", "meta", "key", "name", "description", "executionMode", "services", "Capability", "Service", "schema", "input", "Struct", "message", "optional", "Label", "annotations", "output", "Void"]
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * A Label represents translatable text - either a simple string or a tuple of [key, options].\n */\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/compute';\n\nimport { Capability } from '../core';\nimport { Label } from './translations';\n\nconst UNDO_NAMESPACE = 'org.dxos.app-framework.undo';\n\n/**\n * Operations related to undo/history functionality.\n */\nexport namespace UndoOperation {\n /**\n * Show an undo toast notification.\n * Fired by HistoryTracker when an undoable operation is tracked.\n */\n export const ShowUndo = Operation.make({\n meta: {\n key: `${UNDO_NAMESPACE}.operation.show-undo`,\n name: 'Show Undo',\n description: 'Show an undo toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n input: Schema.Struct({\n message: Schema.optional(Label.annotations({ description: 'The message to display in the undo toast.' })),\n }),\n output: Schema.Void,\n });\n}\n"],
5
+ "mappings": ";;;;;AAIA,YAAYA,YAAY;AAKjB,IAAMC,QAAeC,aACnBC,eACAC,eACEC,aACEF,eACAC,eACEE,cAAO;EACZC,IAAWJ;EACXK,OAAcC,gBAAgBC,aAAM;EACpCC,cAAqBF,gBAAgBN,aAAM;AAC7C,CAAA,CAAA,CAAA,CAAA,CAAA;;;ACfR,YAAYS,aAAY;AAExB,SAASC,iBAAiB;AAK1B,IAAMC,iBAAiB;UAKNC,gBAAAA;iBAKFC,WAAWC,UAAUC,KAAK;IACrCC,MAAM;MACJC,KAAK,GAAGN,cAAAA;MACRO,MAAM;MACNC,aAAa;IACf;IACAC,eAAe;IACfC,UAAU;MAACC,mBAAWC;;IACtBC,OAAcC,eAAO;MACnBC,SAAgBC,iBAASC,MAAMC,YAAY;QAAEV,aAAa;MAA4C,CAAA,CAAA;IACxG,CAAA;IACAW,QAAeC;EACjB,CAAA;AACF,GAlBiBnB,kBAAAA,gBAAAA,CAAAA,EAAAA;;",
6
+ "names": ["Schema", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "defaultValue", "Schema", "Operation", "UNDO_NAMESPACE", "UndoOperation", "ShowUndo", "Operation", "make", "meta", "key", "name", "description", "executionMode", "services", "Capability", "Service", "input", "Struct", "message", "optional", "Label", "annotations", "output", "Void"]
7
7
  }
@@ -0,0 +1,422 @@
1
+ import {
2
+ isPlugin
3
+ } from "./chunk-SLX73WRZ.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-KLHQNYJ2.mjs.map