@dxos/app-framework 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef

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 (278) hide show
  1. package/dist/lib/browser/{capability-BBBBAPDI.mjs → capability-Q5XRXRD2.mjs} +10 -10
  2. package/dist/lib/browser/{capability-OP63CD5N.mjs → capability-V7LR4LQN.mjs} +11 -11
  3. package/dist/lib/browser/capability-V7LR4LQN.mjs.map +7 -0
  4. package/dist/lib/browser/{chunk-T3Y4AEKX.mjs → chunk-23D4SJUE.mjs} +3 -3
  5. package/dist/lib/browser/{chunk-T3Y4AEKX.mjs.map → chunk-23D4SJUE.mjs.map} +1 -1
  6. package/dist/lib/browser/{chunk-2CKCJ6PN.mjs → chunk-3JWJXGLK.mjs} +1 -1
  7. package/dist/lib/browser/{chunk-2CKCJ6PN.mjs.map → chunk-3JWJXGLK.mjs.map} +1 -1
  8. package/dist/lib/browser/{chunk-GX4TUNM6.mjs → chunk-3ZS2A3DN.mjs} +170 -226
  9. package/dist/lib/browser/chunk-3ZS2A3DN.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-I34GF4NG.mjs → chunk-45CHLTBV.mjs} +2 -2
  11. package/dist/lib/browser/chunk-5LAIGWLU.mjs +467 -0
  12. package/dist/lib/browser/chunk-5LAIGWLU.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-QSXYHXCE.mjs → chunk-66IXTIVK.mjs} +1 -1
  14. package/dist/lib/browser/{chunk-QSXYHXCE.mjs.map → chunk-66IXTIVK.mjs.map} +2 -2
  15. package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
  16. package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
  17. package/dist/lib/browser/chunk-G7SDBRKH.mjs +1 -0
  18. package/dist/lib/browser/chunk-JXCBZSBJ.mjs +372 -0
  19. package/dist/lib/browser/chunk-JXCBZSBJ.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
  21. package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
  22. package/dist/lib/browser/{chunk-JKWMHZP6.mjs → chunk-WBHCSOBW.mjs} +2 -2
  23. package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
  24. package/dist/lib/browser/{chunk-FU4GAFUQ.mjs → chunk-Z55LVAGN.mjs} +80 -15
  25. package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
  26. package/dist/lib/browser/{chunk-F7FW2RK2.mjs → chunk-ZGJAZSNE.mjs} +7 -32
  27. package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
  28. package/dist/lib/browser/cli/index.mjs +11 -27
  29. package/dist/lib/browser/cli/index.mjs.map +2 -2
  30. package/dist/lib/browser/common/activation-events.mjs +7 -7
  31. package/dist/lib/browser/common/capabilities.mjs +7 -7
  32. package/dist/lib/browser/core/activation-event.mjs +1 -1
  33. package/dist/lib/browser/core/capability.mjs +1 -1
  34. package/dist/lib/browser/core/plugin-manager.mjs +6 -4
  35. package/dist/lib/browser/core/plugin.mjs +10 -2
  36. package/dist/lib/browser/core/url-loader.mjs +13 -5
  37. package/dist/lib/browser/index.mjs +22 -18
  38. package/dist/lib/browser/index.mjs.map +3 -3
  39. package/dist/lib/browser/{invoker-capability-H5PPENOC.mjs → invoker-capability-LNX4CGIV.mjs} +12 -11
  40. package/dist/lib/browser/invoker-capability-LNX4CGIV.mjs.map +7 -0
  41. package/dist/lib/browser/meta.json +1 -1
  42. package/dist/lib/browser/testing/index.mjs +144 -27
  43. package/dist/lib/browser/testing/index.mjs.map +4 -4
  44. package/dist/lib/browser/testing/react.mjs +78 -0
  45. package/dist/lib/browser/testing/react.mjs.map +7 -0
  46. package/dist/lib/browser/ui/index.mjs +18 -14
  47. package/dist/lib/node-esm/{capability-AWBEMRYR.mjs → capability-EW5GJCI6.mjs} +10 -10
  48. package/dist/lib/node-esm/{capability-WFEG6CIZ.mjs → capability-YKBMMD53.mjs} +11 -11
  49. package/dist/lib/node-esm/capability-YKBMMD53.mjs.map +7 -0
  50. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
  51. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
  52. package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs → chunk-6XW6LET6.mjs} +2 -2
  53. package/dist/lib/node-esm/{chunk-URWHJQT2.mjs → chunk-D347W3KO.mjs} +7 -32
  54. package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
  55. package/dist/lib/node-esm/chunk-D5PO2WXX.mjs +373 -0
  56. package/dist/lib/node-esm/chunk-D5PO2WXX.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-ULUEXB7Q.mjs → chunk-HTBJU5FX.mjs} +80 -15
  58. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-KM2F6GH6.mjs +468 -0
  60. package/dist/lib/node-esm/chunk-KM2F6GH6.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs → chunk-OZ7DZA5Z.mjs} +1 -1
  62. package/dist/lib/node-esm/{chunk-BCEOLX47.mjs → chunk-Q7XBFII4.mjs} +170 -226
  63. package/dist/lib/node-esm/chunk-Q7XBFII4.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs → chunk-SBS2YMPT.mjs} +3 -3
  65. package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs.map → chunk-SBS2YMPT.mjs.map} +1 -1
  66. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs → chunk-SDJ4B2LU.mjs} +1 -1
  67. package/dist/lib/node-esm/{chunk-42KBWDE4.mjs.map → chunk-SDJ4B2LU.mjs.map} +1 -1
  68. package/dist/lib/node-esm/{chunk-G3RTFSNG.mjs → chunk-WFSRZKBP.mjs} +2 -2
  69. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
  71. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
  72. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs → chunk-XOCUANHO.mjs} +1 -1
  73. package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs.map → chunk-XOCUANHO.mjs.map} +2 -2
  74. package/dist/lib/node-esm/cli/index.mjs +11 -27
  75. package/dist/lib/node-esm/cli/index.mjs.map +2 -2
  76. package/dist/lib/node-esm/common/activation-events.mjs +7 -7
  77. package/dist/lib/node-esm/common/capabilities.mjs +7 -7
  78. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  79. package/dist/lib/node-esm/core/capability.mjs +1 -1
  80. package/dist/lib/node-esm/core/plugin-manager.mjs +6 -4
  81. package/dist/lib/node-esm/core/plugin.mjs +10 -2
  82. package/dist/lib/node-esm/core/url-loader.mjs +13 -5
  83. package/dist/lib/node-esm/index.mjs +22 -18
  84. package/dist/lib/node-esm/index.mjs.map +3 -3
  85. package/dist/lib/node-esm/{invoker-capability-S3ZA527J.mjs → invoker-capability-O4T5PHLA.mjs} +12 -11
  86. package/dist/lib/node-esm/invoker-capability-O4T5PHLA.mjs.map +7 -0
  87. package/dist/lib/node-esm/meta.json +1 -1
  88. package/dist/lib/node-esm/testing/index.mjs +144 -27
  89. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  90. package/dist/lib/node-esm/testing/react.mjs +79 -0
  91. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  92. package/dist/lib/node-esm/ui/index.mjs +18 -14
  93. package/dist/plugin/node-esm/index.mjs +480 -32
  94. package/dist/plugin/node-esm/index.mjs.map +4 -4
  95. package/dist/plugin/node-esm/meta.json +1 -1
  96. package/dist/types/src/common/capabilities.d.ts +2 -1
  97. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  98. package/dist/types/src/common/operations.d.ts +1 -1
  99. package/dist/types/src/common/operations.d.ts.map +1 -1
  100. package/dist/types/src/core/activation-event.d.ts +4 -4
  101. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  102. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  103. package/dist/types/src/core/capability.d.ts +2 -2
  104. package/dist/types/src/core/capability.d.ts.map +1 -1
  105. package/dist/types/src/core/index.d.ts +2 -0
  106. package/dist/types/src/core/index.d.ts.map +1 -1
  107. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  108. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  109. package/dist/types/src/core/plugin-manager.d.ts +51 -2
  110. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  111. package/dist/types/src/core/plugin-manifest.d.ts +76 -0
  112. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  113. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  114. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  115. package/dist/types/src/core/plugin.d.ts +107 -6
  116. package/dist/types/src/core/plugin.d.ts.map +1 -1
  117. package/dist/types/src/core/url-loader.d.ts +90 -3
  118. package/dist/types/src/core/url-loader.d.ts.map +1 -1
  119. package/dist/types/src/helpers.d.ts.map +1 -1
  120. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
  121. package/dist/types/src/plugin-operation/history/errors.d.ts +6 -6
  122. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
  123. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
  124. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
  125. package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
  126. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
  127. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
  128. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  129. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
  130. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
  131. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  132. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
  133. package/dist/types/src/plugin-operation/testing.d.ts +2 -1
  134. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
  135. package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
  136. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  137. package/dist/types/src/testing/harness.d.ts +67 -0
  138. package/dist/types/src/testing/harness.d.ts.map +1 -0
  139. package/dist/types/src/testing/index.d.ts +1 -0
  140. package/dist/types/src/testing/index.d.ts.map +1 -1
  141. package/dist/types/src/testing/react.d.ts +27 -0
  142. package/dist/types/src/testing/react.d.ts.map +1 -0
  143. package/dist/types/src/testing/react.test.d.ts +2 -0
  144. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  145. package/dist/types/src/testing/service.d.ts.map +1 -1
  146. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  147. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  148. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  149. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  150. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  151. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  152. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  153. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  154. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  155. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  156. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  157. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  158. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  159. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  160. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
  161. package/dist/types/src/ui/components/Surface/index.d.ts +16 -6
  162. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  163. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  164. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  165. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  166. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  167. package/dist/types/src/ui/components/index.d.ts +1 -0
  168. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  169. package/dist/types/src/ui/hooks/useApp.d.ts +29 -3
  170. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  171. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  172. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  173. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  174. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
  175. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
  176. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +52 -0
  177. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  178. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  179. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  180. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  181. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  182. package/dist/types/src/vite-plugin/index.d.ts +4 -2
  183. package/dist/types/src/vite-plugin/index.d.ts.map +1 -1
  184. package/dist/types/src/vite-plugin/manifest.d.ts +37 -0
  185. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  186. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  187. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  188. package/dist/types/src/vite-plugin/packages.d.ts +10 -4
  189. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
  190. package/dist/types/tsconfig.tsbuildinfo +1 -1
  191. package/moon.yml +1 -0
  192. package/package.json +33 -59
  193. package/src/common/capabilities.ts +2 -1
  194. package/src/common/operations.ts +1 -1
  195. package/src/core/capability.ts +1 -1
  196. package/src/core/index.ts +2 -0
  197. package/src/core/plugin-asset-cache.ts +60 -0
  198. package/src/core/plugin-manager.test.ts +246 -5
  199. package/src/core/plugin-manager.ts +167 -25
  200. package/src/core/plugin-manifest.test.ts +48 -0
  201. package/src/core/plugin-manifest.ts +102 -0
  202. package/src/core/plugin.ts +135 -10
  203. package/src/core/url-loader.test.ts +104 -5
  204. package/src/core/url-loader.ts +226 -37
  205. package/src/plugin-operation/OperationPlugin.ts +2 -2
  206. package/src/plugin-operation/history/capability.ts +1 -1
  207. package/src/plugin-operation/history/history-tracker.test.ts +2 -1
  208. package/src/plugin-operation/history/history-tracker.ts +1 -1
  209. package/src/plugin-operation/history/types.ts +1 -1
  210. package/src/plugin-operation/history/undo-mapping.ts +1 -1
  211. package/src/plugin-operation/history/undo-registry.ts +1 -1
  212. package/src/plugin-operation/invoker-capability.ts +2 -1
  213. package/src/plugin-operation/testing.ts +2 -1
  214. package/src/plugin-runtime/RuntimePlugin.ts +2 -2
  215. package/src/testing/harness.ts +229 -0
  216. package/src/testing/index.ts +1 -0
  217. package/src/testing/react.test.tsx +48 -0
  218. package/src/testing/react.tsx +113 -0
  219. package/src/testing/withPluginManager.stories.tsx +1 -1
  220. package/src/ui/components/App/App.stories.tsx +1 -1
  221. package/src/ui/components/App/App.tsx +25 -2
  222. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  223. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  224. package/src/ui/components/Placeholder/index.ts +5 -0
  225. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +4 -2
  226. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +1 -1
  227. package/src/ui/components/Surface/SurfaceComponent.tsx +83 -46
  228. package/src/ui/components/Surface/index.ts +20 -1
  229. package/src/ui/components/Surface/types.test.ts +126 -0
  230. package/src/ui/components/Surface/types.ts +164 -12
  231. package/src/ui/components/index.ts +1 -0
  232. package/src/ui/hooks/useApp.tsx +165 -41
  233. package/src/ui/hooks/useLoading.tsx +14 -6
  234. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
  235. package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
  236. package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
  237. package/src/vite-plugin/boot-loader/index.ts +112 -0
  238. package/src/vite-plugin/composer/index.ts +277 -0
  239. package/src/vite-plugin/import-map/index.ts +524 -0
  240. package/src/vite-plugin/index.ts +6 -2
  241. package/src/vite-plugin/manifest.test.ts +24 -0
  242. package/src/vite-plugin/manifest.ts +50 -0
  243. package/src/vite-plugin/packages.ts +169 -10
  244. package/tsconfig.json +9 -0
  245. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  246. package/dist/lib/browser/capability-OP63CD5N.mjs.map +0 -7
  247. package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +0 -7
  248. package/dist/lib/browser/chunk-FU4GAFUQ.mjs.map +0 -7
  249. package/dist/lib/browser/chunk-GX4TUNM6.mjs.map +0 -7
  250. package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +0 -7
  251. package/dist/lib/browser/chunk-LVJW5EFU.mjs +0 -157
  252. package/dist/lib/browser/chunk-LVJW5EFU.mjs.map +0 -7
  253. package/dist/lib/browser/chunk-RFSO3JRG.mjs +0 -1
  254. package/dist/lib/browser/chunk-WPE6AL7I.mjs +0 -905
  255. package/dist/lib/browser/chunk-WPE6AL7I.mjs.map +0 -7
  256. package/dist/lib/browser/invoker-capability-H5PPENOC.mjs.map +0 -7
  257. package/dist/lib/node-esm/capability-WFEG6CIZ.mjs.map +0 -7
  258. package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs +0 -158
  259. package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs.map +0 -7
  260. package/dist/lib/node-esm/chunk-BCEOLX47.mjs.map +0 -7
  261. package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +0 -7
  262. package/dist/lib/node-esm/chunk-LQKOTNJW.mjs +0 -906
  263. package/dist/lib/node-esm/chunk-LQKOTNJW.mjs.map +0 -7
  264. package/dist/lib/node-esm/chunk-ULUEXB7Q.mjs.map +0 -7
  265. package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +0 -7
  266. package/dist/lib/node-esm/invoker-capability-S3ZA527J.mjs.map +0 -7
  267. package/dist/types/src/vite-plugin/composer-plugin.d.ts +0 -18
  268. package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +0 -1
  269. package/dist/types/src/vite-plugin/import-map-plugin.d.ts +0 -16
  270. package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +0 -1
  271. package/src/vite-plugin/composer-plugin.ts +0 -128
  272. package/src/vite-plugin/import-map-plugin.ts +0 -314
  273. /package/dist/lib/browser/{capability-BBBBAPDI.mjs.map → capability-Q5XRXRD2.mjs.map} +0 -0
  274. /package/dist/lib/browser/{chunk-I34GF4NG.mjs.map → chunk-45CHLTBV.mjs.map} +0 -0
  275. /package/dist/lib/browser/{chunk-RFSO3JRG.mjs.map → chunk-G7SDBRKH.mjs.map} +0 -0
  276. /package/dist/lib/node-esm/{capability-AWBEMRYR.mjs.map → capability-EW5GJCI6.mjs.map} +0 -0
  277. /package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs.map → chunk-6XW6LET6.mjs.map} +0 -0
  278. /package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs.map → chunk-OZ7DZA5Z.mjs.map} +0 -0
