@dxos/app-framework 0.10.0 → 0.11.0

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 (294) hide show
  1. package/.storybook/main.mts +1 -1
  2. package/.storybook/preview.mts +2 -2
  3. package/CHANGELOG.md +93 -0
  4. package/TASKS.md +11 -0
  5. package/dist/lib/chunk-SurfaceManager.mjs +960 -0
  6. package/dist/lib/chunk-SurfaceManager.mjs.map +1 -0
  7. package/dist/lib/chunk-capability.mjs +15 -0
  8. package/dist/lib/chunk-capability.mjs.map +1 -0
  9. package/dist/lib/{browser/chunk-FJ4765WW.mjs → chunk-context.mjs} +4 -5
  10. package/dist/lib/chunk-context.mjs.map +1 -0
  11. package/dist/lib/chunk-history-tracker.mjs +160 -0
  12. package/dist/lib/chunk-history-tracker.mjs.map +1 -0
  13. package/dist/lib/chunk-plugin-manager.mjs +1390 -0
  14. package/dist/lib/chunk-plugin-manager.mjs.map +1 -0
  15. package/dist/lib/chunk-plugin-manifest.mjs +125 -0
  16. package/dist/lib/chunk-plugin-manifest.mjs.map +1 -0
  17. package/dist/lib/chunk-process-manager-capability.mjs +126 -0
  18. package/dist/lib/chunk-process-manager-capability.mjs.map +1 -0
  19. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  20. package/dist/lib/chunk-url-loader.mjs +347 -0
  21. package/dist/lib/chunk-url-loader.mjs.map +1 -0
  22. package/dist/lib/cli.mjs +78 -0
  23. package/dist/lib/cli.mjs.map +1 -0
  24. package/dist/lib/common/activation-events.mjs +35 -0
  25. package/dist/lib/common/activation-events.mjs.map +1 -0
  26. package/dist/lib/common/capabilities.mjs +184 -0
  27. package/dist/lib/common/capabilities.mjs.map +1 -0
  28. package/dist/lib/config.mjs +2 -0
  29. package/dist/lib/core/activation-event.mjs +55 -0
  30. package/dist/lib/core/activation-event.mjs.map +1 -0
  31. package/dist/lib/core/capability.mjs +189 -0
  32. package/dist/lib/core/capability.mjs.map +1 -0
  33. package/dist/lib/core/plugin-manager.mjs +2 -0
  34. package/dist/lib/core/plugin.mjs +340 -0
  35. package/dist/lib/core/plugin.mjs.map +1 -0
  36. package/dist/lib/core/url-loader.mjs +2 -0
  37. package/dist/lib/index.mjs +134 -0
  38. package/dist/lib/index.mjs.map +1 -0
  39. package/dist/lib/testing/react.mjs +70 -0
  40. package/dist/lib/testing/react.mjs.map +1 -0
  41. package/dist/lib/testing.mjs +399 -0
  42. package/dist/lib/testing.mjs.map +1 -0
  43. package/dist/lib/ui.mjs +636 -0
  44. package/dist/lib/ui.mjs.map +1 -0
  45. package/dist/lib/vite-plugin.mjs +986 -0
  46. package/dist/lib/vite-plugin.mjs.map +1 -0
  47. package/dist/plugin/node-esm/index.mjs +4 -3
  48. package/dist/plugin/node-esm/index.mjs.map +3 -3
  49. package/dist/plugin/node-esm/meta.json +1 -1
  50. package/dist/types/src/common/Role.d.ts +31 -0
  51. package/dist/types/src/common/Role.d.ts.map +1 -0
  52. package/dist/types/src/common/Role.test.d.ts +2 -0
  53. package/dist/types/src/common/Role.test.d.ts.map +1 -0
  54. package/dist/types/src/common/capabilities.d.ts +11 -2
  55. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  56. package/dist/types/src/common/index.d.ts +1 -0
  57. package/dist/types/src/common/index.d.ts.map +1 -1
  58. package/dist/types/src/core/capability-manager.d.ts +1 -1
  59. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  60. package/dist/types/src/core/capability.d.ts +38 -5
  61. package/dist/types/src/core/capability.d.ts.map +1 -1
  62. package/dist/types/src/core/plugin-manager.d.ts +1 -1
  63. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  64. package/dist/types/src/core/plugin.d.ts +14 -1
  65. package/dist/types/src/core/plugin.d.ts.map +1 -1
  66. package/dist/types/src/core/registry.d.ts +1 -1
  67. package/dist/types/src/core/registry.d.ts.map +1 -1
  68. package/dist/types/src/plugin-process-manager/history/capability.d.ts +1 -1
  69. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +1 -1
  70. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -1
  71. package/dist/types/src/testing/StorybookErrorFallback.d.ts +15 -0
  72. package/dist/types/src/testing/StorybookErrorFallback.d.ts.map +1 -0
  73. package/dist/types/src/testing/harness.d.ts +1 -1
  74. package/dist/types/src/testing/harness.d.ts.map +1 -1
  75. package/dist/types/src/testing/index.d.ts +2 -0
  76. package/dist/types/src/testing/index.d.ts.map +1 -1
  77. package/dist/types/src/testing/react.d.ts +4 -4
  78. package/dist/types/src/testing/react.d.ts.map +1 -1
  79. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  80. package/dist/types/src/testing/withPluginManager.stories.d.ts +6 -0
  81. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  82. package/dist/types/src/testing/withSurfaceDebug.d.ts +10 -0
  83. package/dist/types/src/testing/withSurfaceDebug.d.ts.map +1 -0
  84. package/dist/types/src/ui/components/App/App.d.ts +0 -32
  85. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  86. package/dist/types/src/ui/components/App/index.d.ts +1 -0
  87. package/dist/types/src/ui/components/App/index.d.ts.map +1 -1
  88. package/dist/types/src/ui/components/App/loader.d.ts +35 -0
  89. package/dist/types/src/ui/components/App/loader.d.ts.map +1 -0
  90. package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts +26 -0
  91. package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts.map +1 -0
  92. package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts +15 -0
  93. package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts.map +1 -0
  94. package/dist/types/src/ui/components/HomeSection/index.d.ts +2 -0
  95. package/dist/types/src/ui/components/HomeSection/index.d.ts.map +1 -0
  96. package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts +14 -0
  97. package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts.map +1 -0
  98. package/dist/types/src/ui/components/NamePopover/index.d.ts +2 -0
  99. package/dist/types/src/ui/components/NamePopover/index.d.ts.map +1 -0
  100. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +21 -9
  101. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  102. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts +4 -1
  103. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  104. package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts +2 -0
  105. package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts.map +1 -0
  106. package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts +40 -0
  107. package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts.map +1 -0
  108. package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts +23 -0
  109. package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts.map +1 -0
  110. package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts +11 -0
  111. package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts.map +1 -0
  112. package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts +72 -0
  113. package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts.map +1 -0
  114. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
  115. package/dist/types/src/ui/components/Surface/index.d.ts +20 -25
  116. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  117. package/dist/types/src/ui/components/Surface/types.d.ts +56 -52
  118. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  119. package/dist/types/src/ui/components/index.d.ts +2 -0
  120. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  121. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  122. package/dist/types/tsconfig.tsbuildinfo +1 -1
  123. package/moon.yml +25 -18
  124. package/package.json +58 -73
  125. package/src/common/Role.test.ts +41 -0
  126. package/src/common/Role.ts +54 -0
  127. package/src/common/capabilities.ts +17 -2
  128. package/src/common/index.ts +1 -0
  129. package/src/core/capability-manager.test.ts +1 -1
  130. package/src/core/capability-manager.ts +1 -1
  131. package/src/core/capability.ts +45 -6
  132. package/src/core/plugin-manager.test.ts +38 -3
  133. package/src/core/plugin-manager.ts +18 -1
  134. package/src/core/plugin.ts +16 -1
  135. package/src/core/registry.ts +1 -1
  136. package/src/plugin-process-manager/process-manager-capability.ts +25 -2
  137. package/src/testing/StorybookErrorFallback.tsx +40 -0
  138. package/src/testing/harness.ts +1 -1
  139. package/src/testing/index.ts +2 -0
  140. package/src/testing/react.test.tsx +2 -1
  141. package/src/testing/react.tsx +14 -8
  142. package/src/testing/withPluginManager.stories.tsx +16 -1
  143. package/src/testing/withPluginManager.tsx +13 -2
  144. package/src/testing/withSurfaceDebug.tsx +22 -0
  145. package/src/ui/components/App/App.tsx +7 -35
  146. package/src/ui/components/App/index.ts +1 -0
  147. package/src/ui/components/App/loader.ts +39 -0
  148. package/src/ui/components/HomeSection/HomeSection.stories.tsx +43 -0
  149. package/src/ui/components/HomeSection/HomeSection.tsx +69 -0
  150. package/src/ui/components/HomeSection/index.ts +5 -0
  151. package/src/ui/components/NamePopover/NamePopover.tsx +70 -0
  152. package/src/ui/components/NamePopover/index.ts +5 -0
  153. package/src/ui/components/Surface/DESIGN.md +136 -0
  154. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +70 -41
  155. package/src/ui/components/Surface/SurfaceComponent.test.tsx +403 -0
  156. package/src/ui/components/Surface/SurfaceComponent.tsx +209 -189
  157. package/src/ui/components/Surface/SurfaceDebug.tsx +435 -0
  158. package/src/ui/components/Surface/SurfaceManager.ts +95 -0
  159. package/src/ui/components/Surface/SurfaceManagerContext.ts +23 -0
  160. package/src/ui/components/Surface/SurfaceMetrics.ts +202 -0
  161. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +12 -2
  162. package/src/ui/components/Surface/index.ts +24 -22
  163. package/src/ui/components/Surface/types.test.ts +47 -54
  164. package/src/ui/components/Surface/types.ts +66 -91
  165. package/src/ui/components/index.ts +2 -0
  166. package/src/ui/hooks/useApp.tsx +7 -3
  167. package/src/vite-plugin/boot-loader/loader-app/boot-loader.css +1 -1
  168. package/tsconfig.json +3 -0
  169. package/vite.config.ts +26 -0
  170. package/dist/lib/browser/capability-S44TE2H7.mjs +0 -35
  171. package/dist/lib/browser/capability-S44TE2H7.mjs.map +0 -7
  172. package/dist/lib/browser/chunk-3NQLTQCP.mjs +0 -47
  173. package/dist/lib/browser/chunk-3NQLTQCP.mjs.map +0 -7
  174. package/dist/lib/browser/chunk-53HJHMS5.mjs +0 -7
  175. package/dist/lib/browser/chunk-53HJHMS5.mjs.map +0 -7
  176. package/dist/lib/browser/chunk-FJ4765WW.mjs.map +0 -7
  177. package/dist/lib/browser/chunk-J5LGTIGS.mjs +0 -10
  178. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +0 -7
  179. package/dist/lib/browser/chunk-KRJ4KK2W.mjs +0 -505
  180. package/dist/lib/browser/chunk-KRJ4KK2W.mjs.map +0 -7
  181. package/dist/lib/browser/chunk-LUH4Y5F2.mjs +0 -430
  182. package/dist/lib/browser/chunk-LUH4Y5F2.mjs.map +0 -7
  183. package/dist/lib/browser/chunk-NKVRSMFN.mjs +0 -95
  184. package/dist/lib/browser/chunk-NKVRSMFN.mjs.map +0 -7
  185. package/dist/lib/browser/chunk-OO53M5UK.mjs +0 -260
  186. package/dist/lib/browser/chunk-OO53M5UK.mjs.map +0 -7
  187. package/dist/lib/browser/chunk-OPTS3ZSN.mjs +0 -83
  188. package/dist/lib/browser/chunk-OPTS3ZSN.mjs.map +0 -7
  189. package/dist/lib/browser/chunk-Q2GLJTVV.mjs +0 -12
  190. package/dist/lib/browser/chunk-Q2GLJTVV.mjs.map +0 -7
  191. package/dist/lib/browser/chunk-SYXIYT6T.mjs +0 -143
  192. package/dist/lib/browser/chunk-SYXIYT6T.mjs.map +0 -7
  193. package/dist/lib/browser/chunk-U5MESPM5.mjs +0 -603
  194. package/dist/lib/browser/chunk-U5MESPM5.mjs.map +0 -7
  195. package/dist/lib/browser/chunk-UGYCLOXE.mjs +0 -1471
  196. package/dist/lib/browser/chunk-UGYCLOXE.mjs.map +0 -7
  197. package/dist/lib/browser/chunk-VF37YTXJ.mjs +0 -28
  198. package/dist/lib/browser/chunk-VF37YTXJ.mjs.map +0 -7
  199. package/dist/lib/browser/chunk-YUVQIOTB.mjs +0 -60
  200. package/dist/lib/browser/chunk-YUVQIOTB.mjs.map +0 -7
  201. package/dist/lib/browser/cli/index.mjs +0 -74
  202. package/dist/lib/browser/cli/index.mjs.map +0 -7
  203. package/dist/lib/browser/common/activation-events.mjs +0 -20
  204. package/dist/lib/browser/common/activation-events.mjs.map +0 -7
  205. package/dist/lib/browser/common/capabilities.mjs +0 -56
  206. package/dist/lib/browser/common/capabilities.mjs.map +0 -7
  207. package/dist/lib/browser/config/index.mjs +0 -8
  208. package/dist/lib/browser/config/index.mjs.map +0 -7
  209. package/dist/lib/browser/core/activation-event.mjs +0 -20
  210. package/dist/lib/browser/core/activation-event.mjs.map +0 -7
  211. package/dist/lib/browser/core/capability.mjs +0 -32
  212. package/dist/lib/browser/core/capability.mjs.map +0 -7
  213. package/dist/lib/browser/core/plugin-manager.mjs +0 -19
  214. package/dist/lib/browser/core/plugin-manager.mjs.map +0 -7
  215. package/dist/lib/browser/core/plugin.mjs +0 -51
  216. package/dist/lib/browser/core/plugin.mjs.map +0 -7
  217. package/dist/lib/browser/core/url-loader.mjs +0 -24
  218. package/dist/lib/browser/core/url-loader.mjs.map +0 -7
  219. package/dist/lib/browser/index.mjs +0 -98
  220. package/dist/lib/browser/index.mjs.map +0 -7
  221. package/dist/lib/browser/meta.json +0 -1
  222. package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs +0 -132
  223. package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs.map +0 -7
  224. package/dist/lib/browser/testing/index.mjs +0 -359
  225. package/dist/lib/browser/testing/index.mjs.map +0 -7
  226. package/dist/lib/browser/testing/react.mjs +0 -78
  227. package/dist/lib/browser/testing/react.mjs.map +0 -7
  228. package/dist/lib/browser/ui/index.mjs +0 -60
  229. package/dist/lib/browser/ui/index.mjs.map +0 -7
  230. package/dist/lib/node-esm/capability-3YRF77LV.mjs +0 -36
  231. package/dist/lib/node-esm/capability-3YRF77LV.mjs.map +0 -7
  232. package/dist/lib/node-esm/chunk-2UPUZXGU.mjs +0 -9
  233. package/dist/lib/node-esm/chunk-2UPUZXGU.mjs.map +0 -7
  234. package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +0 -10
  235. package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-4SE7SX7N.mjs +0 -261
  237. package/dist/lib/node-esm/chunk-4SE7SX7N.mjs.map +0 -7
  238. package/dist/lib/node-esm/chunk-BMW6P6QA.mjs +0 -48
  239. package/dist/lib/node-esm/chunk-BMW6P6QA.mjs.map +0 -7
  240. package/dist/lib/node-esm/chunk-COHOWGGJ.mjs +0 -144
  241. package/dist/lib/node-esm/chunk-COHOWGGJ.mjs.map +0 -7
  242. package/dist/lib/node-esm/chunk-DRT75WGD.mjs +0 -604
  243. package/dist/lib/node-esm/chunk-DRT75WGD.mjs.map +0 -7
  244. package/dist/lib/node-esm/chunk-FKMVORZN.mjs +0 -431
  245. package/dist/lib/node-esm/chunk-FKMVORZN.mjs.map +0 -7
  246. package/dist/lib/node-esm/chunk-FPW45EZH.mjs +0 -14
  247. package/dist/lib/node-esm/chunk-FPW45EZH.mjs.map +0 -7
  248. package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs +0 -84
  249. package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs.map +0 -7
  250. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  251. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  252. package/dist/lib/node-esm/chunk-IL7O7IRX.mjs +0 -1472
  253. package/dist/lib/node-esm/chunk-IL7O7IRX.mjs.map +0 -7
  254. package/dist/lib/node-esm/chunk-ND2HETHD.mjs +0 -506
  255. package/dist/lib/node-esm/chunk-ND2HETHD.mjs.map +0 -7
  256. package/dist/lib/node-esm/chunk-TLKYZKPW.mjs +0 -29
  257. package/dist/lib/node-esm/chunk-TLKYZKPW.mjs.map +0 -7
  258. package/dist/lib/node-esm/chunk-VCPGX7WN.mjs +0 -62
  259. package/dist/lib/node-esm/chunk-VCPGX7WN.mjs.map +0 -7
  260. package/dist/lib/node-esm/chunk-XSZMX53L.mjs +0 -96
  261. package/dist/lib/node-esm/chunk-XSZMX53L.mjs.map +0 -7
  262. package/dist/lib/node-esm/cli/index.mjs +0 -75
  263. package/dist/lib/node-esm/cli/index.mjs.map +0 -7
  264. package/dist/lib/node-esm/common/activation-events.mjs +0 -21
  265. package/dist/lib/node-esm/common/activation-events.mjs.map +0 -7
  266. package/dist/lib/node-esm/common/capabilities.mjs +0 -57
  267. package/dist/lib/node-esm/common/capabilities.mjs.map +0 -7
  268. package/dist/lib/node-esm/config/index.mjs +0 -9
  269. package/dist/lib/node-esm/config/index.mjs.map +0 -7
  270. package/dist/lib/node-esm/core/activation-event.mjs +0 -21
  271. package/dist/lib/node-esm/core/activation-event.mjs.map +0 -7
  272. package/dist/lib/node-esm/core/capability.mjs +0 -33
  273. package/dist/lib/node-esm/core/capability.mjs.map +0 -7
  274. package/dist/lib/node-esm/core/plugin-manager.mjs +0 -20
  275. package/dist/lib/node-esm/core/plugin-manager.mjs.map +0 -7
  276. package/dist/lib/node-esm/core/plugin.mjs +0 -52
  277. package/dist/lib/node-esm/core/plugin.mjs.map +0 -7
  278. package/dist/lib/node-esm/core/url-loader.mjs +0 -25
  279. package/dist/lib/node-esm/core/url-loader.mjs.map +0 -7
  280. package/dist/lib/node-esm/index.mjs +0 -99
  281. package/dist/lib/node-esm/index.mjs.map +0 -7
  282. package/dist/lib/node-esm/meta.json +0 -1
  283. package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs +0 -133
  284. package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs.map +0 -7
  285. package/dist/lib/node-esm/testing/index.mjs +0 -360
  286. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  287. package/dist/lib/node-esm/testing/react.mjs +0 -79
  288. package/dist/lib/node-esm/testing/react.mjs.map +0 -7
  289. package/dist/lib/node-esm/ui/index.mjs +0 -61
  290. package/dist/lib/node-esm/ui/index.mjs.map +0 -7
  291. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +0 -11
  292. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +0 -1
  293. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -106
  294. package/vitest.config.ts +0 -14
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.mjs","names":[],"sources":["../../src/ui/hooks/useApp.tsx","../../src/ui/hooks/useCapabilities.ts","../../src/ui/hooks/useLoading.tsx","../../src/ui/hooks/useProcessManagerRuntime.ts","../../src/ui/hooks/useSettingsState.ts","../../src/ui/hooks/useSurface.ts","../../src/ui/components/App/loader.ts","../../src/ui/components/App/App.tsx","../../src/ui/components/HomeSection/HomeSection.tsx","../../src/ui/components/NamePopover/NamePopover.tsx","../../src/ui/components/Surface/index.ts"],"sourcesContent":["//\n// Copyright 2025 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport * as Fiber from 'effect/Fiber';\nimport * as PubSub from 'effect/PubSub';\nimport * as Queue from 'effect/Queue';\nimport React, { type FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { EffectEx } from '@dxos/effect';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { ErrorBoundary, ErrorFallback, type FallbackProps } from '@dxos/react-error-boundary';\nimport { useAsyncEffect, useDefaultValue } from '@dxos/react-hooks';\nimport { ContextProtocolProvider } from '@dxos/web-context-react';\n\nimport { ActivationEvents, Capabilities } from '../../common';\nimport { PluginManagerContext } from '../../context';\nimport { type ActivationEvent, type Plugin, PluginManager } from '../../core';\nimport { App, PluginManagerProvider, SurfaceManager, SurfaceManagerProvider } from '../components';\n\nconst ENABLED_KEY = 'org.dxos.app-framework.enabled';\n\nexport type StartupProgress = {\n /** Number of modules that have been activated. */\n activated: number;\n /** Total number of modules registered. */\n total: number;\n /** Fractional progress (0-1). */\n progress: number;\n /**\n * Raw activation event key (e.g. `org.dxos.app-framework.event.startup`).\n * Set on event-level transitions, *and* on module-level transitions where\n * it carries the parent activation event that first triggered the\n * module's load (plumbed through `_loadCapabilitiesForModules` →\n * `_loadModule`). Consumers can use this either as the primary id (when\n * {@link module} is absent) or as an extra \"context\" field alongside\n * {@link module}.\n */\n event?: string;\n /**\n * Raw module id (e.g. `org.dxos.plugin.observability.module.ReactSurface`)\n * when the in-flight activation is module-level. When present,\n * {@link event} may also be set, identifying the parent activation that\n * triggered this module's load.\n */\n module?: string;\n /**\n * Pre-humanized label for the currently surfaced transition (module\n * label if {@link module} is set, otherwise the event label), supplied\n * for consumers that want a sensible default. Hosts that prefer to\n * render their own label can read the raw {@link event}/{@link module}\n * fields and ignore this — the framework leaves the policy choice\n * (which transitions to surface, how to format them, whether to drop\n * sub-modules entirely) to the host's `Placeholder`.\n */\n humanizedName?: string;\n};\n\nexport type UseAppOptions = {\n pluginManager?: PluginManager.PluginManager;\n pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];\n onPluginRemove?: PluginManager.ManagerOptions['onRemove'];\n pluginRegistryProvider?: PluginManager.ManagerOptions['pluginRegistryProvider'];\n plugins?: Plugin.Plugin[];\n defaults?: string[];\n /**\n * Additional activation events to fire before startup.\n * These are fired alongside SetupReactSurface before the Startup event.\n */\n setupEvents?: ActivationEvent.ActivationEvent[];\n cacheEnabled?: boolean;\n safeMode?: boolean;\n debounce?: number;\n timeout?: number;\n fallback?: FC<FallbackProps>;\n};\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const plugins = [LayoutPlugin(), MyPlugin()];\n * const defaults = [MyPluginId];\n * const fallback = () => <div>Initializing Plugins...</div>;\n * const App = useApp({ plugins, defaults, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.pluginLoader A function which loads new plugins.\n * @param params.plugins All plugins available to the application. Plugins whose `meta.profile.tags` includes `'system'` are treated as core (force-enabled, not user-toggleable).\n * @param params.defaults Default plugins are enabled by default but can be disabled by the user.\n * @param params.cacheEnabled Whether to cache enabled plugins in localStorage.\n * @param params.safeMode Whether to enable safe mode, which disables optional plugins.\n * @param params.fallback Fallback component to render if an error occurs during startup.\n */\nexport const useApp = ({\n pluginManager,\n pluginLoader: pluginLoaderProp,\n onPluginRemove,\n pluginRegistryProvider,\n plugins: pluginsProp,\n defaults: defaultsProp,\n setupEvents: setupEventsProp,\n fallback = ErrorFallback,\n cacheEnabled = false,\n safeMode = false,\n debounce = 0,\n timeout = 30_000,\n}: UseAppOptions) => {\n const plugins = useDefaultValue(pluginsProp, () => []);\n const defaults = useDefaultValue(defaultsProp, () => []);\n const setupEvents = useDefaultValue(setupEventsProp, () => []);\n\n const pluginLoader = useMemo(\n () =>\n pluginLoaderProp ??\n ((id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return { plugin };\n })),\n [pluginLoaderProp, plugins],\n );\n\n const readyRef = useRef(false);\n const [ready, setReady] = useState(false);\n const errorRef = useRef<unknown>(null);\n const [error, setError] = useState<unknown>(null);\n const [startupProgress, setStartupProgress] = useState<StartupProgress>({\n activated: 0,\n total: 0,\n progress: 0,\n });\n // TODO(wittjosiah): Migrate to Atom.kvs for isomorphic storage.\n const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);\n const enabled = useMemo(\n () => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),\n [safeMode, cacheEnabled, cached, defaults],\n );\n const isExternalManager = !!pluginManager;\n const manager = useMemo(() => {\n const mgr =\n pluginManager ??\n PluginManager.make({\n pluginLoader,\n plugins,\n enabled,\n onRemove: onPluginRemove,\n pluginRegistryProvider,\n });\n log('useApp: useMemo created/reused manager', { provided: !!pluginManager });\n return mgr;\n }, [pluginManager, pluginLoader, plugins, enabled, onPluginRemove, pluginRegistryProvider]);\n\n useEffect(() => {\n if (!cacheEnabled) {\n return;\n }\n return manager.registry.subscribe(manager.enabled, (value) => {\n localStorage.setItem(ENABLED_KEY, JSON.stringify(value));\n });\n }, [cacheEnabled, manager]);\n\n useEffect(() => {\n setupDevtools(manager);\n }, [manager]);\n\n useAsyncEffect(async () => {\n log('useApp: effect mount');\n\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'org.dxos.app-framework.plugin-manager',\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'org.dxos.app-framework.atom-registry',\n });\n\n const fiber = Effect.gen(function* () {\n const queue = yield* PubSub.subscribe(manager.activation);\n const listener = yield* Effect.forkDaemon(\n Queue.take(queue).pipe(\n Effect.tap(({ event, state, module, error: error$ }) =>\n Effect.sync(() => {\n // Event-level Startup activated (no `module` field) fires once,\n // after every module triggered by Startup has finished. Module\n // activations now also carry their parent event id (so the trace\n // can attribute a module to its triggering event), which means\n // each module activated under Startup publishes\n // `{ event: 'startup', state: 'activated', module: <id> }`. Without\n // the `!module` guard the listener would mark the app ready on\n // the *first* such module rather than waiting for the event-level\n // completion — leaving downstream capabilities (operation-invoker,\n // app-graph, …) un-registered when the boot loader dismisses.\n if (event === ActivationEvents.Startup.id && state === 'activated' && !module) {\n clearTimeout(timeoutId);\n setReady(true);\n readyRef.current = true;\n // Trigger startup profiler dump if available.\n (globalThis as any).composer?.profiler?.dump();\n // Notify any host observability layer that startup completed.\n // A `CustomEvent` keeps this generic — app-framework doesn't\n // import a provider, and consumers can capture the startup\n // summary without us picking one.\n if (typeof window !== 'undefined') {\n window.dispatchEvent(new CustomEvent('app-framework:startup-activated'));\n }\n return;\n }\n // `activating` is the start-of-load signal. Surface the raw\n // `module` (or `event`) plus a pre-humanized label so the\n // boot loader can decide how to render each transition — show\n // everything, suppress noisy sub-modules, group by plugin,\n // or apply its own formatting. We intentionally do NOT touch\n // these fields on `activated`: pairing the two would cause\n // back-to-back identical updates to the host's effect, which\n // the boot loader treats as a re-trigger because\n // `progress.progress` moved. Leaving the label alone on\n // completion keeps it accurate (\"now activating X\") until\n // the next module starts.\n if (module && state === 'activating' && !readyRef.current) {\n setStartupProgress((current) => ({\n ...current,\n // `event` here is the activation event that first\n // triggered this module load (plumbed through\n // `_loadCapabilitiesForModules` → `_loadModule`).\n // Falsy/empty falls back to undefined so consumers can\n // tell \"no parent context\" from \"parent context: <X>\".\n event: event || undefined,\n module,\n humanizedName: humanizeModuleId(module),\n }));\n }\n // Update the activation count when a module commits. The\n // ring's fraction comes from this; `event`/`module`/\n // `humanizedName` were set by the matching `activating`\n // message above and are left alone so the count can advance\n // without re-firing the host's status callback.\n if (module && state === 'activated' && !readyRef.current) {\n const active = manager.getActive();\n const total = manager.getModules().length;\n setStartupProgress((current) => ({\n ...current,\n activated: active.length,\n total,\n progress: total > 0 ? active.length / total : 0,\n }));\n }\n // Event-level `activating` (no `module`) — fired at the start\n // of `_activateModulesForEvent` and recursively for each\n // before/after event. Surfaces a label during the gap before\n // the first module-level message lands; subsequent module\n // updates immediately overwrite this with a more specific\n // label.\n if (event && !module && state === 'activating' && !readyRef.current) {\n setStartupProgress((current) => ({\n ...current,\n event,\n module: undefined,\n humanizedName: humanizeEventKey(event),\n }));\n }\n if (error$ && !readyRef.current) {\n setError(error$);\n errorRef.current = error$;\n }\n }),\n ),\n Effect.forever,\n ),\n );\n\n yield* Effect.all([\n ...setupEvents.map((event) => manager.activate(event)),\n manager.activate(ActivationEvents.SetupReactSurface),\n manager.activate(ActivationEvents.Startup),\n ]);\n\n return yield* Fiber.join(listener);\n }).pipe(Effect.scoped, Effect.runFork);\n\n // Set up a timeout for startup.\n const timeoutId = setTimeout(() => {\n if (!readyRef.current && !errorRef.current) {\n log.warn('startup timeout diagnostic', {\n eventsFired: manager.getEventsFired(),\n activeModules: manager.getActive(),\n pendingReset: manager.getPendingReset(),\n });\n void EffectEx.runAndForwardErrors(Fiber.interrupt(fiber));\n setError(new Error(`Startup timed out after ${timeout}ms`));\n }\n }, timeout);\n\n return () => {\n log('useApp: effect cleanup');\n clearTimeout(timeoutId);\n void EffectEx.runAndForwardErrors(Fiber.interrupt(fiber));\n if (!isExternalManager) {\n void EffectEx.runAndForwardErrors(manager.shutdown());\n }\n };\n }, [manager]);\n\n const progressRef = useRef(startupProgress);\n progressRef.current = startupProgress;\n\n const surfaces = useMemo(() => new SurfaceManager(manager.capabilities), [manager]);\n\n return useCallback(\n () => (\n <ErrorBoundary name='app' FallbackComponent={fallback}>\n <PluginManagerProvider value={manager}>\n <ContextProtocolProvider value={manager} context={PluginManagerContext}>\n <RegistryContext.Provider value={manager.registry}>\n <SurfaceManagerProvider value={surfaces}>\n <App ready={ready} error={error} debounce={debounce} progress={progressRef.current} />\n </SurfaceManagerProvider>\n </RegistryContext.Provider>\n </ContextProtocolProvider>\n </PluginManagerProvider>\n </ErrorBoundary>\n ),\n [fallback, manager, surfaces, ready, error],\n );\n};\n\nconst setupDevtools = (manager: PluginManager.PluginManager) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.manager = manager;\n};\n\n/**\n * Extracts a human-readable label from a module ID.\n *\n * Module IDs follow `org.dxos.plugin.<plugin-slug>.module.<module-name>`,\n * where `<plugin-slug>` is kebab-case and `<module-name>` is either an\n * explicit string (often kebab-case, e.g. `'observability'`, `'namespace'`)\n * or a capability tag in PascalCase from `Capability.getModuleTag(...)`\n * (e.g. `'ReactSurface'`, `'AppGraphBuilder'`). The output is\n * `\"Title Case Plugin: kebab-module\"` so the visible status names both the\n * plugin and the aspect being activated, helping disambiguate the multiple\n * modules a plugin contributes.\n *\n * Examples:\n * - \"org.dxos.plugin.markdown.module.ReactSurface\" → \"Markdown: react-surface\"\n * - \"org.dxos.plugin.observability.module.AppGraphBuilder\" → \"Observability: app-graph-builder\"\n * - \"org.dxos.plugin.observability.module.observability\" → \"Observability\"\n * (the module name matches the plugin slug — collapsed to avoid\n * \"Observability: observability\" noise.)\n */\nconst humanizeModuleId = (moduleId: string): string => {\n const match = moduleId.match(/\\.plugin\\.([^.]+)\\.module\\.(.+)$/);\n if (!match) {\n // Fallback: use the last segment.\n const parts = moduleId.split('.');\n return parts[parts.length - 1];\n }\n const [, pluginSlug, moduleName] = match;\n const pluginLabel = pluginSlug\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n // Normalise the module name to kebab-case so PascalCase capability tags\n // (\"ReactSurface\") read consistently with explicit kebab IDs\n // (\"operation-handler\"). The two-step substitution handles consecutive\n // uppercase runs (`URLLoader` → `url-loader`) without splitting them\n // mid-acronym.\n const moduleLabel = moduleName\n .replace(/([a-z0-9])([A-Z])/g, '$1-$2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2')\n .toLowerCase();\n // Capability modules whose name matches the plugin slug (e.g. the\n // observability plugin's `observability` capability module) would render\n // as \"Observability: observability\" — drop the redundant suffix.\n if (moduleLabel === pluginSlug) {\n return pluginLabel;\n }\n return `${pluginLabel}: ${moduleLabel}`;\n};\n\n/**\n * Extracts a human-readable label from an activation event key.\n * E.g., \"org.dxos.app-framework.event.setup-react-surface\" → \"Setup React Surface\".\n */\nconst humanizeEventKey = (eventKey: string): string => {\n // Strip a leading specifier (composite key form: \"<id>:<specifier>\").\n const id = eventKey.split(':')[0];\n // Match the trailing segment after `.event.`.\n const match = id.match(/\\.event\\.(.+)$/);\n const slug = match ? match[1] : (id.split('.').pop() ?? id);\n return slug\n .split('-')\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(' ');\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport { useAtomValue } from '@effect-atom/atom-react';\nimport { useCallback } from 'react';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { Capabilities } from '../../common';\nimport { type Capability } from '../../core';\nimport { useOptionalPluginManager, usePluginManager } from '../components';\n\n/** Stable empty result for capability lookups made outside a plugin manager. */\nconst emptyCapabilities = Atom.make(() => [] as const);\n\n/** Stable atom yielding `undefined`, used as the fallback for optional atom-capability lookups. */\nconst emptyAtomValue = Atom.make(() => undefined);\n\n/**\n * Hook to request capabilities from the plugin context.\n * @returns An array of capabilities.\n */\nexport const useCapabilities = <T>(interfaceDef: Capability.InterfaceDef<T>) => {\n const manager = usePluginManager();\n return useAtomValue(manager.capabilities.atom(interfaceDef));\n};\n\n/**\n * Hook to request a capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\n// TODO(burdon): Option not to throw?\nexport const useCapability = <T>(interfaceDef: Capability.InterfaceDef<T>) => {\n const capabilities = useCapabilities(interfaceDef);\n invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`);\n return capabilities[0];\n};\n\n/**\n * Hook to request capabilities without requiring a plugin manager.\n * @returns An array of capabilities, or an empty array when rendered outside a {@link PluginManagerProvider}.\n */\nexport const useOptionalCapabilities = <T>(interfaceDef: Capability.InterfaceDef<T>): readonly T[] => {\n const manager = useOptionalPluginManager();\n return useAtomValue(\n manager ? manager.capabilities.atom(interfaceDef) : (emptyCapabilities as Atom.Atom<readonly T[]>),\n );\n};\n\n/**\n * Hook to request a single capability without requiring a plugin manager.\n * @returns The first matching capability, or `undefined` when none is registered (or there is no plugin manager).\n */\nexport const useOptionalCapability = <T>(interfaceDef: Capability.InterfaceDef<T>): T | undefined =>\n useOptionalCapabilities(interfaceDef)[0];\n\n/**\n * Hook to get the current value of an atom capability.\n * Automatically subscribes to changes.\n * @example const settings = useAtomCapability(CommentCapabilities.Settings);\n */\nexport const useAtomCapability = <T>(atomCapability: Capability.InterfaceDef<Atom.Atom<T>>): T => {\n const atom = useCapability(atomCapability);\n return useAtomValue(atom);\n};\n\n/**\n * Hook to get value and updater for an atom capability.\n * Returns [currentValue, updateFn] similar to useState.\n * @example const [settings, updateSettings] = useAtomCapabilityState(CommentCapabilities.Settings);\n */\nexport const useAtomCapabilityState = <T>(\n atomCapability: Capability.InterfaceDef<Atom.Writable<T>>,\n): [T, (fn: (current: T) => T) => void] => {\n const registry = useCapability(Capabilities.AtomRegistry);\n const atom = useCapability(atomCapability);\n const value = useAtomValue(atom);\n const update = useCallback(\n (fn: (current: T) => T) => {\n registry.set(atom, fn(registry.get(atom)));\n },\n [registry, atom],\n );\n return [value, update];\n};\n\n/**\n * Tolerant variant of {@link useAtomCapabilityState}: returns `[undefined, noop]` when the atom\n * capability is not registered (e.g. the contributing plugin is not installed) rather than\n * throwing. The updater is a no-op while the capability is absent.\n */\nexport const useOptionalAtomCapabilityState = <T>(\n atomCapability: Capability.InterfaceDef<Atom.Writable<T>>,\n): [T | undefined, (fn: (current: T) => T) => void] => {\n const registry = useOptionalCapability(Capabilities.AtomRegistry);\n const atom = useOptionalCapability(atomCapability);\n const value = useAtomValue(atom ?? emptyAtomValue);\n const update = useCallback(\n (fn: (current: T) => T) => {\n if (registry && atom) {\n registry.set(atom, fn(registry.get(atom)));\n }\n },\n [registry, atom],\n );\n return [value, update];\n};\n\n/**\n * Hook to get the operation invoker capability.\n */\nexport const useOperationInvoker = (): Capabilities.OperationInvoker => useCapability(Capabilities.OperationInvoker);\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useRef, useState } from 'react';\n\nexport enum LoadingState {\n Loading = 0,\n FadeIn = 1,\n FadeOut = 2,\n Done = 3,\n}\n\n/**\n * To avoid \"flashing\" the placeholder, we wait a period of time before starting the loading animation.\n * If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.\n *\n * States:\n * 0: Loading - Wait for a period of time before starting the loading animation.\n * 1: Fade-in - Display a loading animation.\n * 2: Fade-out - Fade out the loading animation.\n * 3: Done - Remove the placeholder.\n */\nexport const useLoading = (ready: boolean, debounce = 0) => {\n const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);\n // Mirror `ready` into a ref so the interval's `setStage` callback can read\n // the latest value without depending on the effect re-running. The pure\n // closure-capture pattern (with `ready` in deps) sticks the FSM at\n // `FadeIn` whenever HMR doesn't propagate the dep change end-to-end —\n // a ref sidesteps that entirely and fires the read on every tick.\n const readyRef = useRef(ready);\n readyRef.current = ready;\n\n useEffect(() => {\n if (!debounce) {\n return;\n }\n\n const i = setInterval(() => {\n setStage((stage) => {\n const isReady = readyRef.current;\n switch (stage) {\n case LoadingState.Loading: {\n if (!isReady) {\n return LoadingState.FadeIn;\n }\n clearInterval(i);\n return LoadingState.Done;\n }\n\n case LoadingState.FadeIn: {\n if (isReady) {\n return LoadingState.FadeOut;\n }\n break;\n }\n\n case LoadingState.FadeOut: {\n clearInterval(i);\n return LoadingState.Done;\n }\n }\n\n return stage;\n });\n }, debounce);\n\n return () => clearInterval(i);\n }, [debounce]);\n\n if (!debounce) {\n return ready ? LoadingState.Done : LoadingState.Loading;\n }\n\n return stage;\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport { type DependencyList, use, useCallback, useMemo } from 'react';\n\nimport { Operation, ServiceResolver } from '@dxos/compute';\nimport { EffectEx } from '@dxos/effect';\nimport type { SpaceId } from '@dxos/keys';\n\nimport { Capabilities } from '../../common';\nimport { useCapability } from './useCapabilities';\n\n/**\n * Resolve the shared {@link Capabilities.ProcessManagerRuntime} from the plugin context.\n */\nexport const useProcessManagerRuntime = (): Capabilities.ProcessManagerRuntime =>\n useCapability(Capabilities.ProcessManagerRuntime);\n\n/**\n * Build a callback that runs an effect on the {@link Capabilities.ProcessManagerRuntime}\n * with space-scoped services resolved via {@link ServiceResolver.provide}.\n *\n * The `tags` tuple must list every service the effect requires (beyond the\n * fixed {@link Capabilities.ProcessManagerRuntimeServices}); these services are\n * resolved for the given `spaceId` through the runtime's service resolver.\n *\n * Nested `Operation.invoke` / `Operation.schedule` calls within the effect\n * inherit `spaceId` as a default {@link Operation.InvokeOptions} so that\n * spawned operation processes have a space context (and therefore can resolve\n * space-scoped services like `Database.Service`) without each call site having\n * to thread the id through manually.\n */\nexport const useSpaceCallback = <const Tags extends readonly Context.Tag<any, any>[], T>(\n spaceId: SpaceId | undefined,\n tags: Tags,\n fn: () => Effect.Effect<T, any, Context.Tag.Identifier<Tags[number]> | Capabilities.ProcessManagerRuntimeServices>,\n deps?: DependencyList,\n): (() => Promise<T>) => {\n const runtime = useProcessManagerRuntime();\n return useCallback(() => {\n if (spaceId === undefined) {\n throw new TypeError('Space not provided to useSpaceCallback');\n }\n const layer = Layer.merge(\n ServiceResolver.provide({ space: spaceId }, ...tags),\n Operation.withInvocationOptions({ spaceId }),\n );\n return runtime.runPromise(fn().pipe(Effect.provide(layer)) as Effect.Effect<T, any, any>);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [runtime, spaceId, ...(deps ?? [])]);\n};\n\n/**\n * Suspensefully resolve a single space-scoped service via the\n * {@link Capabilities.ProcessManagerRuntime}'s service resolver.\n */\nexport const useSpaceService = <T extends Context.Tag<any, any>>(\n tag: T,\n spaceId: SpaceId | undefined,\n): Context.Tag.Service<T> | undefined => {\n const runtime = useProcessManagerRuntime();\n const promise = useMemo(() => {\n if (spaceId === undefined) {\n return undefined;\n }\n const layer = ServiceResolver.provide({ space: spaceId }, tag);\n const effect = Effect.flatMap(tag, (service) => Effect.succeed(service)).pipe(Effect.provide(layer));\n return runtime.runPromiseExit(effect as Effect.Effect<Context.Tag.Service<T>, any, any>);\n }, [runtime, spaceId, tag]);\n if (!promise) {\n return undefined;\n }\n return EffectEx.unwrapExit(use(promise));\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom, RegistryContext, useAtomValue } from '@effect-atom/atom-react';\nimport { useCallback, useContext } from 'react';\n\n/**\n * Hook to read and update a settings atom.\n * Returns the current value and an update function.\n */\nexport const useSettingsState = <T>(\n atom: Atom.Writable<T>,\n): { settings: T; updateSettings: (fn: (current: T) => T) => void } => {\n const registry = useContext(RegistryContext);\n const settings = useAtomValue(atom);\n\n const updateSettings = useCallback(\n (fn: (current: T) => T) => {\n registry.set(atom, fn(registry.get(atom)));\n },\n [registry, atom],\n );\n\n return { settings, updateSettings };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { Surface } from '../components';\n\nexport const useSurface = (): Surface.Context => {\n return useContext(Surface.Context) ?? raise(new Error('Missing SurfaceContext'));\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\ndeclare global {\n interface BootLoader {\n status: (payload: {\n event?: string;\n module?: string;\n humanized: string;\n /**\n * Optional `(index/total)` tick. When present, the loader replaces the\n * current line in place (\"Loading plugins (12/80)\") instead of appending\n * a new entry — keeps the visible log compact during long counted phases.\n */\n range?: { index: number; total: number };\n }) => void;\n progress: (fraction?: number) => void;\n ready: () => void;\n dismiss: () => void;\n }\n\n interface Window {\n /**\n * Driver injected by `@dxos/app-framework/vite-plugin`'s `bootLoaderPlugin`\n * (a Solid app inlined into `index.html`). Declared here — on a module that\n * is part of the `@dxos/app-framework/ui` export surface — so the React side\n * and host apps (e.g. composer-app) can drive the loader without each\n * re-declaring the type. The canonical definition lives in the plugin's\n * `loader-app/types.ts`; this mirror exists because that source compiles in a\n * separate (Solid) program that doesn't ship its globals to consumers.\n */\n __bootLoader?: BootLoader;\n }\n}\n\n// Guarded: `@dxos/app-framework/ui` has a `node` export and this module is re-exported through the\n// UI barrel, so a bare top-level `window` read would throw when imported in SSR / tests / tooling.\nexport const bootLoader = typeof window !== 'undefined' ? window.__bootLoader : undefined;\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren, useEffect, useLayoutEffect } from 'react';\n\nimport { Capabilities } from '../../../common';\nimport { topologicalSort } from '../../../helpers';\nimport { LoadingState, type StartupProgress, type UseAppOptions, useCapabilities, useLoading } from '../../hooks';\nimport { bootLoader } from './loader';\n\nconst FIRST_INTERACTIVE_MARK = 'app-framework:first-interactive';\n\nexport type AppProps = Pick<UseAppOptions, 'debounce'> & {\n ready: boolean;\n error: unknown;\n progress?: StartupProgress;\n};\n\nexport const App = ({ ready, error, debounce, progress }: AppProps) => {\n const reactContexts = useCapabilities(Capabilities.ReactContext);\n const reactRoots = useCapabilities(Capabilities.ReactRoot);\n const stage = useLoading(ready, debounce);\n const placeholderDismissed = stage >= LoadingState.Done;\n\n // Relay the startup lifecycle into the boot loader injected by\n // `@dxos/app-framework/vite-plugin` (a Solid app inlined into `index.html`,\n // the only visible loading UI). Plugin activation fills the `[0.5, 1]` half\n // of the ring; the raw `event` / `module` ids ride along so the loader owns\n // how each transition is rendered and traced. No-op once the outro has\n // started (`FadeOut`), so the dismissal runs uncontended.\n useEffect(() => {\n if (stage >= LoadingState.FadeOut) {\n return;\n }\n\n const fraction = progress?.progress ?? 0;\n bootLoader?.progress(0.5 + fraction * 0.5);\n if (progress?.humanizedName) {\n bootLoader?.status({\n event: progress.event,\n module: progress.module,\n humanized: `Activating ${progress.humanizedName}`,\n });\n }\n }, [stage, progress?.progress, progress?.event, progress?.module, progress?.humanizedName]);\n\n // Hand off at fade-out: play the loader's graceful shrink-and-fade outro.\n // `useLayoutEffect` runs before the next paint so the outro begins in the\n // same frame the real shell starts rendering beneath it.\n useLayoutEffect(() => {\n if (stage >= LoadingState.FadeOut) {\n bootLoader?.ready();\n }\n }, [stage]);\n\n // Emit a once-per-app `app-framework:first-interactive` mark the first time\n // the loader is dismissed and the real app shell renders. Closes the gap\n // between `Startup` activated and the first interactive paint.\n //\n // Also the framework-owned handoff-complete signal: `dismiss()` removes the\n // loader immediately on the fast-load path (where `useLoading` skips\n // `FadeOut`), and is a no-op once an outro is already in flight, so it never\n // cuts the animation short.\n useEffect(() => {\n if (!placeholderDismissed) {\n return;\n }\n if (performance.getEntriesByName(FIRST_INTERACTIVE_MARK).length === 0) {\n performance.mark(FIRST_INTERACTIVE_MARK);\n }\n bootLoader?.dismiss();\n }, [placeholderDismissed]);\n\n // Used in tests to exercise the error boundary & reset dialog (see\n // composer-app's `basic.spec.ts`). Thrown into the surrounding `ErrorBoundary`.\n if (location.search === '?throw') {\n throw new Error('Test error');\n }\n\n if (error) {\n // This triggers the error boundary to provide UI feedback for the startup error.\n throw error;\n }\n\n // The boot loader owns the screen until handoff completes; render nothing\n // until then (any DOM here would sit invisibly behind the `z-index: 10`\n // loader anyway).\n // TODO(wittjosiah): Consider using Suspense instead.\n if (!placeholderDismissed) {\n return null;\n }\n\n const ComposedContext = composeContexts(reactContexts);\n return (\n <ComposedContext>\n {reactRoots.map(({ id, root: Component }) => (\n <Component key={id} />\n ))}\n </ComposedContext>\n );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]) => {\n if (contexts.length === 0) {\n return ({ children }: PropsWithChildren) => <>{children}</>;\n }\n\n return topologicalSort(contexts)\n .map(({ context }) => context)\n .reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { type PropsWithChildren, forwardRef } from 'react';\n\nimport { SystemIconButton, type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/ui-theme';\n\n//\n// Root\n//\n\ntype HomeSectionRootProps = ThemedClassName<PropsWithChildren>;\n\n/**\n * Shared container for a Home content section: a centered, max-width column. Home surface\n * contributors (welcome, recent, dashboard, suggestions) render inside one so they share a\n * consistent width and rhythm regardless of which plugin owns them.\n */\nconst HomeSectionRoot = forwardRef<HTMLDivElement, HomeSectionRootProps>(({ classNames, children }, forwardedRef) => (\n <div ref={forwardedRef} className={mx('flex flex-col w-full mx-auto max-w-[40rem]', classNames)}>\n {children}\n </div>\n));\n\nHomeSectionRoot.displayName = 'HomeSection.Root';\n\n//\n// Header\n//\n\ntype HomeSectionHeaderProps = ThemedClassName<\n PropsWithChildren<{\n /** Section heading. */\n title?: string;\n /** When provided, renders a close affordance that hides the section. */\n onClose?: () => void;\n }>\n>;\n\n/**\n * Header row for a Home section: a muted title, an optional trailing actions slot (`children`),\n * and an optional close affordance. `children` render before the close button so section-specific\n * controls (e.g. a range selector) sit inline with it.\n */\nconst HomeSectionHeader = forwardRef<HTMLDivElement, HomeSectionHeaderProps>(\n ({ title, onClose, classNames, children }, forwardedRef) => (\n <div ref={forwardedRef} className={mx('flex items-center gap-2', classNames)}>\n {title && <h2 className='grow truncate text-sm font-medium text-description'>{title}</h2>}\n {!title && <span className='grow' />}\n {children}\n {onClose && <SystemIconButton.Close variant='ghost' iconOnly onClick={onClose} />}\n </div>\n ),\n);\n\nHomeSectionHeader.displayName = 'HomeSection.Header';\n\n//\n// HomeSection\n//\n\nexport const HomeSection = {\n Root: HomeSectionRoot,\n Header: HomeSectionHeader,\n};\n\nexport type { HomeSectionHeaderProps, HomeSectionRootProps };\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { type PropsWithChildren, useState } from 'react';\n\nimport { Button, Input, Popover } from '@dxos/react-ui';\n\nexport type NamePopoverProps = PropsWithChildren<{\n open: boolean;\n placeholder: string;\n /** Translated label for the submit button (e.g. \"Create\"). */\n submitLabel: string;\n onSubmit: (name: string) => void;\n onCancel: () => void;\n}>;\n\n/**\n * Name-entry popover anchored to its trigger (mirrors the object rename popover UX).\n * Enter or the submit button commits — an empty name is allowed; Escape or dismissal cancels.\n */\nexport const NamePopover = ({ children, open, placeholder, submitLabel, onSubmit, onCancel }: NamePopoverProps) => {\n const [value, setValue] = useState('');\n\n const submit = () => {\n onSubmit(value);\n setValue('');\n };\n\n const cancel = () => {\n onCancel();\n setValue('');\n };\n\n return (\n <Popover.Root open={open} onOpenChange={(next) => !next && cancel()}>\n <Popover.Trigger asChild>{children}</Popover.Trigger>\n <Popover.Portal>\n <Popover.Content>\n <div className='flex items-center gap-1 p-2'>\n <Input.Root>\n <Input.Label srOnly>{placeholder}</Input.Label>\n <Input.TextInput\n autoFocus\n placeholder={placeholder}\n value={value}\n onChange={(event) => setValue(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n submit();\n } else if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n cancel();\n }\n }}\n />\n </Input.Root>\n <Button variant='primary' onClick={submit}>\n {submitLabel}\n </Button>\n </div>\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n\nNamePopover.displayName = 'NamePopover';\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { Role } from '../../../common';\nimport { SurfaceContext } from './context';\nimport { SurfaceComponent, useIsSurfaceAvailable } from './SurfaceComponent';\nimport { isSurfaceDebugEnabled, setSurfaceDebug } from './SurfaceDebug';\nimport { type SurfaceMetric, surfaceMetrics, useSurfaceMetrics } from './SurfaceMetrics';\nimport {\n SurfaceProfilerProvider,\n useSurfaceProfilerCallback,\n useSurfaceProfilerClear,\n useSurfaceProfilerEntries,\n useSurfaceProfilerStats,\n} from './SurfaceProfilerContext';\nimport {\n type Binding as SurfaceBindingType,\n type ComponentProps as SurfaceComponentPropsType,\n type Definition as SurfaceDefinition,\n type Filter as SurfaceFilterType,\n type TypedProps as SurfaceTypedProps,\n create as createSurface,\n createWeb as createWebSurface,\n isFilter as isFilterFn,\n makeFilter as makeFilterFn,\n} from './types';\n\nexport namespace Surface {\n export type Definition = SurfaceDefinition;\n export const create = createSurface;\n export const createWeb = createWebSurface;\n\n export type Context = SurfaceContext;\n export const Context = SurfaceContext;\n\n export const Surface = SurfaceComponent;\n export const useIsAvailable = useIsSurfaceAvailable;\n\n export type Binding = SurfaceBindingType;\n export type Filter<TData> = SurfaceFilterType<TData>;\n export const makeFilter = makeFilterFn;\n export const isFilter = isFilterFn;\n\n export type TypedProps<TToken extends Role.Role<any>> = SurfaceTypedProps<TToken>;\n\n /** Props a matched surface component receives, and the input to a definition's `props` mapper. */\n export type ComponentProps<T extends Record<string, any> = Record<string, any>> = SurfaceComponentPropsType<T>;\n\n export const isDebugEnabled = isSurfaceDebugEnabled;\n export const setDebug = setSurfaceDebug;\n\n export const ProfilerProvider = SurfaceProfilerProvider;\n export const useProfilerCallback = useSurfaceProfilerCallback;\n export const useProfilerEntries = useSurfaceProfilerEntries;\n export const useProfilerStats = useSurfaceProfilerStats;\n export const useProfilerClear = useSurfaceProfilerClear;\n\n export type Metric = SurfaceMetric;\n export const useMetrics = useSurfaceMetrics;\n export const clearMetrics = () => surfaceMetrics.clear();\n}\n\nexport type { SurfaceProfilerEntry, SurfaceProfilerStats } from './SurfaceProfilerContext';\nexport type { SurfaceMetric } from './SurfaceMetrics';\nexport { SurfaceManager } from './SurfaceManager';\nexport { SurfaceManagerProvider, useSurfaceManager } from './SurfaceManagerContext';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;AA+EpB,IAAa,UAAU,EACrB,eACA,cAAc,kBACd,gBACA,wBACA,SAAS,aACT,UAAU,cACV,aAAa,iBACb,WAAW,eACX,eAAe,OACf,WAAW,OACX,WAAW,GACX,UAAU,UACS;CACnB,MAAM,UAAU,gBAAgB,mBAAmB,CAAC,CAAC;CACrD,MAAM,WAAW,gBAAgB,oBAAoB,CAAC,CAAC;CACvD,MAAM,cAAc,gBAAgB,uBAAuB,CAAC,CAAC;CAE7D,MAAM,eAAe,cAEjB,sBACE,OACA,OAAO,WAAW;EAChB,MAAM,SAAS,QAAQ,MAAM,WAAW,OAAO,KAAK,QAAQ,QAAQ,EAAE;EACtE,UAAU,QAAQ,qBAAqB,MAAG;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;GAAA,GAAA,CAAA,UAAA,2BAAA;EAAA,CAAC;EAC3C,OAAO,EAAE,OAAO;CAClB,CAAC,IACL,CAAC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