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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/browser/{capability-LF3OXSCV.mjs → capability-JCUNWZ66.mjs} +12 -11
  4. package/dist/lib/browser/capability-JCUNWZ66.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-WEBSGU5L.mjs → chunk-2ZIYRDAF.mjs} +20 -5
  6. package/dist/lib/browser/chunk-2ZIYRDAF.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-5GY3YOEL.mjs +28 -0
  8. package/dist/lib/browser/chunk-5GY3YOEL.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-272IPLHQ.mjs → chunk-66IXTIVK.mjs} +3 -2
  10. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-7MBI66M7.mjs +587 -0
  12. package/dist/lib/browser/chunk-7MBI66M7.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-BMLCIFZW.mjs +1467 -0
  14. package/dist/lib/browser/chunk-BMLCIFZW.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-7M4467QR.mjs → chunk-DC3WRPBV.mjs} +100 -18
  16. package/dist/lib/browser/chunk-DC3WRPBV.mjs.map +7 -0
  17. package/dist/lib/browser/{chunk-JGWCBVKJ.mjs → chunk-E5DTDNDY.mjs} +28 -55
  18. package/dist/lib/browser/chunk-E5DTDNDY.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
  20. package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
  21. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  22. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-YNFPIQGB.mjs → chunk-IW44C7UL.mjs} +9 -2
  24. package/dist/lib/browser/chunk-IW44C7UL.mjs.map +7 -0
  25. package/dist/lib/browser/chunk-KZUDO43J.mjs +422 -0
  26. package/dist/lib/browser/chunk-KZUDO43J.mjs.map +7 -0
  27. package/dist/lib/browser/chunk-Q2GLJTVV.mjs +12 -0
  28. package/dist/lib/browser/chunk-Q2GLJTVV.mjs.map +7 -0
  29. package/dist/lib/browser/chunk-VBG5F5UF.mjs +476 -0
  30. package/dist/lib/browser/chunk-VBG5F5UF.mjs.map +7 -0
  31. package/dist/lib/browser/cli/index.mjs +15 -30
  32. package/dist/lib/browser/cli/index.mjs.map +3 -3
  33. package/dist/lib/browser/common/activation-events.mjs +11 -14
  34. package/dist/lib/browser/common/capabilities.mjs +19 -8
  35. package/dist/lib/browser/core/activation-event.mjs +1 -1
  36. package/dist/lib/browser/core/capability.mjs +5 -1
  37. package/dist/lib/browser/core/plugin-manager.mjs +8 -4
  38. package/dist/lib/browser/core/plugin.mjs +18 -4
  39. package/dist/lib/browser/core/url-loader.mjs +24 -0
  40. package/dist/lib/browser/index.mjs +51 -54
  41. package/dist/lib/browser/index.mjs.map +4 -4
  42. package/dist/lib/browser/meta.json +1 -1
  43. package/dist/lib/browser/process-manager-capability-4FUA4TRP.mjs +89 -0
  44. package/dist/lib/browser/process-manager-capability-4FUA4TRP.mjs.map +7 -0
  45. package/dist/lib/browser/testing/index.mjs +198 -54
  46. package/dist/lib/browser/testing/index.mjs.map +4 -4
  47. package/dist/lib/browser/testing/react.mjs +78 -0
  48. package/dist/lib/browser/testing/react.mjs.map +7 -0
  49. package/dist/lib/browser/ui/index.mjs +22 -15
  50. package/dist/lib/node-esm/{capability-SA6LPYGL.mjs → capability-7TCQK7ZP.mjs} +12 -11
  51. package/dist/lib/node-esm/capability-7TCQK7ZP.mjs.map +7 -0
  52. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
  53. package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
  54. package/dist/lib/node-esm/chunk-4BX2AE47.mjs +1468 -0
  55. package/dist/lib/node-esm/chunk-4BX2AE47.mjs.map +7 -0
  56. package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-CTKEZHKF.mjs} +9 -2
  57. package/dist/lib/node-esm/chunk-CTKEZHKF.mjs.map +7 -0
  58. package/dist/lib/node-esm/chunk-FPW45EZH.mjs +14 -0
  59. package/dist/lib/node-esm/chunk-FPW45EZH.mjs.map +7 -0
  60. package/dist/lib/node-esm/chunk-GEWHMHM7.mjs +588 -0
  61. package/dist/lib/node-esm/chunk-GEWHMHM7.mjs.map +7 -0
  62. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs +29 -0
  63. package/dist/lib/node-esm/chunk-KFZEB6BV.mjs.map +7 -0
  64. package/dist/lib/node-esm/{chunk-3D66SZHP.mjs → chunk-KSH4OVMY.mjs} +28 -55
  65. package/dist/lib/node-esm/chunk-KSH4OVMY.mjs.map +7 -0
  66. package/dist/lib/node-esm/{chunk-SQICGJBW.mjs → chunk-QBUGLR4H.mjs} +20 -5
  67. package/dist/lib/node-esm/chunk-QBUGLR4H.mjs.map +7 -0
  68. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  69. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  70. package/dist/lib/node-esm/chunk-XGBUKRCK.mjs +423 -0
  71. package/dist/lib/node-esm/chunk-XGBUKRCK.mjs.map +7 -0
  72. package/dist/lib/node-esm/{chunk-JHFY3HTS.mjs → chunk-XIGPWXCQ.mjs} +100 -18
  73. package/dist/lib/node-esm/chunk-XIGPWXCQ.mjs.map +7 -0
  74. package/dist/lib/node-esm/{chunk-6REV5DE7.mjs → chunk-XOCUANHO.mjs} +3 -2
  75. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
  76. package/dist/lib/node-esm/chunk-Y7JKXNDU.mjs +477 -0
  77. package/dist/lib/node-esm/chunk-Y7JKXNDU.mjs.map +7 -0
  78. package/dist/lib/node-esm/cli/index.mjs +15 -30
  79. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  80. package/dist/lib/node-esm/common/activation-events.mjs +11 -14
  81. package/dist/lib/node-esm/common/capabilities.mjs +19 -8
  82. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  83. package/dist/lib/node-esm/core/capability.mjs +5 -1
  84. package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
  85. package/dist/lib/node-esm/core/plugin.mjs +18 -4
  86. package/dist/lib/node-esm/core/url-loader.mjs +25 -0
  87. package/dist/lib/node-esm/index.mjs +51 -54
  88. package/dist/lib/node-esm/index.mjs.map +4 -4
  89. package/dist/lib/node-esm/meta.json +1 -1
  90. package/dist/lib/node-esm/process-manager-capability-F23D62RN.mjs +90 -0
  91. package/dist/lib/node-esm/process-manager-capability-F23D62RN.mjs.map +7 -0
  92. package/dist/lib/node-esm/testing/index.mjs +198 -54
  93. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  94. package/dist/lib/node-esm/testing/react.mjs +79 -0
  95. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  96. package/dist/lib/node-esm/ui/index.mjs +22 -15
  97. package/dist/plugin/node-esm/index.mjs +971 -0
  98. package/dist/plugin/node-esm/index.mjs.map +7 -0
  99. package/dist/plugin/node-esm/meta.json +1 -0
  100. package/dist/types/src/cli/cli.d.ts +1 -3
  101. package/dist/types/src/cli/cli.d.ts.map +1 -1
  102. package/dist/types/src/common/activation-events.d.ts +10 -13
  103. package/dist/types/src/common/activation-events.d.ts.map +1 -1
  104. package/dist/types/src/common/annotations.d.ts +1 -0
  105. package/dist/types/src/common/annotations.d.ts.map +1 -0
  106. package/dist/types/src/common/capabilities.d.ts +113 -12
  107. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  108. package/dist/types/src/common/index.d.ts +0 -1
  109. package/dist/types/src/common/index.d.ts.map +1 -1
  110. package/dist/types/src/common/translations.d.ts +1 -1
  111. package/dist/types/src/core/activation-event.d.ts +4 -4
  112. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  113. package/dist/types/src/core/capability-manager.d.ts +9 -0
  114. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  115. package/dist/types/src/core/capability.d.ts +13 -2
  116. package/dist/types/src/core/capability.d.ts.map +1 -1
  117. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  118. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  119. package/dist/types/src/core/index.d.ts +6 -0
  120. package/dist/types/src/core/index.d.ts.map +1 -1
  121. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  122. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  123. package/dist/types/src/core/plugin-manager.d.ts +238 -7
  124. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  125. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  126. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  127. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  128. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  129. package/dist/types/src/core/plugin.d.ts +213 -11
  130. package/dist/types/src/core/plugin.d.ts.map +1 -1
  131. package/dist/types/src/core/registry.d.ts +107 -0
  132. package/dist/types/src/core/registry.d.ts.map +1 -0
  133. package/dist/types/src/core/url-loader.d.ts +127 -0
  134. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  135. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  136. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  137. package/dist/types/src/helpers.d.ts.map +1 -1
  138. package/dist/types/src/index.d.ts +1 -2
  139. package/dist/types/src/index.d.ts.map +1 -1
  140. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts +3 -0
  141. package/dist/types/src/plugin-process-manager/ProcessManagerPlugin.d.ts.map +1 -0
  142. package/dist/types/src/plugin-process-manager/history/capability.d.ts.map +1 -0
  143. package/dist/types/src/plugin-process-manager/history/errors.d.ts +32 -0
  144. package/dist/types/src/plugin-process-manager/history/errors.d.ts.map +1 -0
  145. package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts +32 -0
  146. package/dist/types/src/plugin-process-manager/history/history-tracker.d.ts.map +1 -0
  147. package/dist/types/src/plugin-process-manager/history/history-tracker.test.d.ts.map +1 -0
  148. package/dist/types/src/plugin-process-manager/history/index.d.ts.map +1 -0
  149. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/types.d.ts +1 -1
  150. package/dist/types/src/plugin-process-manager/history/types.d.ts.map +1 -0
  151. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.d.ts +2 -2
  152. package/dist/types/src/plugin-process-manager/history/undo-mapping.d.ts.map +1 -0
  153. package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.d.ts +1 -1
  154. package/dist/types/src/plugin-process-manager/history/undo-registry.d.ts.map +1 -0
  155. package/dist/types/src/plugin-process-manager/history/undo-registry.test.d.ts.map +1 -0
  156. package/dist/types/src/plugin-process-manager/index.d.ts +3 -0
  157. package/dist/types/src/plugin-process-manager/index.d.ts.map +1 -0
  158. package/dist/types/src/plugin-process-manager/meta.d.ts +3 -0
  159. package/dist/types/src/plugin-process-manager/meta.d.ts.map +1 -0
  160. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +8 -0
  161. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -0
  162. package/dist/types/src/plugin-process-manager/testing.d.ts +59 -0
  163. package/dist/types/src/plugin-process-manager/testing.d.ts.map +1 -0
  164. package/dist/types/src/testing/harness.d.ts +79 -0
  165. package/dist/types/src/testing/harness.d.ts.map +1 -0
  166. package/dist/types/src/testing/index.d.ts +1 -0
  167. package/dist/types/src/testing/index.d.ts.map +1 -1
  168. package/dist/types/src/testing/react.d.ts +27 -0
  169. package/dist/types/src/testing/react.d.ts.map +1 -0
  170. package/dist/types/src/testing/react.test.d.ts +2 -0
  171. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  172. package/dist/types/src/testing/service.d.ts.map +1 -1
  173. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  174. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  175. package/dist/types/src/ui/components/App/App.d.ts +36 -3
  176. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  177. package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
  178. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  179. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  180. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  181. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  182. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  183. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -1
  184. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  185. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  186. package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
  187. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  188. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  189. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  190. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  191. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  192. package/dist/types/src/ui/hooks/index.d.ts +1 -1
  193. package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
  194. package/dist/types/src/ui/hooks/useApp.d.ts +42 -12
  195. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  196. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  197. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  198. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  199. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  200. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts +30 -0
  201. package/dist/types/src/ui/hooks/useProcessManagerRuntime.d.ts.map +1 -0
  202. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  203. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +2 -0
  204. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  205. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +54 -0
  206. package/dist/types/src/vite-plugin/boot-loader/loader.d.ts.map +1 -0
  207. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  208. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  209. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  210. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  211. package/dist/types/src/vite-plugin/index.d.ts +5 -0
  212. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  213. package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
  214. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  215. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  216. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  217. package/dist/types/src/vite-plugin/packages.d.ts +13 -0
  218. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  219. package/dist/types/tsconfig.tsbuildinfo +1 -1
  220. package/moon.yml +15 -0
  221. package/package.json +61 -57
  222. package/src/cli/cli.ts +2 -7
  223. package/src/common/activation-events.ts +10 -15
  224. package/src/common/annotations.ts +3 -0
  225. package/src/common/capabilities.ts +147 -16
  226. package/src/common/index.ts +0 -1
  227. package/src/common/translations.ts +1 -1
  228. package/src/core/activation-event.ts +4 -1
  229. package/src/core/capability-manager.test.ts +4 -1
  230. package/src/core/capability-manager.ts +44 -2
  231. package/src/core/capability.ts +20 -2
  232. package/src/core/edge-registry-plugin-provider.ts +92 -0
  233. package/src/core/index.ts +6 -0
  234. package/src/core/plugin-asset-cache.ts +60 -0
  235. package/src/core/plugin-manager.test.ts +1103 -19
  236. package/src/core/plugin-manager.ts +1176 -199
  237. package/src/core/plugin-manifest.test.ts +75 -0
  238. package/src/core/plugin-manifest.ts +134 -0
  239. package/src/core/plugin.ts +235 -17
  240. package/src/core/registry.ts +163 -0
  241. package/src/core/url-loader.test.ts +222 -0
  242. package/src/core/url-loader.ts +388 -0
  243. package/src/index.ts +1 -2
  244. package/src/plugin-process-manager/ProcessManagerPlugin.ts +24 -0
  245. package/src/{plugin-operation → plugin-process-manager}/history/capability.ts +1 -2
  246. package/src/plugin-process-manager/history/errors.ts +7 -0
  247. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.ts +61 -88
  248. package/src/{plugin-operation → plugin-process-manager}/history/history-tracker.ts +33 -18
  249. package/src/{plugin-operation → plugin-process-manager}/history/types.ts +1 -1
  250. package/src/{plugin-operation → plugin-process-manager}/history/undo-mapping.ts +2 -2
  251. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.ts +6 -5
  252. package/src/{plugin-operation → plugin-process-manager}/history/undo-registry.ts +1 -1
  253. package/src/{plugin-operation → plugin-process-manager}/index.ts +1 -1
  254. package/src/plugin-process-manager/meta.ts +16 -0
  255. package/src/plugin-process-manager/process-manager-capability.ts +178 -0
  256. package/src/{plugin-operation → plugin-process-manager}/testing.ts +32 -50
  257. package/src/testing/harness.ts +247 -0
  258. package/src/testing/index.ts +1 -0
  259. package/src/testing/react.test.tsx +50 -0
  260. package/src/testing/react.tsx +113 -0
  261. package/src/testing/service.ts +2 -2
  262. package/src/testing/withPluginManager.stories.tsx +1 -2
  263. package/src/testing/withPluginManager.tsx +47 -21
  264. package/src/ui/components/App/App.stories.tsx +12 -20
  265. package/src/ui/components/App/App.tsx +97 -10
  266. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +13 -17
  267. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +17 -16
  268. package/src/ui/components/Surface/SurfaceComponent.tsx +111 -55
  269. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -1
  270. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  271. package/src/ui/components/Surface/index.ts +35 -1
  272. package/src/ui/components/Surface/types.test.ts +126 -0
  273. package/src/ui/components/Surface/types.ts +185 -12
  274. package/src/ui/hooks/index.ts +1 -1
  275. package/src/ui/hooks/useApp.test.tsx +161 -0
  276. package/src/ui/hooks/useApp.tsx +215 -24
  277. package/src/ui/hooks/useCapabilities.ts +1 -0
  278. package/src/ui/hooks/useLoading.tsx +14 -6
  279. package/src/ui/hooks/useProcessManagerRuntime.ts +78 -0
  280. package/src/vite-plugin/boot-loader/BootLoader.solid-stories.tsx +198 -0
  281. package/src/vite-plugin/boot-loader/index.ts +5 -0
  282. package/src/vite-plugin/boot-loader/loader-app/Loader.tsx +166 -0
  283. package/src/vite-plugin/boot-loader/loader-app/boot-loader.css +311 -0
  284. package/src/vite-plugin/boot-loader/loader-app/bridge.ts +25 -0
  285. package/src/vite-plugin/boot-loader/loader-app/entry.tsx +21 -0
  286. package/src/vite-plugin/boot-loader/loader-app/mount.tsx +70 -0
  287. package/src/vite-plugin/boot-loader/loader-app/store.test.ts +137 -0
  288. package/src/vite-plugin/boot-loader/loader-app/store.ts +149 -0
  289. package/src/vite-plugin/boot-loader/loader-app/tsconfig.json +11 -0
  290. package/src/vite-plugin/boot-loader/loader-app/types.ts +78 -0
  291. package/src/vite-plugin/boot-loader/loader.ts +193 -0
  292. package/src/vite-plugin/composer/index.ts +306 -0
  293. package/src/vite-plugin/import-map/index.ts +527 -0
  294. package/src/vite-plugin/index.ts +10 -0
  295. package/src/vite-plugin/manifest.test.ts +55 -0
  296. package/src/vite-plugin/manifest.ts +63 -0
  297. package/src/vite-plugin/packages.ts +187 -0
  298. package/tsconfig.json +26 -3
  299. package/tsconfig.node.json +1 -1
  300. package/vitest.config.ts +1 -1
  301. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  302. package/dist/lib/browser/capability-6YMUBS54.mjs +0 -37
  303. package/dist/lib/browser/capability-6YMUBS54.mjs.map +0 -7
  304. package/dist/lib/browser/capability-LF3OXSCV.mjs.map +0 -7
  305. package/dist/lib/browser/chunk-272IPLHQ.mjs.map +0 -7
  306. package/dist/lib/browser/chunk-2UI6ACB5.mjs +0 -824
  307. package/dist/lib/browser/chunk-2UI6ACB5.mjs.map +0 -7
  308. package/dist/lib/browser/chunk-7M4467QR.mjs.map +0 -7
  309. package/dist/lib/browser/chunk-JGWCBVKJ.mjs.map +0 -7
  310. package/dist/lib/browser/chunk-M5IC326L.mjs +0 -34
  311. package/dist/lib/browser/chunk-M5IC326L.mjs.map +0 -7
  312. package/dist/lib/browser/chunk-NQPYE365.mjs +0 -703
  313. package/dist/lib/browser/chunk-NQPYE365.mjs.map +0 -7
  314. package/dist/lib/browser/chunk-TIEBZMTF.mjs +0 -44
  315. package/dist/lib/browser/chunk-TIEBZMTF.mjs.map +0 -7
  316. package/dist/lib/browser/chunk-WEBSGU5L.mjs.map +0 -7
  317. package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
  318. package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
  319. package/dist/lib/browser/invoker-capability-4AUGUMM5.mjs +0 -36
  320. package/dist/lib/browser/invoker-capability-4AUGUMM5.mjs.map +0 -7
  321. package/dist/lib/node-esm/capability-R5O2OYX4.mjs +0 -38
  322. package/dist/lib/node-esm/capability-R5O2OYX4.mjs.map +0 -7
  323. package/dist/lib/node-esm/capability-SA6LPYGL.mjs.map +0 -7
  324. package/dist/lib/node-esm/chunk-3D66SZHP.mjs.map +0 -7
  325. package/dist/lib/node-esm/chunk-6REV5DE7.mjs.map +0 -7
  326. package/dist/lib/node-esm/chunk-FHWPWQRJ.mjs +0 -704
  327. package/dist/lib/node-esm/chunk-FHWPWQRJ.mjs.map +0 -7
  328. package/dist/lib/node-esm/chunk-JHFY3HTS.mjs.map +0 -7
  329. package/dist/lib/node-esm/chunk-JIVXIJ2T.mjs +0 -825
  330. package/dist/lib/node-esm/chunk-JIVXIJ2T.mjs.map +0 -7
  331. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs +0 -35
  332. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs.map +0 -7
  333. package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
  334. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs +0 -45
  335. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs.map +0 -7
  336. package/dist/lib/node-esm/chunk-SQICGJBW.mjs.map +0 -7
  337. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
  338. package/dist/lib/node-esm/invoker-capability-3YDIVDWV.mjs +0 -37
  339. package/dist/lib/node-esm/invoker-capability-3YDIVDWV.mjs.map +0 -7
  340. package/dist/types/src/common/operations.d.ts +0 -33
  341. package/dist/types/src/common/operations.d.ts.map +0 -1
  342. package/dist/types/src/plugin-operation/OperationPlugin.d.ts +0 -3
  343. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +0 -1
  344. package/dist/types/src/plugin-operation/history/capability.d.ts.map +0 -1
  345. package/dist/types/src/plugin-operation/history/errors.d.ts +0 -5
  346. package/dist/types/src/plugin-operation/history/errors.d.ts.map +0 -1
  347. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +0 -18
  348. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +0 -1
  349. package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +0 -1
  350. package/dist/types/src/plugin-operation/history/index.d.ts.map +0 -1
  351. package/dist/types/src/plugin-operation/history/types.d.ts.map +0 -1
  352. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +0 -1
  353. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +0 -1
  354. package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +0 -1
  355. package/dist/types/src/plugin-operation/index.d.ts +0 -3
  356. package/dist/types/src/plugin-operation/index.d.ts.map +0 -1
  357. package/dist/types/src/plugin-operation/invoker-capability.d.ts +0 -6
  358. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +0 -1
  359. package/dist/types/src/plugin-operation/meta.d.ts +0 -3
  360. package/dist/types/src/plugin-operation/meta.d.ts.map +0 -1
  361. package/dist/types/src/plugin-operation/testing.d.ts +0 -109
  362. package/dist/types/src/plugin-operation/testing.d.ts.map +0 -1
  363. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +0 -3
  364. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +0 -1
  365. package/dist/types/src/plugin-runtime/capability.d.ts +0 -6
  366. package/dist/types/src/plugin-runtime/capability.d.ts.map +0 -1
  367. package/dist/types/src/plugin-runtime/index.d.ts +0 -2
  368. package/dist/types/src/plugin-runtime/index.d.ts.map +0 -1
  369. package/dist/types/src/plugin-runtime/meta.d.ts +0 -3
  370. package/dist/types/src/plugin-runtime/meta.d.ts.map +0 -1
  371. package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
  372. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
  373. package/src/common/operations.ts +0 -38
  374. package/src/plugin-operation/OperationPlugin.ts +0 -25
  375. package/src/plugin-operation/history/errors.ts +0 -11
  376. package/src/plugin-operation/invoker-capability.ts +0 -40
  377. package/src/plugin-operation/meta.ts +0 -11
  378. package/src/plugin-runtime/RuntimePlugin.ts +0 -20
  379. package/src/plugin-runtime/capability.ts +0 -53
  380. package/src/plugin-runtime/index.ts +0 -5
  381. package/src/plugin-runtime/meta.ts +0 -11
  382. package/src/ui/hooks/useOperationResolver.ts +0 -40
  383. /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
  384. /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
  385. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/capability.d.ts +0 -0
  386. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/history-tracker.test.d.ts +0 -0
  387. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/index.d.ts +0 -0
  388. /package/dist/types/src/{plugin-operation → plugin-process-manager}/history/undo-registry.test.d.ts +0 -0
  389. /package/src/{plugin-operation → plugin-process-manager}/history/index.ts +0 -0