@@ -3,13 +3,15 @@ import {
3
3
  eventKey,
4
4
  getEvents,
5
5
  isAllOf
6
- } from "./chunk-ZZ7CKK6W.mjs";
6
+ } from "./chunk-XOCUANHO.mjs";
7
7
  import {
8
- Service as Service2
9
- } from "./chunk-ULUEXB7Q.mjs";
8
+ Service as Service2,
9
+ isLazy,
10
+ resolveLazy
11
+ } from "./chunk-HTBJU5FX.mjs";
10
12
  import {
11
13
  Service
12
- } from "./chunk-42KBWDE4.mjs";
14
+ } from "./chunk-SDJ4B2LU.mjs";
13
15
  import {
14
16
  __export
15
17
  } from "./chunk-HSLMI22Q.mjs";
@@ -18,6 +20,7 @@ import {
18
20
  var plugin_manager_exports = {};
19
21
  __export(plugin_manager_exports, {
20
22
  ManagerTypeId: () => ManagerTypeId,
23
+ PluginInitializationError: () => PluginInitializationError,
21
24
  isManager: () => isManager,
22
25
  make: () => make5
23
26
  });
@@ -34,6 +37,7 @@ import * as PubSub from "effect/PubSub";
34
37
  import * as Ref from "effect/Ref";
35
38
  import { runAndForwardErrors } from "@dxos/effect";
36
39
  import { Performance } from "@dxos/effect";
40
+ import { BaseError } from "@dxos/errors";
37
41
  import { log as log2 } from "@dxos/log";
38
42
 
39
43
  // src/core/capability-manager.ts
@@ -71,15 +75,7 @@ var CapabilityManagerImpl = class {
71
75
  _capability = Atom.family((id) => {
72
76
  return Atom.make((get2) => {
73
77
  const current = get2(this._capabilities(id));
74
- invariant(current.length > 0, `No capability found for ${id}`, {
75
- F: __dxlog_file,
76
- L: 101,
77
- S: this,
78
- A: [
79
- "current.length > 0",
80
- "`No capability found for ${id}`"
81
- ]
82
- });
78
+ invariant(current.length > 0, `No capability found for ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 35, S: this, A: ["current.length > 0", "`No capability found for ${id}`"] });
83
79
  return current[0];
84
80
  });
85
81
  });
@@ -93,12 +89,7 @@ var CapabilityManagerImpl = class {
93
89
  log("capability already contributed, skipping", {
94
90
  id: interfaceDef.identifier,
95
91
  moduleId
96
- }, {
97
- F: __dxlog_file,
98
- L: 122,
99
- S: this,
100
- C: (f, a) => f(...a)
101
- });
92
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 46, S: this });
102
93
  return;
103
94
  }
104
95
  const entry = {
@@ -113,12 +104,7 @@ var CapabilityManagerImpl = class {
113
104
  id: interfaceDef.identifier,
114
105
  moduleId,
115
106
  count: current.length
116
- }, {
117
- F: __dxlog_file,
118
- L: 128,
119
- S: this,
120
- C: (f, a) => f(...a)
121
- });
107
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 60, S: this });
122
108
  }
123
109
  remove(interfaceDef, implementation) {
124
110
  const current = this._registry.get(this._capabilityEntries(interfaceDef.identifier));
@@ -131,21 +117,11 @@ var CapabilityManagerImpl = class {
131
117
  log("capability removed", {
132
118
  id: interfaceDef.identifier,
133
119
  count: current.length
134
- }, {
135
- F: __dxlog_file,
136
- L: 144,
137
- S: this,
138
- C: (f, a) => f(...a)
139
- });
120
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 74, S: this });
140
121
  } else {
141
122
  log.warn("capability not removed", {
142
123
  id: interfaceDef.identifier
143
- }, {
144
- F: __dxlog_file,
145
- L: 146,
146
- S: this,
147
- C: (f, a) => f(...a)
148
- });
124
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 79, S: this });
149
125
  }
150
126
  }
151
127
  atom(interfaceDef) {
@@ -156,15 +132,7 @@ var CapabilityManagerImpl = class {
156
132
  }
157
133
  get(interfaceDef) {
158
134
  const capabilities = this.getAll(interfaceDef);
159
- invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
160
- F: __dxlog_file,
161
- L: 161,
162
- S: this,
163
- A: [
164
- "capabilities.length > 0",
165
- "`No capability found for ${interfaceDef.identifier}`"
166
- ]
167
- });
135
+ invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 93, S: this, A: ["capabilities.length > 0", "`No capability found for ${interfaceDef.identifier}`"] });
168
136
  return capabilities[0];
169
137
  }
170
138
  waitFor(interfaceDef) {
@@ -192,6 +160,8 @@ var make2 = (options) => new CapabilityManagerImpl(options);
192
160
 
193
161
  // src/core/plugin-manager.ts
194
162
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin-manager.ts";
163
+ var PluginInitializationError = class extends BaseError.extend("PluginInitializationError", "Plugin manager initialization failed") {
164
+ };
195
165
  var ManagerTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Manager");
196
166
  var isManager = (value) => {
197
167
  return typeof value === "object" && value !== null && ManagerTypeId in value;
@@ -209,20 +179,36 @@ var ManagerImpl = class {
209
179
  _eventsFiredAtom;
210
180
  _pendingResetAtom;
211
181
  _pluginLoader;
182
+ _onRemove;
212
183
  _capabilities = /* @__PURE__ */ new Map();
213
184
  _moduleMemoMap = /* @__PURE__ */ new Map();
214
185
  _moduleSemaphores = /* @__PURE__ */ new Map();
186
+ // Coalesces concurrent `_resolveLazyPlugin` calls per plugin id. Without
187
+ // this, two callers entering `enable(id)` before the swap completes would
188
+ // each invoke `mod.default(options)` and produce distinct module objects,
189
+ // defeating `_addModule`'s reference-equality dedupe and racing the
190
+ // `_pluginsAtom` swap.
191
+ _resolvingPlugins = /* @__PURE__ */ new Map();
215
192
  _activatingEvents = Effect2.runSync(Ref.make([]));
216
193
  _activatingModules = Effect2.runSync(Ref.make([]));
217
194
  _inFlightFibers = Effect2.runSync(Ref.make([]));
218
195
  _shutdownSemaphore = Effect2.runSync(Effect2.makeSemaphore(1));
219
196
  _shuttingDown = Effect2.runSync(Ref.make(false));
220
- constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
197
+ // Tracks the constructor-launched core/enabled `enable()` calls so that
198
+ // `activate` can wait for module registration before dispatching events.
199
+ // Lazy plugins make `enable` asynchronous (a dynamic `import()` happens
200
+ // inside it), so without this synchronization an `activate` triggered
201
+ // immediately after `make` could fire on an empty module set. Failures
202
+ // are wrapped in `PluginInitializationError` so awaiters get a tagged
203
+ // error rather than the wide `Error` produced by the underlying chain.
204
+ _initialization = Effect2.runSync(Deferred2.make());
205
+ constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry, onRemove }) {
221
206
  this.registry = registry ?? Registry.make();
222
207
  this.capabilities = make2({
223
208
  registry: this.registry
224
209
  });
225
210
  this._pluginLoader = pluginLoader;
211
+ this._onRemove = onRemove;
226
212
  this._pluginsAtom = Atom2.make(plugins).pipe(Atom2.keepAlive);
227
213
  this._coreAtom = Atom2.make(core).pipe(Atom2.keepAlive);
228
214
  this._enabledAtom = Atom2.make(enabled).pipe(Atom2.keepAlive);
@@ -231,10 +217,15 @@ var ManagerImpl = class {
231
217
  this._eventsFiredAtom = Atom2.make([]).pipe(Atom2.keepAlive);
232
218
  this._pendingResetAtom = Atom2.make([]).pipe(Atom2.keepAlive);
233
219
  plugins.forEach((plugin) => this._addPlugin(plugin));
234
- void Effect2.all([
235
- ...core,
236
- ...enabled
237
- ].map((id) => this.enable(id))).pipe(runAndForwardErrors);
220
+ const initialIds = [
221
+ .../* @__PURE__ */ new Set([
222
+ ...core,
223
+ ...enabled
224
+ ])
225
+ ];
226
+ void Effect2.all(initialIds.map((id) => this.enable(id))).pipe(Effect2.mapError((cause) => new PluginInitializationError({
227
+ cause
228
+ })), Effect2.tap(() => Deferred2.succeed(this._initialization, void 0)), Effect2.tapErrorCause((cause) => Deferred2.failCause(this._initialization, cause))).pipe(runAndForwardErrors);
238
229
  }
239
230
  get plugins() {
240
231
  return this._pluginsAtom;
@@ -295,21 +286,17 @@ var ManagerImpl = class {
295
286
  }
296
287
  /**
297
288
  * Adds a plugin to the manager via the plugin loader.
289
+ * The plugin is registered but not enabled; call `enable` separately to activate it.
298
290
  * @param id The id of the plugin.
299
291
  */
300
292
  add(id) {
301
293
  return Effect2.gen(this, function* () {
302
294
  log2("add plugin", {
303
295
  id
304
- }, {
305
- F: __dxlog_file2,
306
- L: 227,
307
- S: this,
308
- C: (f, a) => f(...a)
309
- });
296
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 165, S: this });
310
297
  const plugin = yield* this._pluginLoader(id);
311
298
  this._addPlugin(plugin);
312
- return yield* this.enable(plugin.meta.id);
299
+ return plugin;
313
300
  });
314
301
  }
315
302
  /**
@@ -320,16 +307,12 @@ var ManagerImpl = class {
320
307
  return Effect2.gen(this, function* () {
321
308
  log2("enable plugin", {
322
309
  id
323
- }, {
324
- F: __dxlog_file2,
325
- L: 240,
326
- S: this,
327
- C: (f, a) => f(...a)
328
- });
329
- const plugin = this._getPlugin(id);
330
- if (!plugin) {
310
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 178, S: this });
311
+ const stub = this._getPlugin(id);
312
+ if (!stub) {
331
313
  return false;
332
314
  }
315
+ const plugin = yield* this._resolveLazyPlugin(stub);
333
316
  this._update(this._enabledAtom, (enabled) => enabled.includes(id) ? enabled : [
334
317
  ...enabled,
335
318
  id
@@ -342,12 +325,7 @@ var ManagerImpl = class {
342
325
  events: [
343
326
  ...this.getPendingReset()
344
327
  ]
345
- }, {
346
- F: __dxlog_file2,
347
- L: 253,
348
- S: this,
349
- C: (f, a) => f(...a)
350
- });
328
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 194, S: this });
351
329
  yield* Effect2.all(this.getPendingReset().map((event) => this.activate(event)), {
352
330
  concurrency: "unbounded"
353
331
  });
@@ -355,24 +333,78 @@ var ManagerImpl = class {
355
333
  });
356
334
  }
357
335
  /**
336
+ * Resolves a lazy plugin stub (returned by {@link Plugin.lazy}) to its
337
+ * loaded form and swaps it into `_pluginsAtom`. Returns the input unchanged
338
+ * when the plugin is already resolved, so callers can `yield*` this
339
+ * unconditionally. The lazy stub carries `meta` synchronously but its
340
+ * `modules` list is empty until the loader resolves; the swap ensures
341
+ * subsequent enable/disable operations see the resolved plugin.
342
+ *
343
+ * Concurrent calls for the same id are coalesced via `_resolvingPlugins`:
344
+ * the first caller starts the resolution, every subsequent caller awaits
345
+ * the same `Deferred`. On failure we publish a `lazy:<id>` error message
346
+ * and skip the atom swap so the failure is observable to the activation
347
+ * subscriber and a retry can be attempted.
348
+ */
349
+ _resolveLazyPlugin(plugin) {
350
+ return Effect2.gen(this, function* () {
351
+ if (!isLazy(plugin)) {
352
+ return plugin;
353
+ }
354
+ const id = plugin.meta.id;
355
+ const existing = this._resolvingPlugins.get(id);
356
+ if (existing) {
357
+ return yield* Deferred2.await(existing);
358
+ }
359
+ const deferred = yield* Deferred2.make();
360
+ this._resolvingPlugins.set(id, deferred);
361
+ return yield* Effect2.gen(this, function* () {
362
+ log2("resolving lazy plugin", {
363
+ id
364
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 231, S: this });
365
+ yield* PubSub.publish(this.activation, {
366
+ event: "",
367
+ state: "activating",
368
+ module: `lazy:${id}`
369
+ });
370
+ const resolvedPlugin = yield* resolveLazy(plugin);
371
+ this._update(this._pluginsAtom, (plugins) => plugins.map((p) => p.meta.id === id ? resolvedPlugin : p));
372
+ yield* PubSub.publish(this.activation, {
373
+ event: "",
374
+ state: "activated",
375
+ module: `lazy:${id}`
376
+ });
377
+ return resolvedPlugin;
378
+ }).pipe(Effect2.tapError((error) => PubSub.publish(this.activation, {
379
+ event: "",
380
+ state: "error",
381
+ module: `lazy:${id}`,
382
+ error
383
+ })), Effect2.tap((value) => Deferred2.succeed(deferred, value)), Effect2.tapErrorCause((cause) => Deferred2.failCause(deferred, cause)), Effect2.ensuring(Effect2.sync(() => this._resolvingPlugins.delete(id))));
384
+ });
385
+ }
386
+ /**
358
387
  * Removes a plugin from the manager.
359
388
  * @param id The id of the plugin.
360
389
  */
361
390
  remove(id) {
362
- log2("remove plugin", {
363
- id
364
- }, {
365
- F: __dxlog_file2,
366
- L: 268,
367
- S: this,
368
- C: (f, a) => f(...a)
391
+ return Effect2.gen(this, function* () {
392
+ log2("remove plugin", {
393
+ id
394
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 260, S: this });
395
+ const disabled = yield* this.disable(id);
396
+ if (!disabled) {
397
+ return false;
398
+ }
399
+ this._removePlugin(id);
400
+ if (this._onRemove) {
401
+ this._runForkedFiber(this._onRemove(id).pipe(Effect2.tapError((error) => Effect2.sync(() => log2.warn("plugin remove hook failed", {
402
+ id,
403
+ error
404
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 269, S: this }))), Effect2.ignore));
405
+ }
406
+ return true;
369
407
  });
370
- const result = this.disable(id);
371
- if (!result) {
372
- return false;
373
- }
374
- this._removePlugin(id);
375
- return true;
376
408
  }
377
409
  /**
378
410
  * Disables a plugin.
@@ -382,12 +414,7 @@ var ManagerImpl = class {
382
414
  return Effect2.gen(this, function* () {
383
415
  log2("disable plugin", {
384
416
  id
385
- }, {
386
- F: __dxlog_file2,
387
- L: 284,
388
- S: this,
389
- C: (f, a) => f(...a)
390
- });
417
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 282, S: this });
391
418
  if (this._get(this._coreAtom).includes(id)) {
392
419
  return false;
393
420
  }
@@ -418,22 +445,13 @@ var ManagerImpl = class {
418
445
  log2("skipping activation during shutdown", {
419
446
  key,
420
447
  ...params
421
- }, {
422
- F: __dxlog_file2,
423
- L: 320,
424
- S: this,
425
- C: (f, a) => f(...a)
426
- });
448
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 311, S: this });
427
449
  return false;
428
450
  }
451
+ yield* Deferred2.await(this._initialization);
429
452
  return yield* Effect2.withFiberRuntime((fiber) => this._activateEvent(key, params, fiber).pipe(together(Effect2.sleep(Duration.seconds(15)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn("event activation is taking a long time", {
430
453
  event: key
431
- }, {
432
- F: __dxlog_file2,
433
- L: 328,
434
- S: this,
435
- C: (f, a) => f(...a)
436
- }))))), Performance.addTrackEntry({
454
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 322, S: this }))))), Performance.addTrackEntry({
437
455
  name: typeof event === "string" ? event : eventKey(event),
438
456
  devtools: {
439
457
  dataType: "track-entry",
@@ -472,12 +490,7 @@ var ManagerImpl = class {
472
490
  const key = typeof event === "string" ? event : eventKey(event);
473
491
  log2("reset", {
474
492
  key
475
- }, {
476
- F: __dxlog_file2,
477
- L: 374,
478
- S: this,
479
- C: (f, a) => f(...a)
480
- });
493
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 359, S: this });
481
494
  const modules = this._getActiveModulesByEvent(key);
482
495
  const results = yield* Effect2.all(modules.map((module) => this._deactivateModule(module)), {
483
496
  concurrency: "unbounded"
@@ -492,12 +505,7 @@ var ManagerImpl = class {
492
505
  shutdown() {
493
506
  return this._shutdownSemaphore.withPermits(1)(Effect2.gen(this, function* () {
494
507
  yield* Ref.set(this._shuttingDown, true);
495
- log2("shutdown", void 0, {
496
- F: __dxlog_file2,
497
- L: 393,
498
- S: this,
499
- C: (f, a) => f(...a)
500
- });
508
+ log2("shutdown", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 376, S: this });
501
509
  yield* this._interruptInFlightActivations();
502
510
  const activeIds = [
503
511
  ...this._get(this._activeAtom)
@@ -512,12 +520,7 @@ var ManagerImpl = class {
512
520
  this._moduleMemoMap.clear();
513
521
  yield* Ref.set(this._activatingEvents, []);
514
522
  yield* Ref.set(this._activatingModules, []);
515
- log2("shutdown complete", void 0, {
516
- F: __dxlog_file2,
517
- L: 413,
518
- S: this,
519
- C: (f, a) => f(...a)
520
- });
523
+ log2("shutdown complete", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 391, S: this });
521
524
  return true;
522
525
  }).pipe(Effect2.ensuring(Ref.set(this._shuttingDown, false))));
523
526
  }
@@ -562,12 +565,7 @@ var ManagerImpl = class {
562
565
  if (pendingReset.length > 0) {
563
566
  log2("pending reset", {
564
567
  events: pendingReset
565
- }, {
566
- F: __dxlog_file2,
567
- L: 475,
568
- S: this,
569
- C: (f, a) => f(...a)
570
- });
568
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 434, S: this });
571
569
  this._update(this._pendingResetAtom, (current) => [
572
570
  ...current,
573
571
  ...pendingReset
@@ -600,18 +598,24 @@ var ManagerImpl = class {
600
598
  _untrackFiber(ref, fiber) {
601
599
  return Ref.update(ref, (fibers) => fibers.filter((trackedFiber) => trackedFiber !== fiber));
602
600
  }
601
+ /**
602
+ * Spawns an effect on the default runtime and registers the resulting fiber in
603
+ * `_inFlightFibers` so {@link shutdown} can interrupt it. Used from sync entry
604
+ * points like {@link remove} where there is no enclosing Effect to fork from;
605
+ * inside an Effect chain prefer the existing track/await/untrack pattern.
606
+ */
607
+ _runForkedFiber(effect) {
608
+ const fiber = Effect2.runFork(effect);
609
+ Effect2.runSync(this._trackFiber(this._inFlightFibers, fiber));
610
+ Effect2.runFork(Fiber.await(fiber).pipe(Effect2.andThen(() => this._untrackFiber(this._inFlightFibers, fiber))));
611
+ }
603
612
  //
604
613
  // Registration helpers
605
614
  //
606
615
  _addPlugin(plugin) {
607
616
  log2("add plugin", {
608
617
  id: plugin.meta.id
609
- }, {
610
- F: __dxlog_file2,
611
- L: 519,
612
- S: this,
613
- C: (f, a) => f(...a)
614
- });
618
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 483, S: this });
615
619
  this._update(this._pluginsAtom, (plugins) => plugins.includes(plugin) ? plugins : [
616
620
  ...plugins,
617
621
  plugin
@@ -620,23 +624,13 @@ var ManagerImpl = class {
620
624
  _removePlugin(id) {
621
625
  log2("remove plugin", {
622
626
  id
623
- }, {
624
- F: __dxlog_file2,
625
- L: 525,
626
- S: this,
627
- C: (f, a) => f(...a)
628
- });
627
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 493, S: this });
629
628
  this._update(this._pluginsAtom, (plugins) => plugins.filter((plugin) => plugin.meta.id !== id));
630
629
  }
631
630
  _addModule(module) {
632
631
  log2("add module", {
633
632
  id: module.id
634
- }, {
635
- F: __dxlog_file2,
636
- L: 530,
637
- S: this,
638
- C: (f, a) => f(...a)
639
- });
633
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 499, S: this });
640
634
  this._update(this._modulesAtom, (modules) => modules.includes(module) ? modules : [
641
635
  ...modules,
642
636
  module
@@ -645,12 +639,7 @@ var ManagerImpl = class {
645
639
  _removeModule(id) {
646
640
  log2("remove module", {
647
641
  id
648
- }, {
649
- F: __dxlog_file2,
650
- L: 536,
651
- S: this,
652
- C: (f, a) => f(...a)
653
- });
642
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 509, S: this });
654
643
  this._update(this._modulesAtom, (modules) => modules.filter((module) => module.id !== id));
655
644
  }
656
645
  //
@@ -662,12 +651,7 @@ var ManagerImpl = class {
662
651
  log2("activating", {
663
652
  key,
664
653
  ...params
665
- }, {
666
- F: __dxlog_file2,
667
- L: 551,
668
- S: this,
669
- C: (f, a) => f(...a)
670
- });
654
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 520, S: this });
671
655
  yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
672
656
  this._clearPendingReset(key);
673
657
  const activatingEvents = yield* this._activatingEvents;
@@ -676,12 +660,7 @@ var ManagerImpl = class {
676
660
  if (modules.length === 0) {
677
661
  log2("no modules to activate", {
678
662
  key
679
- }, {
680
- F: __dxlog_file2,
681
- L: 559,
682
- S: this,
683
- C: (f, a) => f(...a)
684
- });
663
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 530, S: this });
685
664
  if (!this._get(this._eventsFiredAtom).includes(key)) {
686
665
  this._update(this._eventsFiredAtom, (events) => [
687
666
  ...events,
@@ -703,12 +682,7 @@ var ManagerImpl = class {
703
682
  log2("activating modules", {
704
683
  key,
705
684
  modules: activatingModuleIds
706
- }, {
707
- F: __dxlog_file2,
708
- L: 586,
709
- S: this,
710
- C: (f, a) => f(...a)
711
- });
685
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 551, S: this });
712
686
  performance.mark(`event:${key}:start`);
713
687
  yield* PubSub.publish(this.activation, {
714
688
  event: key,
@@ -732,12 +706,7 @@ var ManagerImpl = class {
732
706
  });
733
707
  log2("activated", {
734
708
  key
735
- }, {
736
- F: __dxlog_file2,
737
- L: 604,
738
- S: this,
739
- C: (f, a) => f(...a)
740
- });
709
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 576, S: this });
741
710
  return true;
742
711
  }).pipe(Effect2.ensuring(Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !activatingModuleIds.includes(module)))));
743
712
  }
@@ -752,13 +721,13 @@ var ManagerImpl = class {
752
721
  });
753
722
  }
754
723
  _getBeforeEvents(modules, activatingEvents) {
755
- return Function.pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
724
+ return Function.pipe(modules, Array.flatMap((module) => module.firesBeforeActivation ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
756
725
  }
757
726
  _getAfterEvents(modules, activatingEvents) {
758
- return Function.pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
727
+ return Function.pipe(modules, Array.flatMap((module) => module.firesAfterActivation ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event) => !activatingEvents.includes(eventKey(event))));
759
728
  }
760
729
  _activateRelatedEvents(key, events, phase) {
761
- const logLabel = phase === "before" ? "activatesBefore" : "activatesAfter";
730
+ const logLabel = phase === "before" ? "firesBeforeActivation" : "firesAfterActivation";
762
731
  const eventKey2 = phase === "before" ? "beforeEvents" : "afterEvents";
763
732
  return Function.pipe(events, Array.map((event) => this.activate(event, phase === "before" ? {
764
733
  before: key
@@ -769,18 +738,13 @@ var ManagerImpl = class {
769
738
  }), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`${logLabel} is taking a long time`, {
770
739
  event: key,
771
740
  [eventKey2]: events.map(eventKey)
772
- }, {
773
- F: __dxlog_file2,
774
- L: 683,
775
- S: this,
776
- C: (f, a) => f(...a)
777
- }))))), Effect2.asVoid);
741
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 609, S: this }))))), Effect2.asVoid);
778
742
  }
779
743
  //
780
744
  // Module lifecycle helpers
781
745
  //
782
746
  _loadCapabilitiesForModules(key, modules) {
783
- return Function.pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
747
+ return Function.pipe(modules, Array.map((mod) => this._loadModule(mod, key)), Effect2.allWith({
784
748
  concurrency: "unbounded"
785
749
  }), Effect2.catchAll((error) => {
786
750
  return Effect2.gen(this, function* () {
@@ -810,7 +774,14 @@ var ManagerImpl = class {
810
774
  }
811
775
  return semaphore;
812
776
  }
813
- _loadModule = (module) => Effect2.gen(this, function* () {
777
+ // `parentEvent` is the activation event that first triggered this module
778
+ // load — included in `activating`/`activated` PubSub messages so subscribers
779
+ // (e.g. the boot loader's status listener) can associate a module with its
780
+ // triggering event in the trace. The same module may be referenced by
781
+ // multiple events, but module loads are memoized via `_moduleMemoMap`, so
782
+ // only the first event to need it will appear here; later events await the
783
+ // cached deferred without re-publishing.
784
+ _loadModule = (module, parentEvent) => Effect2.gen(this, function* () {
814
785
  const semaphore = this._getModuleSemaphore(module.id);
815
786
  const deferredToAwait = yield* Effect2.gen(this, function* () {
816
787
  const existing = this._moduleMemoMap.get(module.id);
@@ -821,16 +792,12 @@ var ManagerImpl = class {
821
792
  this._moduleMemoMap.set(module.id, deferred);
822
793
  const loadEffect = Effect2.gen(this, function* () {
823
794
  log2("loading module", {
824
- module: module.id
825
- }, {
826
- F: __dxlog_file2,
827
- L: 756,
828
- S: this,
829
- C: (f, a) => f(...a)
830
- });
795
+ module: module.id,
796
+ parentEvent
797
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 667, S: this });
831
798
  performance.mark(`module:${module.id}:start`);
832
799
  yield* PubSub.publish(this.activation, {
833
- event: "",
800
+ event: parentEvent,
834
801
  state: "activating",
835
802
  module: module.id
836
803
  });
@@ -842,29 +809,20 @@ var ManagerImpl = class {
842
809
  performance.mark(`module:${module.id}:end`);
843
810
  performance.measure(`module:${module.id}`, `module:${module.id}:start`, `module:${module.id}:end`);
844
811
  yield* PubSub.publish(this.activation, {
845
- event: "",
812
+ event: parentEvent,
846
813
  state: "activated",
847
814
  module: module.id
848
815
  });
849
816
  log2("loaded module", {
850
817
  module: module.id,
818
+ parentEvent,
851
819
  elapsed,
852
820
  failed: false
853
- }, {
854
- F: __dxlog_file2,
855
- L: 771,
856
- S: this,
857
- C: (f, a) => f(...a)
858
- });
821
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 689, S: this });
859
822
  return normalized;
860
823
  }).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
861
824
  module: module.id
862
- }, {
863
- F: __dxlog_file2,
864
- L: 782,
865
- S: this,
866
- C: (f, a) => f(...a)
867
- }))))), Performance.addTrackEntry({
825
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 696, S: this }))))), Performance.addTrackEntry({
868
826
  name: module.id,
869
827
  devtools: {
870
828
  dataType: "track-entry",
@@ -880,12 +838,7 @@ var ManagerImpl = class {
880
838
  error: error instanceof Error ? error.message : String(error),
881
839
  stack: error instanceof Error ? error.stack : void 0,
882
840
  isDefect: !Cause.isFailure(cause)
883
- }, {
884
- F: __dxlog_file2,
885
- L: 803,
886
- S: this,
887
- C: (f, a) => f(...a)
888
- });
841
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 710, S: this });
889
842
  return Deferred2.fail(deferred, error instanceof Error ? error : new Error(String(error)));
890
843
  })));
891
844
  yield* this._trackFiber(this._inFlightFibers, fiber);
@@ -914,12 +867,7 @@ var ManagerImpl = class {
914
867
  const id = module.id;
915
868
  log2("deactivating", {
916
869
  id
917
- }, {
918
- F: __dxlog_file2,
919
- L: 841,
920
- S: this,
921
- C: (f, a) => f(...a)
922
- });
870
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 743, S: this });
923
871
  this._moduleMemoMap.delete(id);
924
872
  const capabilities = this._capabilities.get(id);
925
873
  if (capabilities) {
@@ -936,12 +884,7 @@ var ManagerImpl = class {
936
884
  }
937
885
  log2("deactivated", {
938
886
  id
939
- }, {
940
- F: __dxlog_file2,
941
- L: 859,
942
- S: this,
943
- C: (f, a) => f(...a)
944
- });
887
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 760, S: this });
945
888
  return true;
946
889
  });
947
890
  }
@@ -956,9 +899,10 @@ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
956
899
 
957
900
  export {
958
901
  capability_manager_exports,
902
+ PluginInitializationError,
959
903
  ManagerTypeId,
960
904
  isManager,
961
905
  make5 as make,
962
906
  plugin_manager_exports
963
907
  };
964
- //# sourceMappingURL=chunk-BCEOLX47.mjs.map
908
+ //# sourceMappingURL=chunk-Q7XBFII4.mjs.map