@dxos/app-framework 0.8.4-main.40e3dcdf1b → 0.8.4-main.43cb759274

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 (389) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/{capability-LF3OXSCV.mjs → capability-JCUNWZ66.mjs} +12 -11
  4. package/dist/lib/browser/capability-JCUNWZ66.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-WEBSGU5L.mjs → chunk-2ZIYRDAF.mjs} +20 -5
  6. package/dist/lib/browser/chunk-2ZIYRDAF.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-272IPLHQ.mjs → chunk-66IXTIVK.mjs} +3 -2
  10. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-7MBI66M7.mjs +587 -0
  12. package/dist/lib/browser/chunk-7MBI66M7.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-BMLCIFZW.mjs +1467 -0
  14. package/dist/lib/browser/chunk-BMLCIFZW.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-7M4467QR.mjs → chunk-DC3WRPBV.mjs} +100 -18
  16. package/dist/lib/browser/chunk-DC3WRPBV.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-JGWCBVKJ.mjs → chunk-E5DTDNDY.mjs} +28 -55
  18. package/dist/lib/browser/chunk-E5DTDNDY.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
  20. package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
  21. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  22. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-YNFPIQGB.mjs → chunk-IW44C7UL.mjs} +9 -2
  24. package/dist/lib/browser/chunk-IW44C7UL.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-KZUDO43J.mjs +422 -0
  26. package/dist/lib/browser/chunk-KZUDO43J.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-Q2GLJTVV.mjs +12 -0
  28. package/dist/lib/browser/chunk-Q2GLJTVV.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-VBG5F5UF.mjs +476 -0
  30. package/dist/lib/browser/chunk-VBG5F5UF.mjs.map +7 -0
  31. package/dist/lib/browser/cli/index.mjs +15 -30
  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 +18 -4
  39. package/dist/lib/browser/core/url-loader.mjs +24 -0
  40. package/dist/lib/browser/index.mjs +51 -54
  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-4FUA4TRP.mjs +89 -0
  44. package/dist/lib/browser/process-manager-capability-4FUA4TRP.mjs.map +7 -0
  45. package/dist/lib/browser/testing/index.mjs +198 -54
  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 +22 -15
  50. package/dist/lib/node-esm/{capability-SA6LPYGL.mjs → capability-7TCQK7ZP.mjs} +12 -11
  51. package/dist/lib/node-esm/capability-7TCQK7ZP.mjs.map +7 -0
  52. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
  53. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
  54. package/dist/lib/node-esm/chunk-4BX2AE47.mjs +1468 -0
  55. package/dist/lib/node-esm/chunk-4BX2AE47.mjs.map +7 -0
  56. package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-CTKEZHKF.mjs} +9 -2
  57. package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-FPW45EZH.mjs +14 -0
  59. package/dist/lib/node-esm/chunk-FPW45EZH.mjs.map +7 -0
  60. package/dist/lib/node-esm/chunk-GEWHMHM7.mjs +588 -0
  61. package/dist/lib/node-esm/chunk-GEWHMHM7.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs +29 -0
  63. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-3D66SZHP.mjs → chunk-KSH4OVMY.mjs} +28 -55
  65. package/dist/lib/node-esm/chunk-KSH4OVMY.mjs.map +7 -0
  66. package/dist/lib/node-esm/{chunk-SQICGJBW.mjs → chunk-QBUGLR4H.mjs} +20 -5
  67. package/dist/lib/node-esm/chunk-QBUGLR4H.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  69. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-XGBUKRCK.mjs +423 -0
  71. package/dist/lib/node-esm/chunk-XGBUKRCK.mjs.map +7 -0
  72. package/dist/lib/node-esm/{chunk-JHFY3HTS.mjs → chunk-XIGPWXCQ.mjs} +100 -18
  73. package/dist/lib/node-esm/chunk-XIGPWXCQ.mjs.map +7 -0
  74. package/dist/lib/node-esm/{chunk-6REV5DE7.mjs → chunk-XOCUANHO.mjs} +3 -2
  75. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-Y7JKXNDU.mjs +477 -0
  77. package/dist/lib/node-esm/chunk-Y7JKXNDU.mjs.map +7 -0
  78. package/dist/lib/node-esm/cli/index.mjs +15 -30
  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 +18 -4
  86. package/dist/lib/node-esm/core/url-loader.mjs +25 -0
  87. package/dist/lib/node-esm/index.mjs +51 -54
  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-F23D62RN.mjs +90 -0
  91. package/dist/lib/node-esm/process-manager-capability-F23D62RN.mjs.map +7 -0
  92. package/dist/lib/node-esm/testing/index.mjs +198 -54
  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 +22 -15
  97. package/dist/plugin/node-esm/index.mjs +971 -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/index.d.ts +0 -1
  109. package/dist/types/src/common/index.d.ts.map +1 -1
  110. package/dist/types/src/common/translations.d.ts +1 -1
  111. package/dist/types/src/core/activation-event.d.ts +4 -4
  112. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  113. package/dist/types/src/core/capability-manager.d.ts +9 -0
  114. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  115. package/dist/types/src/core/capability.d.ts +13 -2
  116. package/dist/types/src/core/capability.d.ts.map +1 -1
  117. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  118. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  119. package/dist/types/src/core/index.d.ts +6 -0
  120. package/dist/types/src/core/index.d.ts.map +1 -1
  121. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  122. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  123. package/dist/types/src/core/plugin-manager.d.ts +238 -7
  124. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  125. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  126. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  127. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  128. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  129. package/dist/types/src/core/plugin.d.ts +213 -11
  130. package/dist/types/src/core/plugin.d.ts.map +1 -1
  131. package/dist/types/src/core/registry.d.ts +107 -0
  132. package/dist/types/src/core/registry.d.ts.map +1 -0
  133. package/dist/types/src/core/url-loader.d.ts +127 -0
  134. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  135. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  136. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  137. package/dist/types/src/helpers.d.ts.map +1 -1
  138. package/dist/types/src/index.d.ts +1 -2
  139. package/dist/types/src/index.d.ts.map +1 -1
  140. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts +3 -0
  141. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts.map +1 -0
  142. package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -0
  143. package/dist/types/src/plugin-process-manager/history/errors.d.ts +32 -0
  144. package/dist/types/src/plugin-process-manager/history/errors.d.ts.map +1 -0
  145. package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts +32 -0
  146. package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts.map +1 -0
  147. package/dist/types/src/plugin-process-manager/history/history-tracker.test.d.ts.map +1 -0
  148. package/dist/types/src/plugin-process-manager/history/index.d.ts.map +1 -0
  149. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/types.d.ts +1 -1
  150. package/dist/types/src/plugin-process-manager/history/types.d.ts.map +1 -0
  151. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.d.ts +2 -2
  152. package/dist/types/src/plugin-process-manager/history/undo-mapping.d.ts.map +1 -0
  153. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.d.ts +1 -1
  154. package/dist/types/src/plugin-process-manager/history/undo-registry.d.ts.map +1 -0
  155. package/dist/types/src/plugin-process-manager/history/undo-registry.test.d.ts.map +1 -0
  156. package/dist/types/src/plugin-process-manager/index.d.ts +3 -0
  157. package/dist/types/src/plugin-process-manager/index.d.ts.map +1 -0
  158. package/dist/types/src/plugin-process-manager/meta.d.ts +3 -0
  159. package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -0
  160. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +8 -0
  161. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -0
  162. package/dist/types/src/plugin-process-manager/testing.d.ts +59 -0
  163. package/dist/types/src/plugin-process-manager/testing.d.ts.map +1 -0
  164. package/dist/types/src/testing/harness.d.ts +79 -0
  165. package/dist/types/src/testing/harness.d.ts.map +1 -0
  166. package/dist/types/src/testing/index.d.ts +1 -0
  167. package/dist/types/src/testing/index.d.ts.map +1 -1
  168. package/dist/types/src/testing/react.d.ts +27 -0
  169. package/dist/types/src/testing/react.d.ts.map +1 -0
  170. package/dist/types/src/testing/react.test.d.ts +2 -0
  171. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  172. package/dist/types/src/testing/service.d.ts.map +1 -1
  173. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  174. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  175. package/dist/types/src/ui/components/App/App.d.ts +36 -3
  176. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  177. package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
  178. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  179. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  180. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  181. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  182. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  183. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -1
  184. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  185. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  186. package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
  187. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  188. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  189. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  190. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  191. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  192. package/dist/types/src/ui/hooks/index.d.ts +1 -1
  193. package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
  194. package/dist/types/src/ui/hooks/useApp.d.ts +42 -12
  195. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  196. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  197. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  198. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  199. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  200. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts +30 -0
  201. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts.map +1 -0
  202. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  203. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
  204. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  205. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +54 -0
  206. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
  207. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  208. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  209. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  210. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  211. package/dist/types/src/vite-plugin/index.d.ts +5 -0
  212. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  213. package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
  214. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  215. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  216. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  217. package/dist/types/src/vite-plugin/packages.d.ts +13 -0
  218. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  219. package/dist/types/tsconfig.tsbuildinfo +1 -1
  220. package/moon.yml +15 -0
  221. package/package.json +61 -57
  222. package/src/cli/cli.ts +2 -7
  223. package/src/common/activation-events.ts +10 -15
  224. package/src/common/annotations.ts +3 -0
  225. package/src/common/capabilities.ts +147 -16
  226. package/src/common/index.ts +0 -1
  227. package/src/common/translations.ts +1 -1
  228. package/src/core/activation-event.ts +4 -1
  229. package/src/core/capability-manager.test.ts +4 -1
  230. package/src/core/capability-manager.ts +44 -2
  231. package/src/core/capability.ts +20 -2
  232. package/src/core/edge-registry-plugin-provider.ts +92 -0
  233. package/src/core/index.ts +6 -0
  234. package/src/core/plugin-asset-cache.ts +60 -0
  235. package/src/core/plugin-manager.test.ts +1103 -19
  236. package/src/core/plugin-manager.ts +1176 -199
  237. package/src/core/plugin-manifest.test.ts +75 -0
  238. package/src/core/plugin-manifest.ts +134 -0
  239. package/src/core/plugin.ts +235 -17
  240. package/src/core/registry.ts +163 -0
  241. package/src/core/url-loader.test.ts +222 -0
  242. package/src/core/url-loader.ts +388 -0
  243. package/src/index.ts +1 -2
  244. package/src/plugin-process-manager/ProcessManagerPlugin.ts +24 -0
  245. package/src/{plugin-operation → plugin-process-manager}/history/capability.ts +1 -2
  246. package/src/plugin-process-manager/history/errors.ts +7 -0
  247. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.ts +61 -88
  248. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.ts +33 -18
  249. package/src/{plugin-operation → plugin-process-manager}/history/types.ts +1 -1
  250. package/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.ts +2 -2
  251. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.ts +6 -5
  252. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.ts +1 -1
  253. package/src/{plugin-operation → plugin-process-manager}/index.ts +1 -1
  254. package/src/plugin-process-manager/meta.ts +16 -0
  255. package/src/plugin-process-manager/process-manager-capability.ts +178 -0
  256. package/src/{plugin-operation → plugin-process-manager}/testing.ts +32 -50
  257. package/src/testing/harness.ts +247 -0
  258. package/src/testing/index.ts +1 -0
  259. package/src/testing/react.test.tsx +50 -0
  260. package/src/testing/react.tsx +113 -0
  261. package/src/testing/service.ts +2 -2
  262. package/src/testing/withPluginManager.stories.tsx +1 -2
  263. package/src/testing/withPluginManager.tsx +47 -21
  264. package/src/ui/components/App/App.stories.tsx +12 -20
  265. package/src/ui/components/App/App.tsx +97 -10
  266. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +13 -17
  267. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +17 -16
  268. package/src/ui/components/Surface/SurfaceComponent.tsx +111 -55
  269. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
  270. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  271. package/src/ui/components/Surface/index.ts +35 -1
  272. package/src/ui/components/Surface/types.test.ts +126 -0
  273. package/src/ui/components/Surface/types.ts +185 -12
  274. package/src/ui/hooks/index.ts +1 -1
  275. package/src/ui/hooks/useApp.test.tsx +161 -0
  276. package/src/ui/hooks/useApp.tsx +215 -24
  277. package/src/ui/hooks/useCapabilities.ts +1 -0
  278. package/src/ui/hooks/useLoading.tsx +14 -6
  279. package/src/ui/hooks/useProcessManagerRuntime.ts +78 -0
  280. package/src/vite-plugin/boot-loader/BootLoader.solid-stories.tsx +198 -0
  281. package/src/vite-plugin/boot-loader/index.ts +5 -0
  282. package/src/vite-plugin/boot-loader/loader-app/Loader.tsx +166 -0
  283. package/src/vite-plugin/boot-loader/loader-app/boot-loader.css +311 -0
  284. package/src/vite-plugin/boot-loader/loader-app/bridge.ts +25 -0
  285. package/src/vite-plugin/boot-loader/loader-app/entry.tsx +21 -0
  286. package/src/vite-plugin/boot-loader/loader-app/mount.tsx +70 -0
  287. package/src/vite-plugin/boot-loader/loader-app/store.test.ts +137 -0
  288. package/src/vite-plugin/boot-loader/loader-app/store.ts +149 -0
  289. package/src/vite-plugin/boot-loader/loader-app/tsconfig.json +11 -0
  290. package/src/vite-plugin/boot-loader/loader-app/types.ts +78 -0
  291. package/src/vite-plugin/boot-loader/loader.ts +193 -0
  292. package/src/vite-plugin/composer/index.ts +306 -0
  293. package/src/vite-plugin/import-map/index.ts +527 -0
  294. package/src/vite-plugin/index.ts +10 -0
  295. package/src/vite-plugin/manifest.test.ts +55 -0
  296. package/src/vite-plugin/manifest.ts +63 -0
  297. package/src/vite-plugin/packages.ts +187 -0
  298. package/tsconfig.json +26 -3
  299. package/tsconfig.node.json +1 -1
  300. package/vitest.config.ts +1 -1
  301. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  302. package/dist/lib/browser/capability-6YMUBS54.mjs +0 -37
  303. package/dist/lib/browser/capability-6YMUBS54.mjs.map +0 -7
  304. package/dist/lib/browser/capability-LF3OXSCV.mjs.map +0 -7
  305. package/dist/lib/browser/chunk-272IPLHQ.mjs.map +0 -7
  306. package/dist/lib/browser/chunk-2UI6ACB5.mjs +0 -824
  307. package/dist/lib/browser/chunk-2UI6ACB5.mjs.map +0 -7
  308. package/dist/lib/browser/chunk-7M4467QR.mjs.map +0 -7
  309. package/dist/lib/browser/chunk-JGWCBVKJ.mjs.map +0 -7
  310. package/dist/lib/browser/chunk-M5IC326L.mjs +0 -34
  311. package/dist/lib/browser/chunk-M5IC326L.mjs.map +0 -7
  312. package/dist/lib/browser/chunk-NQPYE365.mjs +0 -703
  313. package/dist/lib/browser/chunk-NQPYE365.mjs.map +0 -7
  314. package/dist/lib/browser/chunk-TIEBZMTF.mjs +0 -44
  315. package/dist/lib/browser/chunk-TIEBZMTF.mjs.map +0 -7
  316. package/dist/lib/browser/chunk-WEBSGU5L.mjs.map +0 -7
  317. package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
  318. package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
  319. package/dist/lib/browser/invoker-capability-4AUGUMM5.mjs +0 -36
  320. package/dist/lib/browser/invoker-capability-4AUGUMM5.mjs.map +0 -7
  321. package/dist/lib/node-esm/capability-R5O2OYX4.mjs +0 -38
  322. package/dist/lib/node-esm/capability-R5O2OYX4.mjs.map +0 -7
  323. package/dist/lib/node-esm/capability-SA6LPYGL.mjs.map +0 -7
  324. package/dist/lib/node-esm/chunk-3D66SZHP.mjs.map +0 -7
  325. package/dist/lib/node-esm/chunk-6REV5DE7.mjs.map +0 -7
  326. package/dist/lib/node-esm/chunk-FHWPWQRJ.mjs +0 -704
  327. package/dist/lib/node-esm/chunk-FHWPWQRJ.mjs.map +0 -7
  328. package/dist/lib/node-esm/chunk-JHFY3HTS.mjs.map +0 -7
  329. package/dist/lib/node-esm/chunk-JIVXIJ2T.mjs +0 -825
  330. package/dist/lib/node-esm/chunk-JIVXIJ2T.mjs.map +0 -7
  331. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs +0 -35
  332. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs.map +0 -7
  333. package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
  334. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs +0 -45
  335. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs.map +0 -7
  336. package/dist/lib/node-esm/chunk-SQICGJBW.mjs.map +0 -7
  337. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
  338. package/dist/lib/node-esm/invoker-capability-3YDIVDWV.mjs +0 -37
  339. package/dist/lib/node-esm/invoker-capability-3YDIVDWV.mjs.map +0 -7
  340. package/dist/types/src/common/operations.d.ts +0 -33
  341. package/dist/types/src/common/operations.d.ts.map +0 -1
  342. package/dist/types/src/plugin-operation/OperationPlugin.d.ts +0 -3
  343. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +0 -1
  344. package/dist/types/src/plugin-operation/history/capability.d.ts.map +0 -1
  345. package/dist/types/src/plugin-operation/history/errors.d.ts +0 -5
  346. package/dist/types/src/plugin-operation/history/errors.d.ts.map +0 -1
  347. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +0 -18
  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 +0 -3
  360. package/dist/types/src/plugin-operation/meta.d.ts.map +0 -1
  361. package/dist/types/src/plugin-operation/testing.d.ts +0 -109
  362. package/dist/types/src/plugin-operation/testing.d.ts.map +0 -1
  363. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +0 -3
  364. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +0 -1
  365. package/dist/types/src/plugin-runtime/capability.d.ts +0 -6
  366. package/dist/types/src/plugin-runtime/capability.d.ts.map +0 -1
  367. package/dist/types/src/plugin-runtime/index.d.ts +0 -2
  368. package/dist/types/src/plugin-runtime/index.d.ts.map +0 -1
  369. package/dist/types/src/plugin-runtime/meta.d.ts +0 -3
  370. package/dist/types/src/plugin-runtime/meta.d.ts.map +0 -1
  371. package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
  372. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
  373. package/src/common/operations.ts +0 -38
  374. package/src/plugin-operation/OperationPlugin.ts +0 -25
  375. package/src/plugin-operation/history/errors.ts +0 -11
  376. package/src/plugin-operation/invoker-capability.ts +0 -40
  377. package/src/plugin-operation/meta.ts +0 -11
  378. package/src/plugin-runtime/RuntimePlugin.ts +0 -20
  379. package/src/plugin-runtime/capability.ts +0 -53
  380. package/src/plugin-runtime/index.ts +0 -5
  381. package/src/plugin-runtime/meta.ts +0 -11
  382. package/src/ui/hooks/useOperationResolver.ts +0 -40
  383. /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
  384. /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
  385. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/capability.d.ts +0 -0
  386. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.d.ts +0 -0
  387. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/index.d.ts +0 -0
  388. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.d.ts +0 -0
  389. /package/src/{plugin-operation → plugin-process-manager}/history/index.ts +0 -0
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
2
  import {
3
3
  getModuleTag
4
- } from "./chunk-SB5ODNPX.mjs";
4
+ } from "./chunk-CTKEZHKF.mjs";
5
5
  import {
6
6
  __export
7
7
  } from "./chunk-HSLMI22Q.mjs";
