@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/testing/react.tsx"],
4
+ "sourcesContent": ["//\n// Copyright 2026 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport { render as rtlRender, type RenderOptions, type RenderResult } from '@testing-library/react';\nimport React, { type FC, Fragment, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { ContextProtocolProvider } from '@dxos/web-context-react';\n\nimport { Capabilities } from '../common';\nimport { PluginManagerContext } from '../context';\nimport { topologicalSort } from '../helpers';\nimport { PluginManagerProvider } from '../ui/components/PluginManager/PluginManagerProvider';\nimport { SurfaceComponent } from '../ui/components/Surface/SurfaceComponent';\nimport { type TestHarness } from './harness';\n\nexport type HarnessRenderOptions = Omit<RenderOptions, 'wrapper'> & {\n /** Additional providers to wrap around the harness tree (applied innermost first). */\n reactContexts?: FC<PropsWithChildren>[];\n};\n\n/**\n * Renders `ui` wrapped in the same provider tree as `useApp` plus every contributed\n * `Capabilities.ReactContext`.\n */\nexport const render = (harness: TestHarness, ui: ReactNode, options?: HarnessRenderOptions): RenderResult => {\n const { reactContexts = [], ...rest } = options ?? {};\n const Wrapper = ({ children }: PropsWithChildren) => (\n <HarnessProviders harness={harness} extra={reactContexts}>\n {children}\n </HarnessProviders>\n );\n return rtlRender(<>{ui}</>, { ...rest, wrapper: Wrapper });\n};\n\nexport type RenderSurfaceProps = {\n role: string;\n data?: unknown;\n limit?: number;\n fallback?: FC<{ error: Error; data?: any }>;\n placeholder?: ReactNode;\n};\n\n/**\n * Renders a `Surface` with the given role/data inside the harness provider tree.\n */\nexport const renderSurface = (\n harness: TestHarness,\n props: RenderSurfaceProps,\n options?: HarnessRenderOptions,\n): RenderResult => {\n const { role, data, limit, fallback, placeholder } = props;\n return render(\n harness,\n <SurfaceComponent role={role} data={data as any} limit={limit} fallback={fallback} placeholder={placeholder} />,\n options,\n );\n};\n\ntype HarnessProvidersProps = PropsWithChildren<{\n harness: TestHarness;\n extra: FC<PropsWithChildren>[];\n}>;\n\nconst HarnessProviders = ({ harness, extra, children }: HarnessProvidersProps) => {\n const contributed = harness.getAll(Capabilities.ReactContext);\n const ContributedContext = composeContexts(contributed);\n const ExtraContext = composeExtra(extra);\n return (\n <PluginManagerProvider value={harness.manager}>\n <ContextProtocolProvider value={harness.manager} context={PluginManagerContext}>\n <RegistryContext.Provider value={harness.registry}>\n <ContributedContext>\n <ExtraContext>{children}</ExtraContext>\n </ContributedContext>\n </RegistryContext.Provider>\n </ContextProtocolProvider>\n </PluginManagerProvider>\n );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]): FC<PropsWithChildren> => {\n if (contexts.length === 0) {\n return Passthrough;\n }\n return topologicalSort(contexts)\n .map(({ context }) => context)\n .reduce((Acc, Next) => ({ children }: PropsWithChildren) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n\n// Composes in innermost-first order: the first context in the array wraps\n// `children` directly; subsequent contexts wrap the accumulator.\nconst composeExtra = (contexts: FC<PropsWithChildren>[]): FC<PropsWithChildren> => {\n if (contexts.length === 0) {\n return Passthrough;\n }\n return contexts.reduce<FC<PropsWithChildren>>(\n (Acc, Next) =>\n ({ children }: PropsWithChildren) => (\n <Next>\n <Acc>{children}</Acc>\n </Next>\n ),\n Passthrough,\n );\n};\n\nconst Passthrough: FC<PropsWithChildren> = ({ children }) => <Fragment>{children}</Fragment>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,uBAAuB;AAChC,SAASC,UAAUC,iBAAwD;AAC3E,OAAOC,SAAkBC,gBAAwD;AAEjF,SAASC,+BAA+B;AAkBjC,IAAMC,SAAS,CAACC,SAAsBC,IAAeC,YAAAA;AAC1D,QAAM,EAAEC,gBAAgB,CAAA,GAAI,GAAGC,KAAAA,IAASF,WAAW,CAAC;AACpD,QAAMG,UAAU,CAAC,EAAEC,SAAQ,MACzB,sBAAA,cAACC,kBAAAA;IAAiBP;IAAkBQ,OAAOL;KACxCG,QAAAA;AAGL,SAAOG,UAAU,sBAAA,cAAA,MAAA,UAAA,MAAGR,EAAAA,GAAQ;IAAE,GAAGG;IAAMM,SAASL;EAAQ,CAAA;AAC1D;AAaO,IAAMM,gBAAgB,CAC3BX,SACAY,OACAV,YAAAA;AAEA,QAAM,EAAEW,MAAMC,MAAMC,OAAOC,UAAUC,YAAW,IAAKL;AACrD,SAAOb,OACLC,SACA,sBAAA,cAACkB,kBAAAA;IAAiBL;IAAYC;IAAmBC;IAAcC;IAAoBC;MACnFf,OAAAA;AAEJ;AAOA,IAAMK,mBAAmB,CAAC,EAAEP,SAASQ,OAAOF,SAAQ,MAAyB;AAC3E,QAAMa,cAAcnB,QAAQoB,OAAOC,qBAAaC,YAAY;AAC5D,QAAMC,qBAAqBC,gBAAgBL,WAAAA;AAC3C,QAAMM,eAAeC,aAAalB,KAAAA;AAClC,SACE,sBAAA,cAACmB,uBAAAA;IAAsBC,OAAO5B,QAAQ6B;KACpC,sBAAA,cAACC,yBAAAA;IAAwBF,OAAO5B,QAAQ6B;IAASE,SAASC;KACxD,sBAAA,cAACC,gBAAgBC,UAAQ;IAACN,OAAO5B,QAAQmC;KACvC,sBAAA,cAACZ,oBAAAA,MACC,sBAAA,cAACE,cAAAA,MAAcnB,QAAAA,CAAAA,CAAAA,CAAAA,CAAAA;AAM3B;AAEA,IAAMkB,kBAAkB,CAACY,aAAAA;AACvB,MAAIA,SAASC,WAAW,GAAG;AACzB,WAAOC;EACT;AACA,SAAOC,gBAAgBH,QAAAA,EACpBI,IAAI,CAAC,EAAET,QAAO,MAAOA,OAAAA,EACrBU,OAAO,CAACC,KAAKC,SAAS,CAAC,EAAErC,SAAQ,MAChC,sBAAA,cAACoC,KAAAA,MACC,sBAAA,cAACC,MAAAA,MAAMrC,QAAAA,CAAAA,CAAAA;AAGf;AAIA,IAAMoB,eAAe,CAACU,aAAAA;AACpB,MAAIA,SAASC,WAAW,GAAG;AACzB,WAAOC;EACT;AACA,SAAOF,SAASK,OACd,CAACC,KAAKC,SACJ,CAAC,EAAErC,SAAQ,MACT,sBAAA,cAACqC,MAAAA,MACC,sBAAA,cAACD,KAAAA,MAAKpC,QAAAA,CAAAA,GAGZgC,WAAAA;AAEJ;AAEA,IAAMA,cAAqC,CAAC,EAAEhC,SAAQ,MAAO,sBAAA,cAACsC,UAAAA,MAAUtC,QAAAA;",
6
+ "names": ["RegistryContext", "render", "rtlRender", "React", "Fragment", "ContextProtocolProvider", "render", "harness", "ui", "options", "reactContexts", "rest", "Wrapper", "children", "HarnessProviders", "extra", "rtlRender", "wrapper", "renderSurface", "props", "role", "data", "limit", "fallback", "placeholder", "SurfaceComponent", "contributed", "getAll", "Capabilities", "ReactContext", "ContributedContext", "composeContexts", "ExtraContext", "composeExtra", "PluginManagerProvider", "value", "manager", "ContextProtocolProvider", "context", "PluginManagerContext", "RegistryContext", "Provider", "registry", "contexts", "length", "Passthrough", "topologicalSort", "map", "reduce", "Acc", "Next", "Fragment"]
7
+ }
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  App,
3
3
  LoadingState,