@@ -23,11 +23,48 @@ import { App, PluginManagerProvider } from '../components';
23
23
 
24
24
  const ENABLED_KEY = 'org.dxos.app-framework.enabled';
25
25
 
26
+ export type StartupProgress = {
27
+ /** Number of modules that have been activated. */
28
+ activated: number;
29
+ /** Total number of modules registered. */
30
+ total: number;
31
+ /** Fractional progress (0-1). */
32
+ progress: number;
33
+ /**
34
+ * Raw activation event key (e.g. `org.dxos.app-framework.event.startup`).
35
+ * Set on event-level transitions, *and* on module-level transitions where
36
+ * it carries the parent activation event that first triggered the
37
+ * module's load (plumbed through `_loadCapabilitiesForModules` →
38
+ * `_loadModule`). Consumers can use this either as the primary id (when
39
+ * {@link module} is absent) or as an extra "context" field alongside
40
+ * {@link module}.
41
+ */
42
+ event?: string;
43
+ /**
44
+ * Raw module id (e.g. `org.dxos.plugin.observability.module.ReactSurface`)
45
+ * when the in-flight activation is module-level. When present,
46
+ * {@link event} may also be set, identifying the parent activation that
47
+ * triggered this module's load.
48
+ */
49
+ module?: string;
50
+ /**
51
+ * Pre-humanized label for the currently surfaced transition (module
52
+ * label if {@link module} is set, otherwise the event label), supplied
53
+ * for consumers that want a sensible default. Hosts that prefer to
54
+ * render their own label can read the raw {@link event}/{@link module}
55
+ * fields and ignore this — the framework leaves the policy choice
56
+ * (which transitions to surface, how to format them, whether to drop
57
+ * sub-modules entirely) to the host's `Placeholder`.
58
+ */
59
+ humanizedName?: string;
60
+ };
61
+
26
62
  export type UseAppOptions = {
27
63
  pluginManager?: PluginManager.PluginManager;
28
64
  pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];