@@ -9,27 +9,37 @@ import {
9
9
  // src/core/plugin.ts
10
10
  var plugin_exports = {};
11
11
  __export(plugin_exports, {
12
+ LazyPluginError: () => LazyPluginError,
13
+ PluginDependencyError: () => PluginDependencyError,
12
14
  PluginModuleTypeId: () => PluginModuleTypeId,
13
15
  PluginTypeId: () => PluginTypeId,
14
16
  Service: () => Service,
15
17
  activate: () => activate,
16
18
  addModule: () => addModule,
17
19
  define: () => define,
20
+ isLazy: () => isLazy,
18
21
  isPlugin: () => isPlugin,
19
22
  isPluginModule: () => isPluginModule,
23
+ lazy: () => lazy,
20
24
  make: () => make,
21
- reset: () => reset
25
+ makeMeta: () => makeMeta,
26
+ reset: () => reset,
27
+ resolveLazy: () => resolveLazy,
28
+ shutdown: () => shutdown
22
29
  });
23
30
  import * as Context from "effect/Context";
24
31
  import * as Effect from "effect/Effect";
25
32
  import * as Option from "effect/Option";
26
33
  import * as Pipeable from "effect/Pipeable";
34
+ import { BaseError } from "@dxos/errors";
27
35
  import { invariant } from "@dxos/invariant";
36
+ import { DXN } from "@dxos/keys";
28
37
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin.ts";
29
38
  var Service = class extends Context.Tag("@dxos/app-framework/PluginManager")() {
30
39
  };
31
40
  var activate = (event) => Effect.flatMap(Service, (manager) => manager.activate(event));
32
41
  var reset = (event) => Effect.flatMap(Service, (manager) => manager.reset(event));
42
+ var shutdown = () => Effect.flatMap(Service, (manager) => manager.shutdown());
33
43
  var computeModuleId = (pluginId, moduleName) => {
34
44
  return `${pluginId}.module.${moduleName}`;
35
45
  };
@@ -41,17 +51,22 @@ var PluginModuleImpl = class {
41
51
  [PluginModuleTypeId] = PluginModuleTypeId;
42
52
  id;
43
53
  activatesOn;
44
- activatesBefore;
45
- activatesAfter;
54
+ firesBeforeActivation;
55
+ firesAfterActivation;
46
56
  activate;
47
57
  constructor(options) {
48
58
  this.id = options.id;
49
59
  this.activatesOn = options.activatesOn;
50
- this.activatesBefore = options.activatesBefore;
51
- this.activatesAfter = options.activatesAfter;
60
+ this.firesBeforeActivation = options.firesBeforeActivation;
61
+ this.firesAfterActivation = options.firesAfterActivation;
52
62
  this.activate = options.activate;
53
63
  }
54
64
  };
65
+ var makeMeta = (options) => ({
66
+ ...options,
67
+ id: DXN.getName(options.key),
68
+ version: DXN.getVersion(options.key)
69
+ });
55
70
  var PluginTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Plugin");
56
71
  var isPlugin = (value) => {
57
72
  return typeof value === "object" && value !== null && PluginTypeId in value;
@@ -98,21 +113,14 @@ function addModule(moduleOptionsOrBuilder, moduleOptions) {
98
113
  }
99
114
  var resolveModule = (meta, module, options) => {
100
115
  const moduleOptions = typeof module === "function" ? module(options) : module;
116
+ const pluginName = meta.id;
101
117
  const id = Option.fromNullable(moduleOptions.id).pipe(Option.match({
102
118
  onNone: () => {
103
119
  const exportName = getModuleTag(moduleOptions.activate);
104
- invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`, {
105
- F: __dxlog_file,
106
- L: 301,
107
- S: void 0,
108
- A: [
109
- "exportName",
110
- "`Plugin module missing name. Plugin: ${meta.id}`"
111
- ]
112
- });
113
- return computeModuleId(meta.id, exportName);
120
+ invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 148, S: void 0, A: ["exportName", "`Plugin module missing name. Plugin: ${meta.id}`"] });
121
+ return computeModuleId(pluginName, exportName);
114
122
  },
115
- onSome: (id2) => computeModuleId(meta.id, id2)
123
+ onSome: (id2) => computeModuleId(pluginName, id2)
116
124
  }));
117
125
  return new PluginModuleImpl({
118
126
  ...moduleOptions,
@@ -121,6 +129,7 @@ var resolveModule = (meta, module, options) => {
121
129
  };
122
130
  function make(builder) {
123
131
  const meta = builder.meta;
132
+ invariant(!meta.dependsOn?.includes(meta.id), `Plugin ${meta.id} declares itself as a dependency.`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 161, S: this, A: ["!meta.dependsOn?.includes(meta.id)", "`Plugin ${meta.id} declares itself as a dependency.`"] });
124
133
  const factory = (options) => {
125
134
  const modules = builder.modules.map((module) => resolveModule(meta, module, options));
126
135
  return new PluginImpl(meta, modules);
@@ -129,18 +138,91 @@ function make(builder) {
129
138
  meta
130
139
  });
131
140
  }
141
+ var LazyTag = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Plugin/Lazy");
142
+ var lazy = (meta, loader) => {
143
+ const factory = (options) => {
144
+ const stub = new PluginImpl(meta, []);
145
+ Object.defineProperty(stub, LazyTag, {
146
+ value: {
147
+ loader,
148
+ options
149
+ },
150
+ enumerable: false
151
+ });
152
+ return stub;
153
+ };
154
+ return Object.assign(factory, {
155
+ meta
156
+ });
157
+ };
158
+ var isLazy = (plugin) => LazyTag in plugin;
159
+ var LazyPluginError = class extends BaseError.extend("LazyPluginError", "Failed to resolve lazy plugin") {
160
+ };
161
+ var PluginDependencyError = class extends BaseError.extend("PluginDependencyError", "Plugin dependency resolution failed") {
162
+ };
163
+ var resolveLazy = (plugin) => Effect.gen(function* () {
164
+ if (!isLazy(plugin)) {
165
+ return plugin;
166
+ }
167
+ const id = plugin.meta.id;
168
+ const { loader, options } = plugin[LazyTag];
169
+ const mod = yield* Effect.tryPromise({
170
+ try: loader,
171
+ catch: (error) => new LazyPluginError({
172
+ context: {
173
+ id,
174
+ reason: "load-failed"
175
+ },
176
+ cause: error
177
+ })
178
+ });
179
+ if (!mod || typeof mod.default !== "function") {
180
+ return yield* Effect.fail(new LazyPluginError({
181
+ context: {
182
+ id,
183
+ reason: "missing-default"
184
+ }
185
+ }));
186
+ }
187
+ const result = mod.default(options);
188
+ if (!isPlugin(result)) {
189
+ return yield* Effect.fail(new LazyPluginError({
190
+ context: {
191
+ id,
192
+ reason: "invalid-plugin"
193
+ }
194
+ }));
195
+ }
196
+ if (result.meta.id !== id) {
197
+ return yield* Effect.fail(new LazyPluginError({
198
+ context: {
199
+ id,
200
+ reason: "meta-mismatch",
201
+ returnedId: result.meta.id
202
+ }
203
+ }));
204
+ }
205
+ return result;
206
+ });
132
207
 
133
208
  export {
134
209
  Service,
135
210
  activate,
136
211
  reset,
212
+ shutdown,
137
213
  PluginModuleTypeId,
138
214
  isPluginModule,
215
+ makeMeta,
139
216
  PluginTypeId,
140
217
  isPlugin,
141
218
  define,
142
219
  addModule,
143
220
  make,
221
+ lazy,
222
+ isLazy,
223
+ LazyPluginError,
224
+ PluginDependencyError,
225
+ resolveLazy,
144
226
  plugin_exports
145
227
  };
146
- //# sourceMappingURL=chunk-JHFY3HTS.mjs.map
228
+ //# sourceMappingURL=chunk-XIGPWXCQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/plugin.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nimport { BaseError } from '@dxos/errors';\nimport { invariant } from '@dxos/invariant';\nimport { DXN } from '@dxos/keys';\n\nimport type * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport type * as PluginManager from './plugin-manager';\n\n//\n// Plugin Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing PluginManager via the Effect layer system.\n * This allows lifecycle operations to access the plugin manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/PluginManager')<Service, PluginManager.PluginManager>() {}\n\n//\n// Lifecycle Functions\n//\n\n/**\n * Activates plugins based on the activation event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\nexport const activate = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.activate(event));\n\n/**\n * Re-activates the modules that were activated by the event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\nexport const reset = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.reset(event));\n\n/**\n * Shuts down the plugin manager, deactivating all active modules and clearing lifecycle state.\n * Accesses the PluginManager via the Effect layer system.\n */\nexport const shutdown = (): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.shutdown());\n\n/**\n * Computes a module ID from plugin ID and export name.\n */\nconst computeModuleId = (pluginId: string, moduleName: string): string => {\n return `${pluginId}.module.${moduleName}`;\n};\n\n/**\n * Identifier denoting a PluginModule.\n */\nexport const PluginModuleTypeId: unique symbol = Symbol.for('@dxos/app-framework/PluginModule');\nexport type PluginModuleTypeId = typeof PluginModuleTypeId;\n\n/**\n * Type guard to check if a value is a PluginModule.\n */\nexport const isPluginModule = (value: unknown): value is PluginModule => {\n return typeof value === 'object' && value !== null && PluginModuleTypeId in value;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\nexport interface PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId;\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvent.Events;\n\n /**\n * Events that this module fires *before* its own activation runs.\n *\n * When this module is asked to activate (via {@link activatesOn}), the\n * plugin manager first activates every event listed here, ensuring any\n * other modules that contribute to those events have completed before\n * this module's {@link activate} body executes. These events are fired\n * by the framework on this module's behalf — the module does not need\n * to wait for some other code to fire them.\n *\n * The module is marked as needing reset if a module activated by one\n * of these events is later removed.\n *\n * Read as: \"this module fires these events before [its] activation\".\n */\n firesBeforeActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Events that this module fires *after* its own activation completes.\n *\n * Once this module's {@link activate} body has finished executing, the\n * plugin manager activates every event listed here, causing any modules\n * listening on those events to run. These events are fired by the\n * framework on this module's behalf as part of this module's lifecycle.\n *\n * Read as: \"this module fires these events after [its] activation\".\n */\n firesAfterActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * CapabilityManager is accessed via the Effect layer system (Capability.Service).\n * PluginManager is accessed via Plugin.Service.\n * @param props Optional props passed to the module.\n * @returns The capabilities of the module.\n */\n activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;\n}\n\nexport type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & { id?: string };\n\nclass PluginModuleImpl implements PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId = PluginModuleTypeId;\n readonly id: PluginModule['id'];\n readonly activatesOn: PluginModule['activatesOn'];\n readonly firesBeforeActivation?: PluginModule['firesBeforeActivation'];\n readonly firesAfterActivation?: PluginModule['firesAfterActivation'];\n readonly activate: PluginModule['activate'];\n\n constructor(options: Omit<PluginModule, typeof PluginModuleTypeId>) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.firesBeforeActivation = options.firesBeforeActivation;\n this.firesAfterActivation = options.firesAfterActivation;\n this.activate = options.activate;\n }\n}\n\nexport type Meta = {\n /**\n * Bare NSID (the name portion of {@link key}, e.g. `org.dxos.plugin.example`).\n * Stable across versions; used for module-id namespacing, i18n namespaces,\n * enable/disable, and registry lookups. Derived from `key` by {@link makeMeta} —\n * do not set directly.\n */\n id: string;\n\n /**\n * Canonical identity DXN, including version when published\n * (e.g. `dxn:org.dxos.plugin.example:0.8.3`). The validated source of truth\n * from which {@link id} and {@link version} are derived.\n *\n * @example DXN.make('org.dxos.plugin.example', '0.8.3')\n */\n key: DXN.DXN;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Semver version string of the plugin, typically the publishing package's\n * `package.json` version. Derived from the version segment of {@link key} by\n * {@link makeMeta} — do not set directly.\n */\n version?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Name of the author or organization that created the plugin.\n */\n // TODO(burdon): DID or domain name?\n author?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * Relative path (inside the published package) to the plugin's bundled MDL\n * specification file — e.g. `'PLUGIN.mdl'` or `'docs/PLUGIN.mdl'`. The file\n * is shipped via the package's `files` entry and resolved by registry\n * surfaces to render an in-app viewer and/or external link.\n */\n spec?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n\n /**\n * Icon hue (ChromaticPalette).\n */\n iconHue?: string;\n\n /**\n * IDs of plugins this plugin functionally depends on.\n *\n * Treated as a convenience by the default `PluginManager` flow:\n * - Enabling this plugin auto-enables the transitive closure of `dependsOn`\n * (installing missing entries from the plugin registry when possible).\n * - Disabling a depended-upon plugin surfaces dependents to the caller; the\n * `PluginManager.disable` API supports an opt-in cascade.\n *\n * Not an invariant: low-level `PluginManager` APIs accept opt-outs\n * (`resolveDependencies: false`, `ignoreDependents: true`) so a caller may\n * substitute an alternative implementation that satisfies the dependent's\n * capability needs in its own way.\n */\n dependsOn?: string[];\n};\n\n/**\n * Options for {@link makeMeta}: a {@link Meta} minus the fields derived from `key`.\n * Identity and version are specified solely through the `key` DXN — `id` and\n * `version` cannot be passed directly.\n */\nexport type MakeMetaOptions = Omit<Meta, 'id' | 'version'>;\n\n/**\n * Constructs a plugin {@link Meta} from a single canonical DXN. The `key` DXN is\n * the one source of truth; `id` (bare NSID) and `version` (semver) are derived\n * from it so each datum has exactly one home and cannot drift out of sync.\n *\n * @example\n * export const meta = Plugin.makeMeta({\n * key: DXN.make('org.dxos.plugin.example', '0.8.3'),\n * name: 'Example',\n * });\n */\nexport const makeMeta = (options: MakeMetaOptions): Meta => ({\n ...options,\n id: DXN.getName(options.key),\n version: DXN.getVersion(options.key),\n});\n\n/**\n * Identifier denoting a Plugin.\n */\nexport const PluginTypeId: unique symbol = Symbol.for('@dxos/app-framework/Plugin');\nexport type PluginTypeId = typeof PluginTypeId;\n\n/**\n * Type guard to check if a value is a Plugin.\n */\nexport const isPlugin = (value: unknown): value is Plugin => {\n return typeof value === 'object' && value !== null && PluginTypeId in value;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\n// TODO(burdon): Convert to ECHO schema.\nexport interface Plugin {\n readonly [PluginTypeId]: PluginTypeId;\n readonly meta: Readonly<Meta>;\n readonly modules: ReadonlyArray<PluginModule>;\n}\n\n/**\n * Internal implementation of Plugin.\n * @internal\n */\nclass PluginImpl implements Plugin {\n readonly [PluginTypeId]: PluginTypeId = PluginTypeId;\n\n constructor(\n private readonly _meta: Meta,\n private readonly _modules: PluginModule[],\n ) {}\n\n get meta(): Readonly<Meta> {\n return this._meta;\n }\n\n get modules(): ReadonlyArray<PluginModule> {\n return this._modules;\n }\n}\n\n/**\n * Builder interface for creating plugins incrementally.\n */\nexport interface PluginBuilder<T = void> extends Pipeable.Pipeable {\n readonly meta: Meta;\n readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;\n}\n\n/**\n * Builder implementation for creating plugins incrementally.\n */\nclass PluginBuilderImpl<T = void> implements PluginBuilder<T> {\n readonly meta: Meta;\n private readonly _modules: Array<PluginModuleOptions | ((options: T) => PluginModuleOptions)> = [];\n\n constructor(meta: Meta) {\n this.meta = meta;\n }\n\n get modules(): ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)> {\n return this._modules;\n }\n\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T> {\n this._modules.push(moduleOptions);\n return this;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new PluginBuilder to start building a plugin.\n */\nexport const define = <T = void>(meta: Meta): PluginBuilder<T> => new PluginBuilderImpl<T>(meta);\n\n/**\n * Adds a module to a plugin builder.\n * Supports both pipeline and direct call styles.\n * Modules can be either PluginModuleOptions or functions that receive options.\n */\nexport function addModule<T>(\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): (builder: PluginBuilder<T>) => PluginBuilder<T>;\nexport function addModule<T>(\n builder: PluginBuilder<T>,\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): PluginBuilder<T>;\nexport function addModule<T>(\n moduleOptionsOrBuilder: PluginModuleOptions | ((options: T) => PluginModuleOptions) | PluginBuilder<T>,\n moduleOptions?: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): ((builder: PluginBuilder<T>) => PluginBuilder<T>) | PluginBuilder<T> {\n // If second arg is provided, it's the direct call style: addModule(builder, moduleOptions)\n if (moduleOptions !== undefined) {\n return (moduleOptionsOrBuilder as PluginBuilder<T>).addModule(moduleOptions);\n }\n // Otherwise it's pipeline style: addModule(moduleOptions) returns a function\n const moduleOpts = moduleOptionsOrBuilder as PluginModuleOptions | ((options: T) => PluginModuleOptions);\n return (builder: PluginBuilder<T>) => builder.addModule(moduleOpts);\n}\n\nexport type PluginFactory<T = void> = ((options: T) => Plugin) & { meta: Meta };\n\n/**\n * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.\n */\nconst resolveModule = (\n meta: Meta,\n module: PluginModuleOptions | ((options: any) => PluginModuleOptions),\n options?: any,\n): PluginModuleImpl => {\n const moduleOptions = typeof module === 'function' ? module(options) : module;\n const pluginName = meta.id;\n const id = Option.fromNullable(moduleOptions.id).pipe(\n Option.match({\n onNone: () => {\n const exportName = Capability.getModuleTag(moduleOptions.activate);\n invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`);\n return computeModuleId(pluginName, exportName);\n },\n onSome: (id) => computeModuleId(pluginName, id),\n }),\n );\n return new PluginModuleImpl({ ...moduleOptions, id });\n};\n\n/**\n * Creates a Plugin from a builder.\n * Supports both pipeline and direct call styles.\n * Always returns a factory function (options: T) => Plugin.\n * When T is void, the function takes no arguments: () => Plugin.\n */\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {\n const meta = builder.meta;\n // `dependsOn` entries and `id` are both bare NSIDs, so compare directly.\n invariant(!meta.dependsOn?.includes(meta.id), `Plugin ${meta.id} declares itself as a dependency.`);\n\n const factory = (options: T) => {\n const modules = builder.modules.map((module) => resolveModule(meta, module, options));\n return new PluginImpl(meta, modules);\n };\n\n return Object.assign(factory, { meta });\n}\n\n//\n// Lazy plugin loading\n//\n\n/**\n * Symbol used to tag lazy plugin stubs with their loader closure.\n * Hidden from enumeration so plugin manager iteration / serialization paths\n * don't trip over it.\n */\nconst LazyTag: unique symbol = Symbol.for('@dxos/app-framework/Plugin/Lazy');\n\n/**\n * Async loader for a lazy plugin's real implementation.\n * The default export of the loaded module must be a `PluginFactory<T>` —\n * i.e. the same shape `Plugin.make` produces.\n */\nexport type LazyLoader<T = void> = () => Promise<{ default: PluginFactory<T> }>;\n\n/** Internal: payload carried on a lazy stub. */\ntype LazyPayload = { loader: LazyLoader<any>; options: unknown };\n\n/**\n * Defines a lazy plugin whose body is loaded on first enable.\n *\n * The returned factory produces a stub `Plugin` that exposes `meta`\n * synchronously (so callers can read `Plugin.meta.id` for free) but defers\n * loading the real plugin's modules until the manager calls\n * `Plugin.resolveLazy`. This lets the plugin's main entry point ship as a\n * tiny meta-only chunk — the heavy capabilities, schema, React surfaces,\n * etc. live behind the dynamic `import()` and become a separate Rollup\n * chunk that is only fetched when the plugin is enabled.\n *\n * @example\n * ```ts\n * // plugin-markdown/src/index.ts\n * import { Plugin } from '@dxos/app-framework';\n * import { meta } from './meta';\n *\n * export const MarkdownPlugin = Plugin.lazy(meta, () => import('./MarkdownPlugin'));\n *\n * // plugin-markdown/src/MarkdownPlugin.tsx\n * export const MarkdownPlugin = Plugin.define(meta).pipe(...heavy modules..., Plugin.make);\n * export default MarkdownPlugin;\n * ```\n */\nexport const lazy = <T = void>(meta: Meta, loader: LazyLoader<T>): PluginFactory<T> => {\n const factory = (options: T): Plugin => {\n const stub = new PluginImpl(meta, []);\n Object.defineProperty(stub, LazyTag, {\n value: { loader, options } satisfies LazyPayload,\n enumerable: false,\n });\n return stub;\n };\n return Object.assign(factory, { meta });\n};\n\n/**\n * Type guard for lazy plugin stubs produced by {@link lazy}.\n */\nexport const isLazy = (plugin: Plugin): boolean => LazyTag in plugin;\n\n/**\n * Tagged error for failures during lazy plugin resolution. `context.id` is\n * the lazy plugin's `meta.id`; `context.reason` discriminates the failure\n * mode (`'load-failed' | 'missing-default' | 'invalid-plugin' |\n * 'meta-mismatch'`) so callers can route on it.\n */\nexport class LazyPluginError extends BaseError.extend('LazyPluginError', 'Failed to resolve lazy plugin') {}\n\n/**\n * Tagged error for plugin-level dependency resolution failures.\n *\n * `context.id` is the plugin id the manager was acting on. `context.reason`\n * discriminates the failure mode:\n * - `'missing'` — declared dep is neither registered nor in the catalog.\n * `context.missing` lists offending ids.\n * - `'install-failed'` — dep was found in the catalog but `add()` failed.\n * `cause` carries the original error.\n * - `'cycle'` — closure walk detected a cycle. `context.path` is the cycle path.\n * - `'core-dependent'` — cascade-disable would have to disable a core plugin.\n * `context.coreDependent` is the blocking id.\n */\nexport class PluginDependencyError extends BaseError.extend(\n 'PluginDependencyError',\n 'Plugin dependency resolution failed',\n) {}\n\n/**\n * Resolves a lazy plugin stub to its real plugin.\n * Returns the plugin unchanged if it is not lazy. Failures surface as\n * {@link LazyPluginError} with `context.reason` indicating the failure mode\n * and (for loader failures) `cause` set to the original error.\n */\nexport const resolveLazy = (plugin: Plugin): Effect.Effect<Plugin, LazyPluginError> =>\n Effect.gen(function* () {\n if (!isLazy(plugin)) {\n return plugin;\n }\n const id = plugin.meta.id;\n const { loader, options } = (plugin as unknown as { [LazyTag]: LazyPayload })[LazyTag];\n const mod = yield* Effect.tryPromise({\n try: loader,\n catch: (error) => new LazyPluginError({ context: { id, reason: 'load-failed' }, cause: error }),\n });\n if (!mod || typeof mod.default !== 'function') {\n return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'missing-default' } }));\n }\n const result = mod.default(options);\n if (!isPlugin(result)) {\n return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'invalid-plugin' } }));\n }\n if (result.meta.id !== id) {\n return yield* Effect.fail(\n new LazyPluginError({ context: { id, reason: 'meta-mismatch', returnedId: result.meta.id } }),\n );\n }\n return result;\n });\n"],
5
+ "mappings": "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",
6
+ "names": ["Context", "Effect", "Option", "Pipeable", "BaseError", "invariant", "DXN", "PluginModuleImpl", "id", "activatesOn", "firesBeforeActivation", "firesAfterActivation", "activate", "getName", "options", "version", "_meta", "_modules", "meta", "modules", "addModule", "moduleOptions", "pipe", "undefined", "pluginName", "fromNullable", "Option", "onNone", "exportName", "Capability", "getModuleTag", "invariant", "onSome", "computeModuleId", "dependsOn", "builder", "map", "module", "resolveModule", "PluginImpl", "Object", "assign", "factory", "stub", "defineProperty", "value", "loader", "enumerable", "plugin", "mod", "Effect", "try", "catch", "error", "LazyPluginError", "reason", "cause", "context", "result", "fail", "returnedId"]
7
+ }
@@ -14,13 +14,14 @@ __export(activation_event_exports, {
14
14
  make: () => make,
15
15
  oneOf: () => oneOf
16
16
  });
17
+ import { compositeKey } from "@dxos/util";
17
18
  var make = (id, specifier) => {
18
19
  return {
19
20
  id,
20
21
  specifier
21
22
  };
22
23
  };
23
- var eventKey = (event) => event.specifier ? `${event.id}:${event.specifier}` : event.id;
24
+ var eventKey = (event) => event.specifier ? compositeKey(event.id, event.specifier) : event.id;
24
25
  var oneOf = (...events) => ({
25
26
  type: "one-of",
26
27
  events
@@ -45,4 +46,4 @@ export {
45
46
  getEvents,
46
47
  activation_event_exports
47
48
  };
48
- //# sourceMappingURL=chunk-6REV5DE7.mjs.map
49
+ //# sourceMappingURL=chunk-XOCUANHO.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/activation-event.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { compositeKey } from '@dxos/util';\n\n/**\n * A unique string identifier representing an event.\n * This is expected to be a URI, where initial parts are often the id of the plugin whose package defines the event.\n *\n * @example org.dxos.plugin.example.event.ready\n */\nexport type ActivationEvent = {\n id: string;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type Events =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event.\n */\nexport const make = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\n};\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) =>\n event.specifier ? compositeKey(event.id, event.specifier) : event.id;\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: Events): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: Events): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: Events) => ('type' in events ? events.events : [events]);\n"],
5
+ "mappings": ";;;;;;AAAA;;;;;;;;;;AAIA,SAASA,oBAAoB;AAwBtB,IAAMC,OAAO,CAACC,IAAYC,cAAAA;AAC/B,SAAO;IAAED;IAAIC;EAAU;AACzB;AAKO,IAAMC,WAAW,CAACC,UACvBA,MAAMF,YAAYH,aAAaK,MAAMH,IAAIG,MAAMF,SAAS,IAAIE,MAAMH;AAK7D,IAAMI,QAAQ,IAAIC,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAME,QAAQ,IAAIF,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAMG,UAAU,CAACH,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMG,UAAU,CAACJ,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMI,YAAY,CAACL,WAAoB,UAAUA,SAASA,OAAOA,SAAS;EAACA;;",
6
+ "names": ["compositeKey", "make", "id", "specifier", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents"]
7
+ }