4
- PluginManagerProvider,
5
- Surface,
4
+ Placeholder,
6
5
  useApp,
7
6
  useAtomCapability,
8
7
  useAtomCapabilityState,
@@ -10,24 +9,32 @@ import {
10
9
  useCapability,
11
10
  useLoading,
12
11
  useOperationInvoker,
13
- useOperationResolver,
14
- usePluginManager,
12
+ useProcessManagerRuntime,
15
13
  useSettingsState,
14
+ useSpaceCallback,
15
+ useSpaceService
16
+ } from "../chunk-UVTGHZQF.mjs";
17
+ import {
18
+ PluginManagerProvider,
19
+ Surface,
20
+ usePluginManager,
16
21
  useSurface
17
- } from "../chunk-4CTRO67U.mjs";
18
- import "../chunk-FHQTHCX7.mjs";
19
- import "../chunk-5RJNZV7K.mjs";
20
- import "../chunk-REORGDJT.mjs";
21
- import "../chunk-NPUEVX42.mjs";
22
- import "../chunk-YAFEA4GV.mjs";
23
- import "../chunk-HE27PNNQ.mjs";
24
- import "../chunk-PKQT6C53.mjs";
25
- import "../chunk-FNKT2QQ2.mjs";
26
- import "../chunk-YNFPIQGB.mjs";
22
+ } from "../chunk-QLML5QFJ.mjs";
23
+ import "../chunk-FJ4765WW.mjs";
24
+ import "../chunk-KFDF7KR3.mjs";
25
+ import "../chunk-5AHASNDW.mjs";
26
+ import "../chunk-5GY3YOEL.mjs";
27
+ import "../chunk-FO3IYSLV.mjs";
28
+ import "../chunk-KLHQNYJ2.mjs";
29
+ import "../chunk-VJ5PFAWC.mjs";
30
+ import "../chunk-66IXTIVK.mjs";
31
+ import "../chunk-SLX73WRZ.mjs";
32
+ import "../chunk-IW44C7UL.mjs";
27
33
  import "../chunk-J5LGTIGS.mjs";