65
+ onPluginRemove?: PluginManager.ManagerOptions['onRemove'];
66
+ pluginRegistryProvider?: PluginManager.ManagerOptions['pluginRegistryProvider'];
29
67
  plugins?: Plugin.Plugin[];
30
- core?: string[];
31
68
  defaults?: string[];
32
69
  /**
33
70
  * Additional activation events to fire before startup.
@@ -39,7 +76,6 @@ export type UseAppOptions = {
39
76
  debounce?: number;
40
77
  timeout?: number;
41
78
  fallback?: FC<FallbackProps>;
42
- placeholder?: FC<{ stage: number }>;
43
79
  };
44
80
 
45
81
  /**
@@ -48,10 +84,9 @@ export type UseAppOptions = {
48
84
  *
49
85
  * @example
50
86
  * const plugins = [LayoutPlugin(), MyPlugin()];
51
- * const core = [LayoutPluginId];
52
- * const default = [MyPluginId];
53
- * const fallback = <div>Initializing Plugins...</div>;
54
- * const App = useApp({ plugins, core, default, fallback });
87
+ * const defaults = [MyPluginId];
88
+ * const fallback = () => <div>Initializing Plugins...</div>;
89
+ * const App = useApp({ plugins, defaults, fallback });
55
90
  * createRoot(document.getElementById('root')!).render(
56
91
  * <StrictMode>
57
92
  * <App />
@@ -59,22 +94,20 @@ export type UseAppOptions = {
59
94
  * );
60
95
  *
61
96
  * @param params.pluginLoader A function which loads new plugins.
62
- * @param params.plugins All plugins available to the application.
63
- * @param params.core Core plugins which will always be enabled.
97
+ * @param params.plugins All plugins available to the application. Plugins whose `meta.tags` includes `'system'` are treated as core (force-enabled, not user-toggleable).
64
98
  * @param params.defaults Default plugins are enabled by default but can be disabled by the user.
65
99
  * @param params.cacheEnabled Whether to cache enabled plugins in localStorage.
66
100
  * @param params.safeMode Whether to enable safe mode, which disables optional plugins.
67
101
  * @param params.fallback Fallback component to render if an error occurs during startup.
68
- * @param params.placeholder Placeholder component to render during startup.
69
102
  */
