@dxos/app-framework 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8

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 (368) hide show
  1. package/.storybook/main.mts +1 -3
  2. package/dist/lib/browser/capability-5OFLR7J4.mjs +34 -0
  3. package/dist/lib/browser/capability-5OFLR7J4.mjs.map +7 -0
  4. package/dist/lib/browser/{capability-7PCNSWBT.mjs → capability-ZHQDZRP5.mjs} +15 -11
  5. package/dist/lib/browser/capability-ZHQDZRP5.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-272IPLHQ.mjs} +1 -1
  7. package/dist/lib/browser/{chunk-PKQT6C53.mjs.map → chunk-272IPLHQ.mjs.map} +1 -1
  8. package/dist/lib/browser/{chunk-FMZN33N4.mjs → chunk-3VXJONTI.mjs} +304 -178
  9. package/dist/lib/browser/chunk-3VXJONTI.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-XYNO72GQ.mjs → chunk-7AL6SKIV.mjs} +459 -477
  11. package/dist/lib/browser/chunk-7AL6SKIV.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-TCLLRCS3.mjs → chunk-GH3M2LIW.mjs} +10 -7
  13. package/dist/lib/browser/chunk-GH3M2LIW.mjs.map +7 -0
  14. package/dist/lib/browser/{chunk-7IQHKD4U.mjs → chunk-JGWCBVKJ.mjs} +2 -2
  15. package/dist/lib/browser/chunk-JGWCBVKJ.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-M5IC326L.mjs +34 -0
  17. package/dist/lib/browser/chunk-M5IC326L.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
  19. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-TGX63LTL.mjs.map} +1 -1
  20. package/dist/lib/browser/chunk-TIEBZMTF.mjs +44 -0
  21. package/dist/lib/browser/chunk-TIEBZMTF.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-WEBSGU5L.mjs +80 -0
  23. package/dist/lib/browser/chunk-WEBSGU5L.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-YAFEA4GV.mjs +1 -0
  25. package/dist/lib/browser/{chunk-6Y7PZV72.mjs → chunk-YNFPIQGB.mjs} +2 -3
  26. package/dist/lib/browser/{chunk-6Y7PZV72.mjs.map → chunk-YNFPIQGB.mjs.map} +3 -3
  27. package/dist/lib/browser/cli/index.mjs +89 -0
  28. package/dist/lib/browser/cli/index.mjs.map +7 -0
  29. package/dist/lib/browser/common/activation-events.mjs +23 -0
  30. package/dist/lib/browser/common/capabilities.mjs +45 -0
  31. package/dist/lib/browser/core/activation-event.mjs +1 -1
  32. package/dist/lib/browser/core/capability.mjs +1 -1
  33. package/dist/lib/browser/core/plugin-manager.mjs +4 -4
  34. package/dist/lib/browser/core/plugin.mjs +6 -4
  35. package/dist/lib/browser/index.mjs +37 -132
  36. package/dist/lib/browser/index.mjs.map +4 -4
  37. package/dist/lib/browser/{invoker-capability-SZRSTHEH.mjs → invoker-capability-YTTQ2OBB.mjs} +16 -12
  38. package/dist/lib/browser/invoker-capability-YTTQ2OBB.mjs.map +7 -0
  39. package/dist/lib/browser/meta.json +1 -1
  40. package/dist/lib/browser/testing/index.mjs +55 -34
  41. package/dist/lib/browser/testing/index.mjs.map +3 -3
  42. package/dist/lib/browser/{react → ui}/index.mjs +18 -19
  43. package/dist/lib/node-esm/capability-CRHZKL6T.mjs +35 -0
  44. package/dist/lib/node-esm/capability-CRHZKL6T.mjs.map +7 -0
  45. package/dist/lib/node-esm/{capability-CFLQ2QQU.mjs → capability-W5C5464H.mjs} +15 -11
  46. package/dist/lib/node-esm/capability-W5C5464H.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-663A54LQ.mjs → chunk-3D66SZHP.mjs} +2 -2
  48. package/dist/lib/node-esm/chunk-3D66SZHP.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-6REV5DE7.mjs} +1 -1
  50. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs.map → chunk-6REV5DE7.mjs.map} +1 -1
  51. package/dist/lib/node-esm/{chunk-XYQTBFPA.mjs → chunk-CMDON4NG.mjs} +304 -178
  52. package/dist/lib/node-esm/chunk-CMDON4NG.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-FKE4Z3D6.mjs} +2 -2
  54. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-FKE4Z3D6.mjs.map} +1 -1
  55. package/dist/lib/node-esm/{chunk-6WXBT3EC.mjs → chunk-I7FZT4A7.mjs} +459 -477
  56. package/dist/lib/node-esm/chunk-I7FZT4A7.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-GT6OKM5I.mjs → chunk-LHCJGNXK.mjs} +10 -7
  58. package/dist/lib/node-esm/chunk-LHCJGNXK.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs +35 -0
  60. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-STMXUEPO.mjs → chunk-SB5ODNPX.mjs} +2 -3
  62. package/dist/lib/node-esm/{chunk-STMXUEPO.mjs.map → chunk-SB5ODNPX.mjs.map} +3 -3
  63. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs +45 -0
  64. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-SQICGJBW.mjs +81 -0
  66. package/dist/lib/node-esm/chunk-SQICGJBW.mjs.map +7 -0
  67. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +2 -0
  68. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs.map +7 -0
  69. package/dist/lib/node-esm/cli/index.mjs +90 -0
  70. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  71. package/dist/lib/node-esm/common/activation-events.mjs +24 -0
  72. package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
  73. package/dist/lib/node-esm/common/capabilities.mjs +46 -0
  74. package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
  75. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  76. package/dist/lib/node-esm/core/capability.mjs +1 -1
  77. package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
  78. package/dist/lib/node-esm/core/plugin.mjs +6 -4
  79. package/dist/lib/node-esm/index.mjs +37 -132
  80. package/dist/lib/node-esm/index.mjs.map +4 -4
  81. package/dist/lib/node-esm/{invoker-capability-PNMA5JOS.mjs → invoker-capability-BU26474T.mjs} +16 -12
  82. package/dist/lib/node-esm/invoker-capability-BU26474T.mjs.map +7 -0
  83. package/dist/lib/node-esm/meta.json +1 -1
  84. package/dist/lib/node-esm/testing/index.mjs +55 -34
  85. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  86. package/dist/lib/node-esm/{react → ui}/index.mjs +18 -19
  87. package/dist/lib/node-esm/ui/index.mjs.map +7 -0
  88. package/dist/types/src/{cli.d.ts → cli/cli.d.ts} +2 -2
  89. package/dist/types/src/cli/cli.d.ts.map +1 -0
  90. package/dist/types/src/cli/index.d.ts +2 -0
  91. package/dist/types/src/cli/index.d.ts.map +1 -0
  92. package/dist/types/src/common/activation-events.d.ts +27 -0
  93. package/dist/types/src/common/activation-events.d.ts.map +1 -0
  94. package/dist/types/src/common/capabilities.d.ts +115 -0
  95. package/dist/types/src/common/capabilities.d.ts.map +1 -0
  96. package/dist/types/src/common/index.d.ts +4 -9
  97. package/dist/types/src/common/index.d.ts.map +1 -1
  98. package/dist/types/src/common/operations.d.ts +1 -348
  99. package/dist/types/src/common/operations.d.ts.map +1 -1
  100. package/dist/types/src/common/translations.d.ts +0 -9
  101. package/dist/types/src/common/translations.d.ts.map +1 -1
  102. package/dist/types/src/core/activation-event.d.ts +1 -1
  103. package/dist/types/src/core/capability.d.ts +7 -7
  104. package/dist/types/src/core/capability.d.ts.map +1 -1
  105. package/dist/types/src/core/plugin-manager.d.ts +6 -0
  106. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  107. package/dist/types/src/core/plugin.d.ts +6 -1
  108. package/dist/types/src/core/plugin.d.ts.map +1 -1
  109. package/dist/types/src/index.d.ts +1 -3
  110. package/dist/types/src/index.d.ts.map +1 -1
  111. package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
  112. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +11 -3
  113. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  114. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  115. package/dist/types/src/plugin-runtime/capability.d.ts +2 -2
  116. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  117. package/dist/types/src/testing/withPluginManager.d.ts +1 -1
  118. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  119. package/dist/types/src/{react → ui/components/App}/App.d.ts +1 -1
  120. package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
  121. package/dist/types/src/{react/Surface.stories.d.ts → ui/components/App/App.stories.d.ts} +7 -2
  122. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
  123. package/dist/types/src/ui/components/App/index.d.ts +2 -0
  124. package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
  125. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
  126. package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerProvider.d.ts +1 -1
  127. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
  128. package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
  129. package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
  130. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +12 -0
  131. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
  132. package/dist/types/src/{react/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
  133. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
  134. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
  135. package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
  136. package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
  137. package/dist/types/src/ui/components/Surface/index.d.ts +20 -0
  138. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
  139. package/dist/types/src/{common/surface.d.ts → ui/components/Surface/types.d.ts} +20 -18
  140. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
  141. package/dist/types/src/ui/components/index.d.ts +4 -0
  142. package/dist/types/src/ui/components/index.d.ts.map +1 -0
  143. package/dist/types/src/ui/hooks/index.d.ts +7 -0
  144. package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
  145. package/dist/types/src/{react → ui/hooks}/useApp.d.ts +14 -9
  146. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
  147. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  148. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  149. package/dist/types/src/{react → ui/hooks}/useCapabilities.d.ts +6 -1
  150. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
  151. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
  152. package/dist/types/src/{react → ui/hooks}/useOperationResolver.d.ts +2 -2
  153. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +1 -0
  154. package/dist/types/src/{react/common.d.ts → ui/hooks/useSettingsState.d.ts} +1 -5
  155. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
  156. package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
  157. package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
  158. package/dist/types/src/ui/index.d.ts +3 -0
  159. package/dist/types/src/ui/index.d.ts.map +1 -0
  160. package/dist/types/tsconfig.tsbuildinfo +1 -1
  161. package/moon.yml +6 -6
  162. package/package.json +72 -64
  163. package/src/{cli.ts → cli/cli.ts} +10 -10
  164. package/src/{playground/debug → cli}/index.ts +1 -1
  165. package/src/common/activation-events.ts +44 -0
  166. package/src/common/capabilities.ts +178 -0
  167. package/src/common/index.ts +4 -9
  168. package/src/common/operations.ts +2 -376
  169. package/src/common/translations.ts +0 -12
  170. package/src/context.ts +1 -1
  171. package/src/core/activation-event.ts +1 -1
  172. package/src/core/capability.ts +9 -9
  173. package/src/core/plugin-manager.test.ts +292 -44
  174. package/src/core/plugin-manager.ts +326 -154
  175. package/src/core/plugin.ts +10 -2
  176. package/src/index.ts +1 -3
  177. package/src/plugin-operation/OperationPlugin.ts +5 -5
  178. package/src/plugin-operation/history/capability.ts +5 -5
  179. package/src/plugin-operation/history/undo-mapping.ts +6 -3
  180. package/src/plugin-operation/invoker-capability.ts +5 -5
  181. package/src/plugin-operation/meta.ts +1 -1
  182. package/src/plugin-runtime/RuntimePlugin.ts +4 -4
  183. package/src/plugin-runtime/capability.ts +5 -5
  184. package/src/plugin-runtime/meta.ts +1 -1
  185. package/src/testing/service.ts +6 -6
  186. package/src/testing/withPluginManager.stories.tsx +6 -6
  187. package/src/testing/withPluginManager.tsx +46 -19
  188. package/src/ui/components/App/App.stories.tsx +92 -0
  189. package/src/{react → ui/components/App}/App.tsx +6 -9
  190. package/src/{playground/layout → ui/components/App}/index.ts +1 -1
  191. package/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.tsx +13 -14
  192. package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +1 -1
  193. package/src/ui/components/PluginManager/index.ts +5 -0
  194. package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +18 -16
  195. package/src/{react/Surface.tsx → ui/components/Surface/SurfaceComponent.tsx} +36 -56
  196. package/src/{react → ui/components/Surface}/SurfaceInfo.tsx +2 -2
  197. package/src/ui/components/Surface/context.ts +12 -0
  198. package/src/ui/components/Surface/index.ts +20 -0
  199. package/src/{common/surface.ts → ui/components/Surface/types.ts} +22 -25
  200. package/src/ui/components/index.ts +7 -0
  201. package/src/ui/hooks/index.ts +10 -0
  202. package/src/ui/hooks/useApp.test.tsx +159 -0
  203. package/src/{react → ui/hooks}/useApp.tsx +39 -29
  204. package/src/{react → ui/hooks}/useCapabilities.ts +9 -5
  205. package/src/{react → ui/hooks}/useOperationResolver.ts +5 -5
  206. package/src/{react/common.ts → ui/hooks/useSettingsState.ts} +0 -11
  207. package/src/ui/hooks/useSurface.ts +13 -0
  208. package/src/ui/index.ts +6 -0
  209. package/tsconfig.json +2 -29
  210. package/tsconfig.node.json +1 -3
  211. package/typedoc.json +2 -4
  212. package/vitest.config.ts +1 -1
  213. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +0 -149
  214. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +0 -7
  215. package/dist/lib/browser/capability-7PCNSWBT.mjs.map +0 -7
  216. package/dist/lib/browser/capability-KP3PFEXD.mjs +0 -31
  217. package/dist/lib/browser/capability-KP3PFEXD.mjs.map +0 -7
  218. package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +0 -7
  219. package/dist/lib/browser/chunk-BLQJSGL3.mjs +0 -732
  220. package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +0 -7
  221. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  222. package/dist/lib/browser/chunk-FMZN33N4.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-H4WPA7U7.mjs +0 -77
  224. package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +0 -7
  225. package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +0 -7
  226. package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +0 -7
  227. package/dist/lib/browser/common/index.mjs +0 -38
  228. package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +0 -7
  229. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +0 -64
  230. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +0 -7
  231. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +0 -150
  232. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +0 -7
  233. package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +0 -7
  234. package/dist/lib/node-esm/capability-RCUNM2M7.mjs +0 -32
  235. package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +0 -7
  237. package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +0 -7
  238. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +0 -733
  239. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +0 -7
  240. package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +0 -7
  241. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +0 -78
  242. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +0 -7
  243. package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +0 -7
  244. package/dist/lib/node-esm/common/index.mjs +0 -39
  245. package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +0 -7
  246. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +0 -65
  247. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +0 -7
  248. package/dist/types/src/cli.d.ts.map +0 -1
  249. package/dist/types/src/common/activation-event.d.ts +0 -66
  250. package/dist/types/src/common/activation-event.d.ts.map +0 -1
  251. package/dist/types/src/common/capability.d.ts +0 -265
  252. package/dist/types/src/common/capability.d.ts.map +0 -1
  253. package/dist/types/src/common/collaboration.d.ts +0 -26
  254. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  255. package/dist/types/src/common/file.d.ts +0 -14
  256. package/dist/types/src/common/file.d.ts.map +0 -1
  257. package/dist/types/src/common/graph.d.ts +0 -21
  258. package/dist/types/src/common/graph.d.ts.map +0 -1
  259. package/dist/types/src/common/plugin.d.ts +0 -201
  260. package/dist/types/src/common/plugin.d.ts.map +0 -1
  261. package/dist/types/src/common/surface.d.ts.map +0 -1
  262. package/dist/types/src/playground/debug/Debug.d.ts +0 -8
  263. package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
  264. package/dist/types/src/playground/debug/index.d.ts +0 -2
  265. package/dist/types/src/playground/debug/index.d.ts.map +0 -1
  266. package/dist/types/src/playground/debug/plugin.d.ts +0 -3
  267. package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
  268. package/dist/types/src/playground/generator/Main.d.ts +0 -8
  269. package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
  270. package/dist/types/src/playground/generator/Toolbar.d.ts +0 -8
  271. package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
  272. package/dist/types/src/playground/generator/generator.d.ts +0 -19
  273. package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
  274. package/dist/types/src/playground/generator/index.d.ts +0 -3
  275. package/dist/types/src/playground/generator/index.d.ts.map +0 -1
  276. package/dist/types/src/playground/generator/plugin.d.ts +0 -3
  277. package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
  278. package/dist/types/src/playground/layout/Layout.d.ts +0 -10
  279. package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
  280. package/dist/types/src/playground/layout/index.d.ts +0 -2
  281. package/dist/types/src/playground/layout/index.d.ts.map +0 -1
  282. package/dist/types/src/playground/layout/plugin.d.ts +0 -3
  283. package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
  284. package/dist/types/src/playground/logger/Toolbar.d.ts +0 -8
  285. package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
  286. package/dist/types/src/playground/logger/index.d.ts +0 -2
  287. package/dist/types/src/playground/logger/index.d.ts.map +0 -1
  288. package/dist/types/src/playground/logger/plugin.d.ts +0 -3
  289. package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
  290. package/dist/types/src/playground/logger/schema.d.ts +0 -27
  291. package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
  292. package/dist/types/src/playground/playground.stories.d.ts +0 -11
  293. package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
  294. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -3
  295. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  296. package/dist/types/src/plugin-settings/actions.d.ts +0 -61
  297. package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
  298. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -6
  299. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
  300. package/dist/types/src/plugin-settings/index.d.ts +0 -3
  301. package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
  302. package/dist/types/src/plugin-settings/meta.d.ts +0 -3
  303. package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
  304. package/dist/types/src/plugin-settings/operation-resolver.d.ts +0 -6
  305. package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +0 -1
  306. package/dist/types/src/plugin-settings/translations.d.ts +0 -11
  307. package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
  308. package/dist/types/src/react/App.d.ts.map +0 -1
  309. package/dist/types/src/react/App.stories.d.ts.map +0 -1
  310. package/dist/types/src/react/DefaultFallback.d.ts +0 -8
  311. package/dist/types/src/react/DefaultFallback.d.ts.map +0 -1
  312. package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
  313. package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
  314. package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +0 -1
  315. package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
  316. package/dist/types/src/react/Surface.d.ts +0 -14
  317. package/dist/types/src/react/Surface.d.ts.map +0 -1
  318. package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
  319. package/dist/types/src/react/SurfaceInfo.d.ts.map +0 -1
  320. package/dist/types/src/react/common.d.ts.map +0 -1
  321. package/dist/types/src/react/index.d.ts +0 -9
  322. package/dist/types/src/react/index.d.ts.map +0 -1
  323. package/dist/types/src/react/types.d.ts +0 -12
  324. package/dist/types/src/react/types.d.ts.map +0 -1
  325. package/dist/types/src/react/useApp.d.ts.map +0 -1
  326. package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
  327. package/dist/types/src/react/useLoading.d.ts.map +0 -1
  328. package/dist/types/src/react/useOperationResolver.d.ts.map +0 -1
  329. package/src/common/activation-event.ts +0 -99
  330. package/src/common/capability.ts +0 -343
  331. package/src/common/collaboration.ts +0 -31
  332. package/src/common/file.ts +0 -22
  333. package/src/common/graph.ts +0 -30
  334. package/src/common/plugin.ts +0 -364
  335. package/src/playground/debug/Debug.tsx +0 -49
  336. package/src/playground/debug/plugin.ts +0 -16
  337. package/src/playground/generator/Main.tsx +0 -80
  338. package/src/playground/generator/Toolbar.tsx +0 -57
  339. package/src/playground/generator/generator.ts +0 -48
  340. package/src/playground/generator/index.ts +0 -6
  341. package/src/playground/generator/plugin.ts +0 -21
  342. package/src/playground/layout/Layout.tsx +0 -37
  343. package/src/playground/layout/plugin.ts +0 -18
  344. package/src/playground/logger/Toolbar.tsx +0 -33
  345. package/src/playground/logger/index.ts +0 -5
  346. package/src/playground/logger/plugin.ts +0 -42
  347. package/src/playground/logger/schema.ts +0 -22
  348. package/src/playground/playground.stories.tsx +0 -54
  349. package/src/plugin-settings/SettingsPlugin.ts +0 -19
  350. package/src/plugin-settings/actions.ts +0 -64
  351. package/src/plugin-settings/app-graph-builder.ts +0 -140
  352. package/src/plugin-settings/index.ts +0 -6
  353. package/src/plugin-settings/meta.ts +0 -10
  354. package/src/plugin-settings/operation-resolver.ts +0 -55
  355. package/src/plugin-settings/translations.ts +0 -19
  356. package/src/react/App.stories.tsx +0 -63
  357. package/src/react/DefaultFallback.tsx +0 -26
  358. package/src/react/ErrorBoundary.tsx +0 -56
  359. package/src/react/index.ts +0 -14
  360. package/src/react/types.ts +0 -27
  361. /package/dist/lib/{node-esm/react/index.mjs.map → browser/chunk-YAFEA4GV.mjs.map} +0 -0
  362. /package/dist/lib/{node-esm/common/index.mjs.map → browser/common/activation-events.mjs.map} +0 -0
  363. /package/dist/lib/browser/{react/index.mjs.map → common/capabilities.mjs.map} +0 -0
  364. /package/dist/lib/browser/{common → ui}/index.mjs.map +0 -0
  365. /package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.d.ts +0 -0
  366. /package/dist/types/src/{react → ui/components/Surface}/SurfaceInfo.d.ts +0 -0
  367. /package/dist/types/src/{react → ui/hooks}/useLoading.d.ts +0 -0
  368. /package/src/{react → ui/hooks}/useLoading.tsx +0 -0
@@ -4,6 +4,8 @@
4
4
 
5
5
  import { afterEach, assert, describe, it } from '@effect/vitest';
6
6
  import { type Atom, Registry } from '@effect-atom/atom-react';
7
+ import * as Cause from 'effect/Cause';
8
+ import * as Exit from 'effect/Exit';
7
9
  import * as Duration from 'effect/Duration';
8
10
  import * as Effect from 'effect/Effect';
9
11
  import * as Fiber from 'effect/Fiber';
@@ -15,7 +17,7 @@ import * as TestClock from 'effect/TestClock';
15
17
  import { invariant } from '@dxos/invariant';
16
18
  import { type LogConfig, type LogEntry, LogLevel, log } from '@dxos/log';
17
19
 
18
- import * as Common from '../common';
20
+ import { ActivationEvents } from '../common';
19
21
 
20
22
  import * as ActivationEvent from './activation-event';
21
23
  import * as Capability from './capability';
@@ -23,14 +25,14 @@ import type * as CapabilityManager from './capability-manager';
23
25
  import * as Plugin from './plugin';
24
26
  import * as PluginManager from './plugin-manager';
25
27
 
26
- const String = Capability.make<{ string: string }>('dxos.org/test/string');
27
- const Number = Capability.make<{ number: number }>('dxos.org/test/number');
28
- const Total = Capability.make<{ total: number }>('dxos.org/test/total');
28
+ const String = Capability.make<{ string: string }>('org.dxos.test.string');
29
+ const Number = Capability.make<{ number: number }>('org.dxos.test.number');
30
+ const Total = Capability.make<{ total: number }>('org.dxos.test.total');
29
31
 
30
- const CountEvent = ActivationEvent.make('dxos.org/test/count');
31
- const FailEvent = ActivationEvent.make('dxos.org/test/fail');
32
+ const CountEvent = ActivationEvent.make('org.dxos.test.count');
33
+ const FailEvent = ActivationEvent.make('org.dxos.test.fail');
32
34
 
33
- const testMeta = { id: 'dxos.org/plugin/test', name: 'Test' };
35
+ const testMeta = { id: 'org.dxos.plugin.test', name: 'Test' };
34
36
 
35
37
  // TODO(wittjosiah): Factor out?
36
38
  const atomCounter = (registry: Registry.Registry, atom: Atom.Atom<any>) => {
@@ -89,12 +91,12 @@ describe('PluginManager', () => {
89
91
  const TestPluginFactory = Plugin.define<TestPluginOptions>(testMeta).pipe(
90
92
  Plugin.addModule((options: TestPluginOptions) => ({
91
93
  id: 'Hello',
92
- activatesOn: Common.ActivationEvent.Startup,
94
+ activatesOn: ActivationEvents.Startup,
93
95
  activate: () => Effect.succeed(Capability.contributes(String, { string: `hello-${options.count}` })),
94
96
  })),
95
97
  Plugin.addModule({
96
98
  id: 'World',
97
- activatesOn: Common.ActivationEvent.Startup,
99
+ activatesOn: ActivationEvents.Startup,
98
100
  activate: () => Effect.succeed(Capability.contributes(String, { string: 'world' })),
99
101
  }),
100
102
  Plugin.make,
@@ -105,7 +107,7 @@ describe('PluginManager', () => {
105
107
 
106
108
  const manager = PluginManager.make({ plugins: [plugin], core: [], pluginLoader });
107
109
  yield* manager.enable(testMeta.id);
108
- yield* manager.activate(Common.ActivationEvent.Startup);
110
+ yield* manager.activate(ActivationEvents.Startup);
109
111
  const strings = manager.capabilities.getAll(String);
110
112
  assert.strictEqual(strings.length, 2);
111
113
  assert.strictEqual(strings[0].string, 'hello-5');
@@ -118,7 +120,7 @@ describe('PluginManager', () => {
118
120
  const Test = Plugin.define(testMeta).pipe(
119
121
  Plugin.addModule({
120
122
  id: 'Hello',
121
- activatesOn: Common.ActivationEvent.Startup,
123
+ activatesOn: ActivationEvents.Startup,
122
124
  activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
123
125
  }),
124
126
  Plugin.make,
@@ -140,7 +142,7 @@ describe('PluginManager', () => {
140
142
  const Test = Plugin.define(testMeta).pipe(
141
143
  Plugin.addModule({
142
144
  id: 'Hello',
143
- activatesOn: Common.ActivationEvent.Startup,
145
+ activatesOn: ActivationEvents.Startup,
144
146
  activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
145
147
  }),
146
148
  Plugin.make,
@@ -154,9 +156,9 @@ describe('PluginManager', () => {
154
156
  assert.deepStrictEqual(manager.getModules(), [testPlugin.modules[0]]);
155
157
  assert.deepStrictEqual(manager.getActive(), []);
156
158
  assert.deepStrictEqual(manager.getEventsFired(), []);
157
- yield* manager.activate(Common.ActivationEvent.Startup);
159
+ yield* manager.activate(ActivationEvents.Startup);
158
160
  assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
159
- assert.deepStrictEqual(manager.getEventsFired(), [Common.ActivationEvent.Startup.id]);
161
+ assert.deepStrictEqual(manager.getEventsFired(), [ActivationEvents.Startup.id]);
160
162
  }),
161
163
  );
162
164
 
@@ -165,7 +167,7 @@ describe('PluginManager', () => {
165
167
  const Test = Plugin.define(testMeta).pipe(
166
168
  Plugin.addModule({
167
169
  id: 'NoCapabilities',
168
- activatesOn: Common.ActivationEvent.Startup,
170
+ activatesOn: ActivationEvents.Startup,
169
171
  activate: Effect.fnUntraced(function* () {}),
170
172
  }),
171
173
  Plugin.make,
@@ -175,7 +177,7 @@ describe('PluginManager', () => {
175
177
  const manager = PluginManager.make({ plugins: [testPlugin], pluginLoader });
176
178
  yield* manager.enable(Test.meta.id);
177
179
 
178
- const result = yield* manager.activate(Common.ActivationEvent.Startup);
180
+ const result = yield* manager.activate(ActivationEvents.Startup);
179
181
  assert.isTrue(result);
180
182
  assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
181
183
  assert.strictEqual(manager.capabilities.getAll(String).length, 0);
@@ -204,7 +206,7 @@ describe('PluginManager', () => {
204
206
 
205
207
  it.effect('should catch and log defects (synchronous throws) in module activation', () =>
206
208
  Effect.gen(function* () {
207
- const DefectEvent = ActivationEvent.make('dxos.org/test/defect');
209
+ const DefectEvent = ActivationEvent.make('org.dxos.test.defect');
208
210
  const capturedErrors: LogEntry[] = [];
209
211
  const removeProcessor = log.addProcessor((_config: LogConfig, entry: LogEntry) => {
210
212
  if (entry.level === LogLevel.ERROR) {
@@ -238,7 +240,7 @@ describe('PluginManager', () => {
238
240
  const defectLog = capturedErrors.find(
239
241
  (entry) =>
240
242
  entry.message?.includes('module failed to activate') &&
241
- entry.context?.module === 'dxos.org/plugin/test/module/DefectInEffectSync',
243
+ entry.context?.module === 'org.dxos.plugin.test.module.DefectInEffectSync',
242
244
  );
243
245
  assert.isNotNull(defectLog, 'Expected error log for defect');
244
246
  assert.strictEqual(defectLog?.context?.isDefect, true, 'Expected isDefect to be true for synchronous throw');
@@ -249,7 +251,7 @@ describe('PluginManager', () => {
249
251
 
250
252
  it.effect('should catch and log defects when activate throws before returning Effect', () =>
251
253
  Effect.gen(function* () {
252
- const DefectEvent = ActivationEvent.make('dxos.org/test/defect-immediate');
254
+ const DefectEvent = ActivationEvent.make('org.dxos.test.defect-immediate');
253
255
  const capturedErrors: LogEntry[] = [];
254
256
  const removeProcessor = log.addProcessor((_config: LogConfig, entry: LogEntry) => {
255
257
  if (entry.level === LogLevel.ERROR) {
@@ -284,7 +286,7 @@ describe('PluginManager', () => {
284
286
  const defectLog = capturedErrors.find(
285
287
  (entry) =>
286
288
  entry.message?.includes('module failed to activate') &&
287
- entry.context?.module === 'dxos.org/plugin/test/module/DefectImmediate',
289
+ entry.context?.module === 'org.dxos.plugin.test.module.DefectImmediate',
288
290
  );
289
291
  assert.isNotNull(defectLog, 'Expected error log for immediate defect');
290
292
  assert.strictEqual(
@@ -303,7 +305,7 @@ describe('PluginManager', () => {
303
305
  Plugin.define(testMeta).pipe(
304
306
  Plugin.addModule({
305
307
  id: 'Hello',
306
- activatesOn: Common.ActivationEvent.Startup,
308
+ activatesOn: ActivationEvents.Startup,
307
309
  activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
308
310
  }),
309
311
  Plugin.addModule({
@@ -339,7 +341,7 @@ describe('PluginManager', () => {
339
341
  );
340
342
 
341
343
  yield* manager.add(testMeta.id);
342
- yield* manager.activate(Common.ActivationEvent.Startup);
344
+ yield* manager.activate(ActivationEvents.Startup);
343
345
  yield* activating.await;
344
346
  yield* activated.await;
345
347
 
@@ -374,7 +376,7 @@ describe('PluginManager', () => {
374
376
  const Test = Plugin.define(testMeta).pipe(
375
377
  Plugin.addModule({
376
378
  id: 'Hello',
377
- activatesOn: Common.ActivationEvent.Startup,
379
+ activatesOn: ActivationEvents.Startup,
378
380
  activate: () => {
379
381
  count++;
380
382
  return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
@@ -389,19 +391,19 @@ describe('PluginManager', () => {
389
391
 
390
392
  {
391
393
  yield* manager.add(testMeta.id);
392
- const result = yield* manager.activate(Common.ActivationEvent.Startup);
394
+ const result = yield* manager.activate(ActivationEvents.Startup);
393
395
  assert.isTrue(result);
394
396
  assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
395
397
  assert.strictEqual(count, 1);
396
398
  }
397
399
 
398
400
  {
399
- const result = yield* manager.activate(Common.ActivationEvent.Startup);
401
+ const result = yield* manager.activate(ActivationEvents.Startup);
400
402
  assert.isFalse(result);
401
403
  }
402
404
 
403
405
  {
404
- const result = yield* manager.reset(Common.ActivationEvent.Startup);
406
+ const result = yield* manager.reset(ActivationEvents.Startup);
405
407
  assert.isTrue(result);
406
408
  assert.strictEqual(count, 2);
407
409
  }
@@ -419,7 +421,7 @@ describe('PluginManager', () => {
419
421
 
420
422
  it.effect('should be able to fire custom activation events', () =>
421
423
  Effect.gen(function* () {
422
- const Plugin1 = Plugin.define({ id: 'dxos.org/test/plugin-1', name: 'Plugin 1' }).pipe(
424
+ const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
423
425
  Plugin.addModule({
424
426
  activatesOn: CountEvent,
425
427
  id: 'Plugin1',
@@ -427,7 +429,7 @@ describe('PluginManager', () => {
427
429
  }),
428
430
  Plugin.make,
429
431
  );
430
- const Plugin2 = Plugin.define({ id: 'dxos.org/test/plugin-2', name: 'Plugin 2' }).pipe(
432
+ const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
431
433
  Plugin.addModule({
432
434
  activatesOn: CountEvent,
433
435
  id: 'Plugin2',
@@ -435,7 +437,7 @@ describe('PluginManager', () => {
435
437
  }),
436
438
  Plugin.make,
437
439
  );
438
- const Plugin3 = Plugin.define({ id: 'dxos.org/test/plugin-3', name: 'Plugin 3' }).pipe(
440
+ const Plugin3 = Plugin.define({ id: 'org.dxos.test.plugin-3', name: 'Plugin 3' }).pipe(
439
441
  Plugin.addModule({
440
442
  activatesOn: CountEvent,
441
443
  id: 'Plugin3',
@@ -477,7 +479,7 @@ describe('PluginManager', () => {
477
479
  Effect.gen(function* () {
478
480
  const Test = Plugin.define(testMeta).pipe(
479
481
  Plugin.addModule({
480
- activatesOn: ActivationEvent.allOf(Common.ActivationEvent.Startup, CountEvent),
482
+ activatesOn: ActivationEvent.allOf(ActivationEvents.Startup, CountEvent),
481
483
  id: 'Hello',
482
484
  activate: () => {
483
485
  return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
@@ -493,7 +495,7 @@ describe('PluginManager', () => {
493
495
  assert.strictEqual(manager.capabilities.getAll(String).length, 0);
494
496
 
495
497
  yield* manager.add(testMeta.id);
496
- yield* manager.activate(Common.ActivationEvent.Startup);
498
+ yield* manager.activate(ActivationEvents.Startup);
497
499
  assert.deepStrictEqual(manager.getActive(), []);
498
500
  assert.strictEqual(manager.capabilities.getAll(String).length, 0);
499
501
 
@@ -509,7 +511,7 @@ describe('PluginManager', () => {
509
511
  const Test = Plugin.define(testMeta).pipe(
510
512
  Plugin.addModule({
511
513
  id: 'Hello',
512
- activatesOn: ActivationEvent.oneOf(Common.ActivationEvent.Startup, CountEvent),
514
+ activatesOn: ActivationEvent.oneOf(ActivationEvents.Startup, CountEvent),
513
515
  activate: () => {
514
516
  count++;
515
517
  return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
@@ -531,7 +533,7 @@ describe('PluginManager', () => {
531
533
  assert.strictEqual(manager.capabilities.getAll(String).length, 1);
532
534
  assert.strictEqual(count, 1);
533
535
 
534
- yield* manager.activate(Common.ActivationEvent.Startup);
536
+ yield* manager.activate(ActivationEvents.Startup);
535
537
  assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
536
538
  assert.strictEqual(manager.capabilities.getAll(String).length, 1);
537
539
  assert.strictEqual(count, 1);
@@ -546,10 +548,10 @@ describe('PluginManager', () => {
546
548
  state.total = numbers.reduce((acc: number, n: { number: number }) => acc + n.number, 0);
547
549
  };
548
550
 
549
- const Count = Plugin.define({ id: 'dxos.org/test/count', name: 'Count' }).pipe(
551
+ const Count = Plugin.define({ id: 'org.dxos.test.count', name: 'Count' }).pipe(
550
552
  Plugin.addModule({
551
553
  id: 'Count',
552
- activatesOn: Common.ActivationEvent.Startup,
554
+ activatesOn: ActivationEvents.Startup,
553
555
  activatesBefore: [CountEvent],
554
556
  activate: Effect.fnUntraced(function* () {
555
557
  const capabilityManager = yield* Capability.Service;
@@ -586,7 +588,7 @@ describe('PluginManager', () => {
586
588
  {
587
589
  yield* manager.add(Test.meta.id);
588
590
  yield* manager.add(Count.meta.id);
589
- yield* manager.activate(Common.ActivationEvent.Startup);
591
+ yield* manager.activate(ActivationEvents.Startup);
590
592
  assert.deepStrictEqual(manager.getActive(), [
591
593
  ...testPlugin.modules.map((m) => m.id),
592
594
  countPlugin.modules[0].id,
@@ -626,7 +628,7 @@ describe('PluginManager', () => {
626
628
 
627
629
  it.effect('should be reactive', () =>
628
630
  Effect.gen(function* () {
629
- const Plugin1 = Plugin.define({ id: 'dxos.org/test/plugin-1', name: 'Plugin 1' }).pipe(
631
+ const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
630
632
  Plugin.addModule({
631
633
  activatesOn: CountEvent,
632
634
  id: 'Plugin1',
@@ -634,7 +636,7 @@ describe('PluginManager', () => {
634
636
  }),
635
637
  Plugin.make,
636
638
  );
637
- const Plugin2 = Plugin.define({ id: 'dxos.org/test/plugin-2', name: 'Plugin 2' }).pipe(
639
+ const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
638
640
  Plugin.addModule({
639
641
  activatesOn: CountEvent,
640
642
  id: 'Plugin2',
@@ -642,7 +644,7 @@ describe('PluginManager', () => {
642
644
  }),
643
645
  Plugin.make,
644
646
  );
645
- const Plugin3 = Plugin.define({ id: 'dxos.org/test/plugin-3', name: 'Plugin 3' }).pipe(
647
+ const Plugin3 = Plugin.define({ id: 'org.dxos.test.plugin-3', name: 'Plugin 3' }).pipe(
646
648
  Plugin.addModule({
647
649
  activatesOn: CountEvent,
648
650
  id: 'Plugin3',
@@ -752,8 +754,8 @@ describe('PluginManager', () => {
752
754
  }
753
755
  });
754
756
 
755
- const SlowEvent = ActivationEvent.make('dxos.org/test/slow');
756
- const SlowPlugin = Plugin.define({ id: 'dxos.org/test/slow-plugin', name: 'Slow Plugin' }).pipe(
757
+ const SlowEvent = ActivationEvent.make('org.dxos.test.slow');
758
+ const SlowPlugin = Plugin.define({ id: 'org.dxos.test.slow-plugin', name: 'Slow Plugin' }).pipe(
757
759
  Plugin.addModule({
758
760
  id: 'SlowModule',
759
761
  activatesOn: SlowEvent,
@@ -795,11 +797,11 @@ describe('PluginManager', () => {
795
797
  it.effect('should prevent concurrent loads of the same module via semaphore', () =>
796
798
  Effect.gen(function* () {
797
799
  // Two different events that both can trigger the same module.
798
- const EventA = ActivationEvent.make('dxos.org/test/event-a');
799
- const EventB = ActivationEvent.make('dxos.org/test/event-b');
800
+ const EventA = ActivationEvent.make('org.dxos.test.event-a');
801
+ const EventB = ActivationEvent.make('org.dxos.test.event-b');
800
802
 
801
803
  let activateCallCount = 0;
802
- const ConcurrentPlugin = Plugin.define({ id: 'dxos.org/test/concurrent-plugin', name: 'Concurrent Plugin' }).pipe(
804
+ const ConcurrentPlugin = Plugin.define({ id: 'org.dxos.test.concurrent-plugin', name: 'Concurrent Plugin' }).pipe(
803
805
  Plugin.addModule({
804
806
  id: 'ConcurrentModule',
805
807
  // Module activates on either event - this allows two different events to race.
@@ -842,4 +844,250 @@ describe('PluginManager', () => {
842
844
  assert.strictEqual(strings[0].string, 'concurrent');
843
845
  }),
844
846
  );
847
+
848
+ it.effect('should deactivate all active modules on shutdown', () =>
849
+ Effect.gen(function* () {
850
+ const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
851
+ Plugin.addModule({
852
+ activatesOn: ActivationEvents.Startup,
853
+ id: 'Plugin1',
854
+ activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
855
+ }),
856
+ Plugin.make,
857
+ );
858
+ const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
859
+ Plugin.addModule({
860
+ activatesOn: ActivationEvents.Startup,
861
+ id: 'Plugin2',
862
+ activate: () => Effect.succeed(Capability.contributes(Number, { number: 42 })),
863
+ }),
864
+ Plugin.make,
865
+ );
866
+ const plugin1 = Plugin1();
867
+ const plugin2 = Plugin2();
868
+ plugins = [plugin1, plugin2];
869
+
870
+ const manager = PluginManager.make({ pluginLoader });
871
+ yield* manager.add(Plugin1.meta.id);
872
+ yield* manager.add(Plugin2.meta.id);
873
+ yield* manager.activate(ActivationEvents.Startup);
874
+ assert.strictEqual(manager.getActive().length, 2);
875
+ assert.strictEqual(manager.capabilities.getAll(String).length, 1);
876
+ assert.strictEqual(manager.capabilities.getAll(Number).length, 1);
877
+
878
+ const result = yield* manager.shutdown();
879
+ assert.isTrue(result);
880
+ assert.deepStrictEqual(manager.getActive(), []);
881
+ assert.strictEqual(manager.capabilities.getAll(String).length, 0);
882
+ assert.strictEqual(manager.capabilities.getAll(Number).length, 0);
883
+ }),
884
+ );
885
+
886
+ it.effect('should run capability deactivate hooks during shutdown', () =>
887
+ Effect.gen(function* () {
888
+ let deactivated = false;
889
+ const Test = Plugin.define(testMeta).pipe(
890
+ Plugin.addModule({
891
+ id: 'WithDeactivate',
892
+ activatesOn: ActivationEvents.Startup,
893
+ activate: () =>
894
+ Effect.succeed(
895
+ Capability.contributes(String, { string: 'hello' }, () =>
896
+ Effect.sync(() => {
897
+ deactivated = true;
898
+ }),
899
+ ),
900
+ ),
901
+ }),
902
+ Plugin.make,
903
+ );
904
+ const testPlugin = Test();
905
+ plugins = [testPlugin];
906
+
907
+ const manager = PluginManager.make({ pluginLoader });
908
+ yield* manager.add(testMeta.id);
909
+ yield* manager.activate(ActivationEvents.Startup);
910
+ assert.isFalse(deactivated);
911
+
912
+ yield* manager.shutdown();
913
+ assert.isTrue(deactivated);
914
+ }),
915
+ );
916
+
917
+ it.effect('should deactivate modules in reverse activation order during shutdown', () =>
918
+ Effect.gen(function* () {
919
+ const deactivationOrder: string[] = [];
920
+ const Plugin1 = Plugin.define({ id: 'org.dxos.test.plugin-1', name: 'Plugin 1' }).pipe(
921
+ Plugin.addModule({
922
+ activatesOn: ActivationEvents.Startup,
923
+ id: 'First',
924
+ activate: () =>
925
+ Effect.succeed(
926
+ Capability.contributes(String, { string: 'first' }, () =>
927
+ Effect.sync(() => {
928
+ deactivationOrder.push('First');
929
+ }),
930
+ ),
931
+ ),
932
+ }),
933
+ Plugin.make,
934
+ );
935
+ const Plugin2 = Plugin.define({ id: 'org.dxos.test.plugin-2', name: 'Plugin 2' }).pipe(
936
+ Plugin.addModule({
937
+ activatesOn: ActivationEvents.Startup,
938
+ id: 'Second',
939
+ activate: () =>
940
+ Effect.succeed(
941
+ Capability.contributes(Number, { number: 2 }, () =>
942
+ Effect.sync(() => {
943
+ deactivationOrder.push('Second');
944
+ }),
945
+ ),
946
+ ),
947
+ }),
948
+ Plugin.make,
949
+ );
950
+ plugins = [Plugin1(), Plugin2()];
951
+
952
+ const manager = PluginManager.make({ pluginLoader });
953
+ yield* manager.add(Plugin1.meta.id);
954
+ yield* manager.add(Plugin2.meta.id);
955
+ yield* manager.activate(ActivationEvents.Startup);
956
+
957
+ yield* manager.shutdown();
958
+ assert.deepStrictEqual(deactivationOrder, ['Second', 'First']);
959
+ }),
960
+ );
961
+
962
+ it.effect('should clear lifecycle bookkeeping during shutdown', () =>
963
+ Effect.gen(function* () {
964
+ const Test = Plugin.define(testMeta).pipe(
965
+ Plugin.addModule({
966
+ id: 'Hello',
967
+ activatesOn: ActivationEvents.Startup,
968
+ activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
969
+ }),
970
+ Plugin.make,
971
+ );
972
+ const testPlugin = Test();
973
+ plugins = [testPlugin];
974
+
975
+ const manager = PluginManager.make({ pluginLoader });
976
+ yield* manager.add(testMeta.id);
977
+ yield* manager.activate(ActivationEvents.Startup);
978
+ assert.isTrue(manager.getEventsFired().length > 0);
979
+
980
+ yield* manager.shutdown();
981
+ assert.deepStrictEqual(manager.getEventsFired(), []);
982
+ assert.deepStrictEqual(manager.getPendingReset(), []);
983
+ assert.deepStrictEqual(manager.getActive(), []);
984
+ }),
985
+ );
986
+
987
+ it.effect('should interrupt in-flight activation during shutdown', () =>
988
+ Effect.gen(function* () {
989
+ const activationStarted = yield* Effect.makeLatch(false);
990
+ const allowActivationToComplete = yield* Effect.makeLatch(false);
991
+ const Test = Plugin.define(testMeta).pipe(
992
+ Plugin.addModule({
993
+ id: 'Hello',
994
+ activatesOn: ActivationEvents.Startup,
995
+ activate: () =>
996
+ Effect.gen(function* () {
997
+ yield* activationStarted.open;
998
+ yield* allowActivationToComplete.await;
999
+ return Capability.contributes(String, { string: 'hello' });
1000
+ }),
1001
+ }),
1002
+ Plugin.make,
1003
+ );
1004
+ const testPlugin = Test();
1005
+ plugins = [testPlugin];
1006
+
1007
+ const manager = PluginManager.make({ pluginLoader });
1008
+ yield* manager.add(testMeta.id);
1009
+
1010
+ const activationFiber = yield* Effect.fork(manager.activate(ActivationEvents.Startup));
1011
+ yield* activationStarted.await;
1012
+
1013
+ const shutdownFiber = yield* Effect.fork(manager.shutdown());
1014
+ yield* allowActivationToComplete.open;
1015
+
1016
+ const shutdownResult = yield* Fiber.join(shutdownFiber);
1017
+ const activationExit = yield* Fiber.await(activationFiber);
1018
+
1019
+ assert.isTrue(shutdownResult);
1020
+ assert.isTrue(Exit.isFailure(activationExit));
1021
+ if (Exit.isFailure(activationExit)) {
1022
+ assert.isTrue(Cause.isInterruptedOnly(activationExit.cause));
1023
+ }
1024
+ assert.strictEqual(manager.capabilities.getAll(String).length, 0);
1025
+ assert.deepStrictEqual(manager.getActive(), []);
1026
+ assert.deepStrictEqual(manager.getEventsFired(), []);
1027
+ }),
1028
+ );
1029
+
1030
+ it.effect('should preserve plugins, core, enabled, and modules after shutdown', () =>
1031
+ Effect.gen(function* () {
1032
+ const Test = Plugin.define(testMeta).pipe(
1033
+ Plugin.addModule({
1034
+ id: 'Hello',
1035
+ activatesOn: ActivationEvents.Startup,
1036
+ activate: () => Effect.succeed(Capability.contributes(String, { string: 'hello' })),
1037
+ }),
1038
+ Plugin.make,
1039
+ );
1040
+ const testPlugin = Test();
1041
+ plugins = [testPlugin];
1042
+
1043
+ const manager = PluginManager.make({ pluginLoader });
1044
+ yield* manager.add(testMeta.id);
1045
+ yield* manager.activate(ActivationEvents.Startup);
1046
+
1047
+ const pluginsBefore = manager.getPlugins();
1048
+ const coreBefore = manager.getCore();
1049
+ const enabledBefore = manager.getEnabled();
1050
+ const modulesBefore = manager.getModules();
1051
+
1052
+ yield* manager.shutdown();
1053
+
1054
+ assert.deepStrictEqual(manager.getPlugins(), pluginsBefore);
1055
+ assert.deepStrictEqual(manager.getCore(), coreBefore);
1056
+ assert.deepStrictEqual(manager.getEnabled(), enabledBefore);
1057
+ assert.deepStrictEqual(manager.getModules(), modulesBefore);
1058
+ }),
1059
+ );
1060
+
1061
+ it.effect('should allow re-activation after shutdown', () =>
1062
+ Effect.gen(function* () {
1063
+ let activateCount = 0;
1064
+ const Test = Plugin.define(testMeta).pipe(
1065
+ Plugin.addModule({
1066
+ id: 'Hello',
1067
+ activatesOn: ActivationEvents.Startup,
1068
+ activate: () => {
1069
+ activateCount++;
1070
+ return Effect.succeed(Capability.contributes(String, { string: 'hello' }));
1071
+ },
1072
+ }),
1073
+ Plugin.make,
1074
+ );
1075
+ const testPlugin = Test();
1076
+ plugins = [testPlugin];
1077
+
1078
+ const manager = PluginManager.make({ pluginLoader });
1079
+ yield* manager.add(testMeta.id);
1080
+ yield* manager.activate(ActivationEvents.Startup);
1081
+ assert.strictEqual(activateCount, 1);
1082
+ assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
1083
+
1084
+ yield* manager.shutdown();
1085
+ assert.deepStrictEqual(manager.getActive(), []);
1086
+
1087
+ yield* manager.activate(ActivationEvents.Startup);
1088
+ assert.strictEqual(activateCount, 2);
1089
+ assert.deepStrictEqual(manager.getActive(), [testPlugin.modules[0].id]);
1090
+ assert.strictEqual(manager.capabilities.getAll(String).length, 1);
1091
+ }),
1092
+ );
845
1093
  });