28
34
  export {
29
35
  App,
30
36
  LoadingState,
37
+ Placeholder,
31
38
  PluginManagerProvider,
32
39
  Surface,
33
40
  useApp,
@@ -37,9 +44,11 @@ export {
37
44
  useCapability,
38
45
  useLoading,
39
46
  useOperationInvoker,
40
- useOperationResolver,
41
47
  usePluginManager,
48
+ useProcessManagerRuntime,
42
49
  useSettingsState,
50
+ useSpaceCallback,
51
+ useSpaceService,
43
52
  useSurface
44
53
  };
45
54
  //# sourceMappingURL=index.mjs.map
@@ -2,22 +2,23 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
  import {
3
3
  make,
4
4
  make2
5
- } from "./chunk-2A4PRBIX.mjs";
6
- import "./chunk-VUIUFIGT.mjs";
5
+ } from "./chunk-BYHYYJZH.mjs";
6
+ import "./chunk-OUEMWPIW.mjs";
7
7
  import {
8
8
  capabilities_exports
9
- } from "./chunk-UFW652GS.mjs";
10
- import "./chunk-JAZVHID3.mjs";
11
- import "./chunk-Z4TJPSMP.mjs";
12
- import "./chunk-DTCHT2X2.mjs";
13
- import "./chunk-7OWSHPYK.mjs";
14
- import "./chunk-CJCQS2YL.mjs";
9
+ } from "./chunk-PW2VYGOS.mjs";
10
+ import "./chunk-KFZEB6BV.mjs";
11
+ import "./chunk-WK7OIQKI.mjs";
12
+ import "./chunk-42UNAKYO.mjs";
13
+ import "./chunk-SFYCO3PT.mjs";
14
+ import "./chunk-XOCUANHO.mjs";
15
+ import "./chunk-6S45OMUP.mjs";
15
16
  import {
16
17
  capability_exports
17
- } from "./chunk-SB5ODNPX.mjs";
18
+ } from "./chunk-CTKEZHKF.mjs";
18
19
  import "./chunk-HSLMI22Q.mjs";
19
20
 
20
- // src/plugin-operation/history/capability.ts
21
+ // src/plugin-process-manager/history/capability.ts
21
22
  import * as Effect from "effect/Effect";