70
103
  export const useApp = ({
71
104
  pluginManager,
72
105
  pluginLoader: pluginLoaderProp,
106
+ onPluginRemove,
107
+ pluginRegistryProvider,
73
108
  plugins: pluginsProp,
74
- core: coreProp,
75
109
  defaults: defaultsProp,
76
110
  setupEvents: setupEventsProp,
77
- placeholder,
78
111
  fallback = ErrorFallback,
79
112
  cacheEnabled = false,
80
113
  safeMode = false,
@@ -82,11 +115,9 @@ export const useApp = ({
82
115
  timeout = 30_000,
83
116
  }: UseAppOptions) => {
84
117
  const plugins = useDefaultValue(pluginsProp, () => []);
85
- const core = useDefaultValue(coreProp, () => plugins.map(({ meta }) => meta.id));
86
118
  const defaults = useDefaultValue(defaultsProp, () => []);
87
119
  const setupEvents = useDefaultValue(setupEventsProp, () => []);
88
120
 
89
- // TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.
90
121
  const pluginLoader = useMemo(
91
122
  () =>
92
123
  pluginLoaderProp ??
@@ -94,7 +125,7 @@ export const useApp = ({
94
125
  Effect.sync(() => {
95
126
  const plugin = plugins.find((plugin) => plugin.meta.id === id);
96
127
  invariant(plugin, `Plugin not found: ${id}`);
97
- return plugin;
128
+ return { plugin };
98
129
  })),
99
130
  [pluginLoaderProp, plugins],
100
131
  );
@@ -103,16 +134,31 @@ export const useApp = ({
103
134
  const [ready, setReady] = useState(false);
104
135
  const errorRef = useRef<unknown>(null);
105
136
  const [error, setError] = useState<unknown>(null);
137
+ const [startupProgress, setStartupProgress] = useState<StartupProgress>({
138
+ activated: 0,
139
+ total: 0,
140
+ progress: 0,
141
+ });
106
142
  // TODO(wittjosiah): Migrate to Atom.kvs for isomorphic storage.
107
143
  const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);
108
144
  const enabled = useMemo(
109
145
  () => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),
110
146
  [safeMode, cacheEnabled, cached, defaults],
111
147
  );
112
- const manager = useMemo(
113
- () => pluginManager ?? PluginManager.make({ pluginLoader, plugins, core, enabled }),
114
- [pluginManager, pluginLoader, plugins, core, enabled],
115
- );
148
+ const isExternalManager = !!pluginManager;
149
+ const manager = useMemo(() => {
150
+ const mgr =
151
+ pluginManager ??
152
+ PluginManager.make({
153
+ pluginLoader,
154
+ plugins,
155
+ enabled,
156
+ onRemove: onPluginRemove,
157
+ pluginRegistryProvider,
158
+ });
159
+ log('useApp: useMemo created/reused manager', { provided: !!pluginManager });
160
+ return mgr;
161
+ }, [pluginManager, pluginLoader, plugins, enabled, onPluginRemove, pluginRegistryProvider]);
116
162
 
117
163
  useEffect(() => {
118
164
  if (!cacheEnabled) {
@@ -128,6 +174,8 @@ export const useApp = ({
128
174
  }, [manager]);
129
175
 
130
176
  useAsyncEffect(async () => {
177
+ log('useApp: effect mount');
178
+
131
179
  manager.capabilities.contribute({
132
180
  interface: Capabilities.PluginManager,
133
181
  implementation: manager,
@@ -144,12 +192,85 @@ export const useApp = ({
144
192
  const queue = yield* PubSub.subscribe(manager.activation);
145
193
  const listener = yield* Effect.forkDaemon(
146
194
  Queue.take(queue).pipe(
147
- Effect.tap(({ event, state, error: error$ }) =>
195
+ Effect.tap(({ event, state, module, error: error$ }) =>
148
196
  Effect.sync(() => {
149
- if (event === ActivationEvents.Startup.id && state === 'activated') {
197
+ // Event-level Startup activated (no `module` field) fires once,
198
+ // after every module triggered by Startup has finished. Module
199
+ // activations now also carry their parent event id (so the trace
200
+ // can attribute a module to its triggering event), which means
201
+ // each module activated under Startup publishes
202
+ // `{ event: 'startup', state: 'activated', module: <id> }`. Without
203
+ // the `!module` guard the listener would mark the app ready on
204
+ // the *first* such module rather than waiting for the event-level
205
+ // completion — leaving downstream capabilities (operation-invoker,
206
+ // app-graph, …) un-registered when the boot loader dismisses.
207
+ if (event === ActivationEvents.Startup.id && state === 'activated' && !module) {
150
208
  clearTimeout(timeoutId);
151
209
  setReady(true);
152
210
  readyRef.current = true;
211
+ // Trigger startup profiler dump if available.
212
+ (globalThis as any).composer?.profiler?.dump();
213
+ // Notify any host observability layer that startup completed.
214
+ // A `CustomEvent` keeps this generic — app-framework doesn't
215
+ // import a provider, and consumers can capture the startup
216
+ // summary without us picking one.
217
+ if (typeof window !== 'undefined') {
218
+ window.dispatchEvent(new CustomEvent('app-framework:startup-activated'));
219
+ }
220
+ return;
221
+ }
222
+ // `activating` is the start-of-load signal. Surface the raw
223
+ // `module` (or `event`) plus a pre-humanized label so the
224
+ // boot loader can decide how to render each transition — show
225
+ // everything, suppress noisy sub-modules, group by plugin,
226
+ // or apply its own formatting. We intentionally do NOT touch
227
+ // these fields on `activated`: pairing the two would cause
228
+ // back-to-back identical updates to the host's effect, which
229
+ // the boot loader treats as a re-trigger because
230
+ // `progress.progress` moved. Leaving the label alone on
231
+ // completion keeps it accurate ("now activating X") until
232
+ // the next module starts.
233
+ if (module && state === 'activating' && !readyRef.current) {
234
+ setStartupProgress((current) => ({
235
+ ...current,
236
+ // `event` here is the activation event that first
237
+ // triggered this module load (plumbed through
238
+ // `_loadCapabilitiesForModules` → `_loadModule`).
239
+ // Falsy/empty falls back to undefined so consumers can
240
+ // tell "no parent context" from "parent context: <X>".
241
+ event: event || undefined,
242
+ module,
243
+ humanizedName: humanizeModuleId(module),
244
+ }));
245
+ }
246
+ // Update the activation count when a module commits. The
247
+ // ring's fraction comes from this; `event`/`module`/
248
+ // `humanizedName` were set by the matching `activating`
249
+ // message above and are left alone so the count can advance
250
+ // without re-firing the host's status callback.
251
+ if (module && state === 'activated' && !readyRef.current) {
252
+ const active = manager.getActive();
253
+ const total = manager.getModules().length;
254
+ setStartupProgress((current) => ({
255
+ ...current,
256
+ activated: active.length,
257
+ total,
258
+ progress: total > 0 ? active.length / total : 0,
259
+ }));
260
+ }
261
+ // Event-level `activating` (no `module`) — fired at the start
262
+ // of `_activateModulesForEvent` and recursively for each
263
+ // before/after event. Surfaces a label during the gap before
264
+ // the first module-level message lands; subsequent module
265
+ // updates immediately overwrite this with a more specific
266
+ // label.
267
+ if (event && !module && state === 'activating' && !readyRef.current) {
268
+ setStartupProgress((current) => ({
269
+ ...current,
270
+ event,
271
+ module: undefined,
272
+ humanizedName: humanizeEventKey(event),
273
+ }));
153
274
  }
154
275
  if (error$ && !readyRef.current) {
155
276
  setError(error$);
@@ -184,26 +305,31 @@ export const useApp = ({
184
305
  }, timeout);
185
306
 
186
307
  return () => {
308
+ log('useApp: effect cleanup');
187
309
  clearTimeout(timeoutId);
188
310
  void runAndForwardErrors(Fiber.interrupt(fiber));
189
- manager.capabilities.remove(Capabilities.PluginManager, manager);
190
- manager.capabilities.remove(Capabilities.AtomRegistry, manager.registry);
311
+ if (!isExternalManager) {
312
+ void runAndForwardErrors(manager.shutdown());
313
+ }
191
314
  };
192
315
  }, [manager]);
193
316
 
317
+ const progressRef = useRef(startupProgress);
318
+ progressRef.current = startupProgress;
319
+
194
320
  return useCallback(
195
321
  () => (
196
322
  <ErrorBoundary name='app' FallbackComponent={fallback}>
197
323
  <PluginManagerProvider value={manager}>
198
324
  <ContextProtocolProvider value={manager} context={PluginManagerContext}>
199
325
  <RegistryContext.Provider value={manager.registry}>
200
- <App placeholder={placeholder} ready={ready} error={error} debounce={debounce} />
326
+ <App ready={ready} error={error} debounce={debounce} progress={progressRef.current} />
201
327
  </RegistryContext.Provider>
202
328
  </ContextProtocolProvider>
203
329
  </PluginManagerProvider>
204
330
  </ErrorBoundary>
205
331
  ),
206
- [fallback, manager, placeholder, ready, error],
332
+ [fallback, manager, ready, error],
207
333
  );
208
334
  };
209
335
 
@@ -211,3 +337,68 @@ const setupDevtools = (manager: PluginManager.PluginManager) => {
211
337
  (globalThis as any).composer ??= {};
212
338
  (globalThis as any).composer.manager = manager;
213
339
  };
340
+
341
+ /**
342
+ * Extracts a human-readable label from a module ID.
343
+ *
344
+ * Module IDs follow `org.dxos.plugin.<plugin-slug>.module.<module-name>`,
345
+ * where `<plugin-slug>` is kebab-case and `<module-name>` is either an
346
+ * explicit string (often kebab-case, e.g. `'observability'`, `'namespace'`)
347
+ * or a capability tag in PascalCase from `Capability.getModuleTag(...)`
348
+ * (e.g. `'ReactSurface'`, `'AppGraphBuilder'`). The output is
349
+ * `"Title Case Plugin: kebab-module"` so the visible status names both the
350
+ * plugin and the aspect being activated, helping disambiguate the multiple
351
+ * modules a plugin contributes.
352
+ *
353
+ * Examples:
354
+ * - "org.dxos.plugin.markdown.module.ReactSurface" → "Markdown: react-surface"
355
+ * - "org.dxos.plugin.observability.module.AppGraphBuilder" → "Observability: app-graph-builder"
356
+ * - "org.dxos.plugin.observability.module.observability" → "Observability"
357
+ * (the module name matches the plugin slug — collapsed to avoid
358
+ * "Observability: observability" noise.)
359
+ */
360
+ const humanizeModuleId = (moduleId: string): string => {
361
+ const match = moduleId.match(/\.plugin\.([^.]+)\.module\.(.+)$/);
362
+ if (!match) {
363
+ // Fallback: use the last segment.
364
+ const parts = moduleId.split('.');
365
+ return parts[parts.length - 1];
366
+ }
367
+ const [, pluginSlug, moduleName] = match;
368
+ const pluginLabel = pluginSlug
369
+ .split('-')
370
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
371
+ .join(' ');
372
+ // Normalise the module name to kebab-case so PascalCase capability tags
373
+ // ("ReactSurface") read consistently with explicit kebab IDs
374
+ // ("operation-handler"). The two-step substitution handles consecutive
375
+ // uppercase runs (`URLLoader` → `url-loader`) without splitting them
376
+ // mid-acronym.
377
+ const moduleLabel = moduleName
378
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
379
+ .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')
380
+ .toLowerCase();
381
+ // Capability modules whose name matches the plugin slug (e.g. the
382
+ // observability plugin's `observability` capability module) would render
383
+ // as "Observability: observability" — drop the redundant suffix.
384
+ if (moduleLabel === pluginSlug) {
385
+ return pluginLabel;
386
+ }
387
+ return `${pluginLabel}: ${moduleLabel}`;
388
+ };
389
+
390
+ /**
391
+ * Extracts a human-readable label from an activation event key.
392
+ * E.g., "org.dxos.app-framework.event.setup-react-surface" → "Setup React Surface".
393
+ */
394
+ const humanizeEventKey = (eventKey: string): string => {
395
+ // Strip a leading specifier (composite key form: "<id>:<specifier>").
396
+ const id = eventKey.split(':')[0];
397
+ // Match the trailing segment after `.event.`.
398
+ const match = id.match(/\.event\.(.+)$/);
399
+ const slug = match ? match[1] : (id.split('.').pop() ?? id);
400
+ return slug
401
+ .split('-')
402
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
403
+ .join(' ');
404
+ };
@@ -25,6 +25,7 @@ export const useCapabilities = <T>(interfaceDef: Capability.InterfaceDef<T>) =>
25
25
  * @returns The capability.
26
26
  * @throws If no capability is found.
27
27
  */
28
+ // TODO(burdon): Option not to throw?
28
29
  export const useCapability = <T>(interfaceDef: Capability.InterfaceDef<T>) => {
29
30
  const capabilities = useCapabilities(interfaceDef);
30
31
  invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`);
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { useEffect, useState } from 'react';
5
+ import { useEffect, useRef, useState } from 'react';
6
6
 
7
7
  export enum LoadingState {
8
8
  Loading = 0,
@@ -23,6 +23,14 @@ export enum LoadingState {
23
23
  */
24
24
  export const useLoading = (ready: boolean, debounce = 0) => {
25
25
  const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);
26
+ // Mirror `ready` into a ref so the interval's `setStage` callback can read
27
+ // the latest value without depending on the effect re-running. The pure
28
+ // closure-capture pattern (with `ready` in deps) sticks the FSM at
29
+ // `FadeIn` whenever HMR doesn't propagate the dep change end-to-end —
30
+ // a ref sidesteps that entirely and fires the read on every tick.
31
+ const readyRef = useRef(ready);
32
+ readyRef.current = ready;
33
+
26
34
  useEffect(() => {
27
35
  if (!debounce) {
28
36
  return;
@@ -30,18 +38,18 @@ export const useLoading = (ready: boolean, debounce = 0) => {
30
38
 
31
39
  const i = setInterval(() => {
32
40
  setStage((stage) => {
41
+ const isReady = readyRef.current;
33
42
  switch (stage) {
34
43
  case LoadingState.Loading: {
35
- if (!ready) {
44
+ if (!isReady) {
36
45
  return LoadingState.FadeIn;
37
- } else {
38
- clearInterval(i);
39
- return LoadingState.Done;
40
46
  }
47
+ clearInterval(i);
48
+ return LoadingState.Done;
41
49
  }
42
50
 
43
51
  case LoadingState.FadeIn: {
44
- if (ready) {
52
+ if (isReady) {
45
53
  return LoadingState.FadeOut;
46
54
  }
47
55
  break;
@@ -0,0 +1,78 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import * as Context from 'effect/Context';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Layer from 'effect/Layer';
8
+ import { type DependencyList, use, useCallback, useMemo } from 'react';
9
+
10
+ import { Operation, ServiceResolver } from '@dxos/compute';
11
+ import { unwrapExit } from '@dxos/effect';
12
+ import type { SpaceId } from '@dxos/keys';
13
+
14
+ import { Capabilities } from '../../common';
15
+ import { useCapability } from './useCapabilities';
16
+
17
+ /**
18
+ * Resolve the shared {@link Capabilities.ProcessManagerRuntime} from the plugin context.
19
+ */
20
+ export const useProcessManagerRuntime = (): Capabilities.ProcessManagerRuntime =>
21
+ useCapability(Capabilities.ProcessManagerRuntime);
22
+
23
+ /**
24
+ * Build a callback that runs an effect on the {@link Capabilities.ProcessManagerRuntime}
25
+ * with space-scoped services resolved via {@link ServiceResolver.provide}.
26
+ *
27
+ * The `tags` tuple must list every service the effect requires (beyond the
28
+ * fixed {@link Capabilities.ProcessManagerRuntimeServices}); these services are
29
+ * resolved for the given `spaceId` through the runtime's service resolver.
30
+ *
31
+ * Nested `Operation.invoke` / `Operation.schedule` calls within the effect
32
+ * inherit `spaceId` as a default {@link Operation.InvokeOptions} so that
33
+ * spawned operation processes have a space context (and therefore can resolve
34
+ * space-scoped services like `Database.Service`) without each call site having
35
+ * to thread the id through manually.
36
+ */
37
+ export const useSpaceCallback = <const Tags extends readonly Context.Tag<any, any>[], T>(
38
+ spaceId: SpaceId | undefined,
39
+ tags: Tags,
40
+ fn: () => Effect.Effect<T, any, Context.Tag.Identifier<Tags[number]> | Capabilities.ProcessManagerRuntimeServices>,
41
+ deps?: DependencyList,
42
+ ): (() => Promise<T>) => {
43
+ const runtime = useProcessManagerRuntime();
44
+ return useCallback(() => {
45
+ if (spaceId === undefined) {
46
+ throw new TypeError('Space not provided to useSpaceCallback');
47
+ }
48
+ const layer = Layer.merge(
49
+ ServiceResolver.provide({ space: spaceId }, ...tags),
50
+ Operation.withInvocationOptions({ spaceId }),
51
+ );
52
+ return runtime.runPromise(fn().pipe(Effect.provide(layer)) as Effect.Effect<T, any, any>);
53
+ // eslint-disable-next-line react-hooks/exhaustive-deps
54
+ }, [runtime, spaceId, ...(deps ?? [])]);
55
+ };
56
+
57
+ /**
58
+ * Suspensefully resolve a single space-scoped service via the
59
+ * {@link Capabilities.ProcessManagerRuntime}'s service resolver.
60
+ */
61
+ export const useSpaceService = <T extends Context.Tag<any, any>>(
62
+ tag: T,
63
+ spaceId: SpaceId | undefined,
64
+ ): Context.Tag.Service<T> | undefined => {
65
+ const runtime = useProcessManagerRuntime();
66
+ const promise = useMemo(() => {
67
+ if (spaceId === undefined) {
68
+ return undefined;
69
+ }
70
+ const layer = ServiceResolver.provide({ space: spaceId }, tag);
71
+ const effect = Effect.flatMap(tag, (service) => Effect.succeed(service)).pipe(Effect.provide(layer));
72
+ return runtime.runPromiseExit(effect as Effect.Effect<Context.Tag.Service<T>, any, any>);
73
+ }, [runtime, spaceId, tag]);
74
+ if (!promise) {
75
+ return undefined;
76
+ }
77
+ return unwrapExit(use(promise));
78
+ };