22
23
  var capability_default = capability_exports.makeModule(Effect.fnUntraced(function* () {
23
24
  const capabilities = yield* capability_exports.Service;
@@ -32,4 +33,4 @@ var capability_default = capability_exports.makeModule(Effect.fnUntraced(functio
32
33
  export {
33
34
  capability_default as default
34
35
  };
35
- //# sourceMappingURL=capability-EVZK4REM.mjs.map
36
+ //# sourceMappingURL=capability-RLKFFLTB.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin-process-manager/history/capability.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { OperationInvoker } from '@dxos/operation';\n\nimport { Capabilities } from '../../common';\nimport { Capability } from '../../core';\nimport * as HistoryTracker from './history-tracker';\nimport * as UndoRegistry from './undo-registry';\n\n//\n// Capability Module - contributes both UndoRegistry and HistoryTracker.\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get the context for synchronous access in callbacks.\n const capabilities = yield* Capability.Service;\n\n // Create UndoRegistry.\n const undoRegistry = UndoRegistry.make(() => capabilities.getAll(Capabilities.UndoMapping).flat());\n\n // Create HistoryTracker (depends on UndoRegistry and OperationInvoker).\n const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n // Cast to internal type - the factory always returns OperationInvokerInternal.\n const historyTracker = HistoryTracker.make(invoker as OperationInvoker.OperationInvokerInternal, undoRegistry);\n\n return [\n Capability.contributes(Capabilities.UndoRegistry, undoRegistry),\n Capability.contributes(Capabilities.HistoryTracker, historyTracker),\n ];\n }),\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AAaxB,IAAA,qBAAeC,mBAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,mBAAWI;AAGvC,QAAMC,eAA4BC,KAAK,MAAMH,aAAaI,OAAOC,qBAAaC,WAAW,EAAEC,KAAI,CAAA;AAG/F,QAAMC,UAAU,OAAOX,mBAAWY,IAAIJ,qBAAaK,gBAAgB;AAEnE,QAAMC,iBAAgCR,MAAKK,SAAsDN,YAAAA;AAEjG,SAAO;IACLL,mBAAWe,YAAYP,qBAAaQ,cAAcX,YAAAA;IAClDL,mBAAWe,YAAYP,qBAAaS,gBAAgBH,cAAAA;;AAExD,CAAA,CAAA;",
6
+ "names": ["Effect", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "undoRegistry", "make", "getAll", "Capabilities", "UndoMapping", "flat", "invoker", "get", "OperationInvoker", "historyTracker", "contributes", "UndoRegistry", "HistoryTracker"]
7
+ }
@@ -2,9 +2,9 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
 
3
3
  // src/context.ts
4
4
  import { createContext } from "@dxos/web-context";
5
- var PluginManagerContext = createContext("dxos.org/app-framework/plugin-manager");
5
+ var PluginManagerContext = createContext("org.dxos.app-framework.plugin-manager");
6
6
 
7
7
  export {
8
8
  PluginManagerContext
9
9
  };
10
- //# sourceMappingURL=chunk-UEWJDI2L.mjs.map
10
+ //# sourceMappingURL=chunk-37Z53PXZ.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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>('dxos.org/app-framework/plugin-manager');\n"],
5
- "mappings": ";;;AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBC,cAA2C,uCAAA;",
6
- "names": ["createContext", "PluginManagerContext", "createContext"]
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
7
  }
@@ -0,0 +1,423 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ isPlugin
4
+ } from "./chunk-6S45OMUP.mjs";
5
+ import {
6
+ __export
7
+ } from "./chunk-HSLMI22Q.mjs";
8
+
9
+ // src/core/url-loader.ts
10
+ var url_loader_exports = {};
11
+ __export(url_loader_exports, {
12
+ RemotePluginLoadError: () => RemotePluginLoadError,
13
+ getInstalledVersion: () => getInstalledVersion,
14
+ getRemoteEntries: () => getRemoteEntries,
15
+ isLocalUrl: () => isLocalUrl,
16
+ make: () => make,
17
+ preload: () => preload,
18
+ setInstalledVersion: () => setInstalledVersion,
19
+ uninstall: () => uninstall
20
+ });
21
+ import * as Effect3 from "effect/Effect";
22
+ import * as Option from "effect/Option";
23
+ import { BaseError as BaseError3 } from "@dxos/errors";
24
+ import { log } from "@dxos/log";
25
+
26
+ // src/core/plugin-asset-cache.ts
27
+ var plugin_asset_cache_exports = {};
28
+ __export(plugin_asset_cache_exports, {
29
+ PluginAssetCacheError: () => PluginAssetCacheError,
30
+ noop: () => noop
31
+ });
32
+ import * as Effect from "effect/Effect";
33
+ import { BaseError } from "@dxos/errors";
34
+ var PluginAssetCacheError = class extends BaseError.extend("PluginAssetCacheError", "Plugin asset cache operation failed") {
35
+ };
36
+ var noop = () => ({
37
+ cache: () => Effect.void,
38
+ evict: () => Effect.void,
39
+ resolve: (_pluginId, url) => Effect.succeed(url),
40
+ list: () => Effect.succeed([])
41
+ });
42
+
43
+ // src/core/plugin-manifest.ts
44
+ var plugin_manifest_exports = {};
45
+ __export(plugin_manifest_exports, {
46
+ Manifest: () => Manifest,
47
+ PLUGIN_DEV_SERVER_PORT: () => PLUGIN_DEV_SERVER_PORT,
48
+ PluginManifestError: () => PluginManifestError,
49
+ fetchManifest: () => fetchManifest,
50
+ parse: () => parse
51
+ });
52
+ import * as FetchHttpClient from "@effect/platform/FetchHttpClient";
53
+ import * as HttpClient from "@effect/platform/HttpClient";
54
+ import * as HttpClientRequest from "@effect/platform/HttpClientRequest";
55
+ import * as HttpClientResponse from "@effect/platform/HttpClientResponse";
56
+ import * as Effect2 from "effect/Effect";
57
+ import * as Schema from "effect/Schema";
58
+ import { BaseError as BaseError2 } from "@dxos/errors";
59
+ import { PLUGIN_ENTRY_FILENAME } from "@dxos/protocols";
60
+ var PLUGIN_DEV_SERVER_PORT = 3967;
61
+ var PluginManifestError = class extends BaseError2.extend("PluginManifestError", "Plugin manifest is invalid") {
62
+ };
63
+ var Manifest = Schema.Struct({
64
+ id: Schema.String,
65
+ name: Schema.String,
66
+ version: Schema.String,
67
+ assets: Schema.Array(Schema.String),
68
+ devEntry: Schema.String.pipe(Schema.optional)
69
+ });
70
+ var resolve = (manifestUrl, manifest) => {
71
+ const dev = manifest.devEntry !== void 0;
72
+ return {
73
+ id: manifest.id,
74
+ name: manifest.name,
75
+ version: manifest.version,
76
+ entryUrl: new URL(dev ? manifest.devEntry : PLUGIN_ENTRY_FILENAME, manifestUrl).toString(),
77
+ assetUrls: manifest.assets.map((asset) => new URL(asset, manifestUrl).toString()),
78
+ dev
79
+ };
80
+ };
81
+ var parse = (manifestUrl, payload) => {
82
+ const manifest = Schema.decodeUnknownSync(Manifest)(payload);
83
+ if (manifest.devEntry === void 0 && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
84
+ throw new Error(`Manifest at ${manifestUrl} does not list ${PLUGIN_ENTRY_FILENAME} in assets.`);
85
+ }
86
+ return resolve(manifestUrl, manifest);
87
+ };
88
+ var fetchManifest = (manifestUrl) => Effect2.gen(function* () {
89
+ const response = yield* HttpClientRequest.get(manifestUrl).pipe(HttpClient.execute, Effect2.mapError((cause) => new PluginManifestError({
90
+ context: {
91
+ manifestUrl,
92
+ reason: "fetch-failed"
93
+ },
94
+ cause
95
+ })));
96
+ if (response.status >= 400) {
97
+ return yield* Effect2.fail(new PluginManifestError({
98
+ context: {
99
+ manifestUrl,
100
+ reason: "http-error",
101
+ status: response.status
102
+ }
103
+ }));
104
+ }
105
+ const manifest = yield* HttpClientResponse.schemaBodyJson(Manifest)(response).pipe(Effect2.mapError((cause) => new PluginManifestError({
106
+ context: {
107
+ manifestUrl,
108
+ reason: "parse-failed"
109
+ },
110
+ cause
111
+ })));
112
+ if (manifest.devEntry === void 0 && !manifest.assets.includes(PLUGIN_ENTRY_FILENAME)) {
113
+ return yield* Effect2.fail(new PluginManifestError({
114
+ context: {
115
+ manifestUrl,
116
+ reason: "invalid"
117
+ },
118
+ cause: `assets does not include ${PLUGIN_ENTRY_FILENAME}`
119
+ }));
120
+ }
121
+ return resolve(manifestUrl, manifest);
122
+ }).pipe(Effect2.scoped, Effect2.provide(FetchHttpClient.layer));
123
+
124
+ // src/core/url-loader.ts
125
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/url-loader.ts";
126
+ var DEFAULT_KEY = "org.dxos.composer.remote-plugins";
127
+ var RemotePluginLoadError = class extends BaseError3.extend("RemotePluginLoadError", "Failed to load remote plugin") {
128
+ };
129
+ var defaultStorage = () => ({
130
+ get: (key) => localStorage.getItem(key),
131
+ set: (key, value) => localStorage.setItem(key, value)
132
+ });
133
+ var getPersistedRemotePlugins = (storage, key) => {
134
+ try {
135
+ const parsed = JSON.parse(storage.get(key) ?? "[]");
136
+ if (!Array.isArray(parsed)) {
137
+ return [];
138
+ }
139
+ return parsed.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.url === "string");
140
+ } catch {
141
+ return [];
142
+ }
143
+ };
144
+ var persistRemotePlugin = (storage, key, entry) => {
145
+ try {
146
+ const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== entry.id);
147
+ entries.push(entry);
148
+ storage.set(key, JSON.stringify(entries));
149
+ } catch (error) {
150
+ log.warn("failed to persist remote plugin entry", {
151
+ entry,
152
+ error
153
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 40, S: void 0 });
154
+ }
155
+ };
156
+ var removePersistedRemotePlugin = (storage, key, pluginId) => {
157
+ try {
158
+ const entries = getPersistedRemotePlugins(storage, key).filter((existing) => existing.id !== pluginId);
159
+ storage.set(key, JSON.stringify(entries));
160
+ } catch (error) {
161
+ log.warn("failed to remove remote plugin entry", {
162
+ pluginId,
163
+ error
164
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 51, S: void 0 });
165
+ }
166
+ };
167
+ var isUrl = (locator) => {
168
+ try {
169
+ const url = new URL(locator);
170
+ return url.protocol === "http:" || url.protocol === "https:";
171
+ } catch {
172
+ return false;
173
+ }
174
+ };
175
+ var isLocalUrl = (locator) => {
176
+ try {
177
+ const hostname = new URL(locator).hostname.toLowerCase();
178
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1" || hostname === "[::1]";
179
+ } catch {
180
+ return false;
181
+ }
182
+ };
183
+ var getRemoteEntries = (options = {}) => {
184
+ const storage = options.storage ?? defaultStorage();
185
+ const key = options.key ?? DEFAULT_KEY;
186
+ return getPersistedRemotePlugins(storage, key);
187
+ };
188
+ var setInstalledVersion = (id, version, options = {}) => {
189
+ const storage = options.storage ?? defaultStorage();
190
+ const key = options.key ?? DEFAULT_KEY;
191
+ const entries = getPersistedRemotePlugins(storage, key);
192
+ const index = entries.findIndex((entry) => entry.id === id);
193
+ if (index === -1) {
194
+ return;
195
+ }
196
+ entries[index] = {
197
+ ...entries[index],
198
+ version
199
+ };
200
+ try {
201
+ storage.set(key, JSON.stringify(entries));
202
+ } catch (error) {
203
+ log.warn("failed to update installed version for remote plugin", {
204
+ id,
205
+ version,
206
+ error
207
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 103, S: void 0 });
208
+ }
209
+ };
210
+ var getInstalledVersion = (id, options = {}) => {
211
+ const storage = options.storage ?? defaultStorage();
212
+ const key = options.key ?? DEFAULT_KEY;
213
+ return getPersistedRemotePlugins(storage, key).find((entry) => entry.id === id)?.version;
214
+ };
215
+ var normalizePluginExport = (mod) => {
216
+ const exported = mod.default;
217
+ if (isPlugin(exported)) {
218
+ return exported;
219
+ }
220
+ if (typeof exported === "function") {
221
+ const result = exported();
222
+ if (isPlugin(result)) {
223
+ return result;
224
+ }
225
+ }
226
+ throw new Error("Remote module default export is not a Plugin or a zero-arg plugin factory.");
227
+ };
228
+ var loadStylesheets = (manifest, cache) => Effect3.gen(function* () {
229
+ if (typeof document === "undefined") {
230
+ return;
231
+ }
232
+ const cssUrls = manifest.assetUrls.filter((url) => url.endsWith(".css"));
233
+ for (const url of cssUrls) {
234
+ const resolved = yield* cache.resolve(manifest.id, url);
235
+ if (document.querySelector(`link[data-dxos-plugin-id="${manifest.id}"][href="${resolved}"]`)) {
236
+ continue;
237
+ }
238
+ const link = document.createElement("link");
239
+ link.rel = "stylesheet";
240
+ link.href = resolved;
241
+ link.dataset.dxosPluginId = manifest.id;
242
+ document.head.appendChild(link);
243
+ }
244
+ });
245
+ var loadFromManifest = (manifestUrl, cache) => Effect3.gen(function* () {
246
+ log.info("loading remote plugin", {
247
+ manifestUrl
248
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 152, S: this });
249
+ const manifest = yield* fetchManifest(manifestUrl).pipe(Effect3.mapError((cause) => new RemotePluginLoadError({
250
+ context: {
251
+ locator: manifestUrl,
252
+ reason: "manifest-error"
253
+ },
254
+ cause
255
+ })));
256
+ const wrapCacheError = Effect3.mapError((cause) => new RemotePluginLoadError({
257
+ context: {
258
+ locator: manifestUrl,
259
+ reason: "cache-error"
260
+ },
261
+ cause
262
+ }));
263
+ if (!manifest.dev) {
264
+ const cachedUrls = manifest.assetUrls.indexOf(manifestUrl) === -1 ? [
265
+ manifestUrl,
266
+ ...manifest.assetUrls
267
+ ] : manifest.assetUrls;
268
+ yield* cache.cache(manifest.id, cachedUrls).pipe(wrapCacheError);
269
+ }
270
+ const entryUrl = manifest.dev ? manifest.entryUrl : yield* cache.resolve(manifest.id, manifest.entryUrl).pipe(wrapCacheError);
271
+ const mod = yield* Effect3.tryPromise({
272
+ try: () => import(
273
+ /* @vite-ignore */
274
+ entryUrl
275
+ ),
276
+ catch: (cause) => new RemotePluginLoadError({
277
+ context: {
278
+ locator: manifestUrl,
279
+ reason: "import-failed"
280
+ },
281
+ cause
282
+ })
283
+ });
284
+ const plugin = normalizePluginExport(mod);
285
+ if (!plugin.meta.id || !plugin.meta.name) {
286
+ return yield* Effect3.fail(new RemotePluginLoadError({
287
+ context: {
288
+ locator: manifestUrl,
289
+ reason: "meta-missing"
290
+ }
291
+ }));
292
+ }
293
+ if (plugin.meta.id !== manifest.id) {
294
+ return yield* Effect3.fail(new RemotePluginLoadError({
295
+ context: {
296
+ locator: manifestUrl,
297
+ reason: "meta-mismatch",
298
+ metaId: plugin.meta.id,
299
+ manifestId: manifest.id
300
+ }
301
+ }));
302
+ }
303
+ if (!manifest.dev) {
304
+ yield* loadStylesheets(manifest, cache).pipe(wrapCacheError);
305
+ }
306
+ return {
307
+ plugin,
308
+ manifest
309
+ };
310
+ });
311
+ var preload = (options = {}) => Effect3.gen(function* () {
312
+ const storage = options.storage ?? defaultStorage();
313
+ const key = options.key ?? DEFAULT_KEY;
314
+ const cache = options.cache ?? noop();
315
+ const onPluginLoaded = options.onPluginLoaded;
316
+ const entries = getPersistedRemotePlugins(storage, key);
317
+ if (entries.length === 0) {
318
+ return [];
319
+ }
320
+ log.info("preloading remote plugins", {
321
+ count: entries.length
322
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 240, S: this });
323
+ const total = entries.length;
324
+ let loaded = 0;
325
+ const results = yield* Effect3.all(entries.map((entry) => loadFromManifest(entry.url, cache).pipe(
326
+ Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to preload remote plugin", {
327
+ entry,
328
+ error
329
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 245, S: this }))),
330
+ Effect3.option,
331
+ // Tick the progress hook on both success and recoverable failure so
332
+ // the counter monotonically reaches `total`. The host-supplied
333
+ // callback is best-effort: any synchronous throw flows through
334
+ // `Effect.try` and gets logged + ignored so a buggy hook can't
335
+ // derail the preload.
336
+ Effect3.tap(() => Effect3.sync(() => {
337
+ loaded += 1;
338
+ }).pipe(Effect3.andThen(Effect3.try(() => onPluginLoaded?.(loaded, total))), Effect3.tapError((error) => Effect3.sync(() => log.warn("onPluginLoaded threw", {
339
+ loaded,
340
+ total,
341
+ error
342
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 255, S: this }))), Effect3.ignore))
343
+ )), {
344
+ concurrency: "unbounded"
345
+ });
346
+ return results.flatMap((result) => Option.match(result, {
347
+ onNone: () => [],
348
+ onSome: ({ plugin }) => [
349
+ plugin
350
+ ]
351
+ }));
352
+ });
353
+ var make = (builtinPlugins, options = {}) => {
354
+ const storage = options.storage ?? defaultStorage();
355
+ const key = options.key ?? DEFAULT_KEY;
356
+ const cache = options.cache ?? noop();
357
+ return (locator) => Effect3.gen(function* () {
358
+ const builtin = builtinPlugins.find((plugin2) => plugin2.meta.id === locator);
359
+ if (builtin) {
360
+ return {
361
+ plugin: builtin
362
+ };
363
+ }
364
+ if (!isUrl(locator)) {
365
+ return yield* Effect3.fail(new RemotePluginLoadError({
366
+ context: {
367
+ locator,
368
+ reason: "invalid-locator"
369
+ }
370
+ }));
371
+ }
372
+ const { plugin, manifest } = yield* loadFromManifest(locator, cache);
373
+ if (!manifest.dev) {
374
+ const duplicate = builtinPlugins.find((existing) => existing.meta.id === plugin.meta.id);
375
+ if (duplicate) {
376
+ return yield* Effect3.fail(new RemotePluginLoadError({
377
+ context: {
378
+ locator,
379
+ reason: "duplicate-id",
380
+ id: plugin.meta.id
381
+ }
382
+ }));
383
+ }
384
+ persistRemotePlugin(storage, key, {
385
+ id: plugin.meta.id,
386
+ url: locator
387
+ });
388
+ }
389
+ return {
390
+ plugin,
391
+ dev: manifest.dev
392
+ };
393
+ });
394
+ };
395
+ var uninstall = (pluginId, options = {}) => Effect3.gen(function* () {
396
+ const storage = options.storage ?? defaultStorage();
397
+ const key = options.key ?? DEFAULT_KEY;
398
+ const cache = options.cache ?? noop();
399
+ removePersistedRemotePlugin(storage, key, pluginId);
400
+ if (typeof document !== "undefined") {
401
+ document.querySelectorAll(`link[data-dxos-plugin-id="${pluginId}"]`).forEach((node) => node.remove());
402
+ }
403
+ yield* cache.evict(pluginId).pipe(Effect3.tapError((error) => Effect3.sync(() => log.warn("failed to evict plugin assets", {
404
+ pluginId,
405
+ error
406
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 337, S: this }))), Effect3.ignore);
407
+ });
408
+
409
+ export {
410
+ plugin_asset_cache_exports,
411
+ PLUGIN_DEV_SERVER_PORT,
412
+ plugin_manifest_exports,
413
+ RemotePluginLoadError,
414
+ isLocalUrl,
415
+ getRemoteEntries,
416
+ setInstalledVersion,
417
+ getInstalledVersion,
418
+ preload,
419
+ make,
420
+ uninstall,
421
+ url_loader_exports
422
+ };
423
+ //# sourceMappingURL=chunk-42UNAKYO.mjs.map