@dxos/app-framework 0.8.4-main.69d29f4 → 0.8.4-main.6fa680abb7

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 (363) hide show
  1. package/.storybook/main.mts +1 -3
  2. package/dist/lib/browser/{capability-7PCNSWBT.mjs → capability-6YMUBS54.mjs} +15 -11
  3. package/dist/lib/browser/capability-6YMUBS54.mjs.map +7 -0
  4. package/dist/lib/browser/capability-LF3OXSCV.mjs +34 -0
  5. package/dist/lib/browser/capability-LF3OXSCV.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-272IPLHQ.mjs} +1 -1
  7. package/dist/lib/browser/{chunk-PKQT6C53.mjs.map → chunk-272IPLHQ.mjs.map} +1 -1
  8. package/dist/lib/browser/{chunk-FMZN33N4.mjs → chunk-2UI6ACB5.mjs} +48 -31
  9. package/dist/lib/browser/chunk-2UI6ACB5.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-TCLLRCS3.mjs → chunk-7M4467QR.mjs} +6 -6
  11. package/dist/lib/browser/chunk-7M4467QR.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-7IQHKD4U.mjs → chunk-JGWCBVKJ.mjs} +2 -2
  13. package/dist/lib/browser/chunk-JGWCBVKJ.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-M5IC326L.mjs +34 -0
  15. package/dist/lib/browser/chunk-M5IC326L.mjs.map +7 -0
  16. package/dist/lib/browser/{chunk-XYNO72GQ.mjs → chunk-NQPYE365.mjs} +435 -478
  17. package/dist/lib/browser/chunk-NQPYE365.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
  19. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-TGX63LTL.mjs.map} +1 -1
  20. package/dist/lib/browser/chunk-TIEBZMTF.mjs +44 -0
  21. package/dist/lib/browser/chunk-TIEBZMTF.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-WEBSGU5L.mjs +80 -0
  23. package/dist/lib/browser/chunk-WEBSGU5L.mjs.map +7 -0
  24. package/dist/lib/browser/chunk-YAFEA4GV.mjs +1 -0
  25. package/dist/lib/browser/{chunk-6Y7PZV72.mjs → chunk-YNFPIQGB.mjs} +2 -3
  26. package/dist/lib/browser/{chunk-6Y7PZV72.mjs.map → chunk-YNFPIQGB.mjs.map} +3 -3
  27. package/dist/lib/browser/cli/index.mjs +89 -0
  28. package/dist/lib/browser/cli/index.mjs.map +7 -0
  29. package/dist/lib/browser/common/activation-events.mjs +23 -0
  30. package/dist/lib/browser/common/capabilities.mjs +45 -0
  31. package/dist/lib/browser/core/activation-event.mjs +1 -1
  32. package/dist/lib/browser/core/capability.mjs +1 -1
  33. package/dist/lib/browser/core/plugin-manager.mjs +4 -4
  34. package/dist/lib/browser/core/plugin.mjs +2 -2
  35. package/dist/lib/browser/index.mjs +37 -132
  36. package/dist/lib/browser/index.mjs.map +4 -4
  37. package/dist/lib/browser/{invoker-capability-SZRSTHEH.mjs → invoker-capability-4AUGUMM5.mjs} +16 -12
  38. package/dist/lib/browser/invoker-capability-4AUGUMM5.mjs.map +7 -0
  39. package/dist/lib/browser/meta.json +1 -1
  40. package/dist/lib/browser/testing/index.mjs +28 -20
  41. package/dist/lib/browser/testing/index.mjs.map +3 -3
  42. package/dist/lib/browser/{react → ui}/index.mjs +18 -19
  43. package/dist/lib/node-esm/{capability-CFLQ2QQU.mjs → capability-R5O2OYX4.mjs} +15 -11
  44. package/dist/lib/node-esm/capability-R5O2OYX4.mjs.map +7 -0
  45. package/dist/lib/node-esm/capability-SA6LPYGL.mjs +35 -0
  46. package/dist/lib/node-esm/capability-SA6LPYGL.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-663A54LQ.mjs → chunk-3D66SZHP.mjs} +2 -2
  48. package/dist/lib/node-esm/chunk-3D66SZHP.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-6REV5DE7.mjs} +1 -1
  50. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs.map → chunk-6REV5DE7.mjs.map} +1 -1
  51. package/dist/lib/node-esm/{chunk-6WXBT3EC.mjs → chunk-FHWPWQRJ.mjs} +435 -478
  52. package/dist/lib/node-esm/chunk-FHWPWQRJ.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-FKE4Z3D6.mjs} +2 -2
  54. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-FKE4Z3D6.mjs.map} +1 -1
  55. package/dist/lib/node-esm/{chunk-GT6OKM5I.mjs → chunk-JHFY3HTS.mjs} +6 -6
  56. package/dist/lib/node-esm/chunk-JHFY3HTS.mjs.map +7 -0
  57. package/dist/lib/node-esm/{chunk-XYQTBFPA.mjs → chunk-JIVXIJ2T.mjs} +48 -31
  58. package/dist/lib/node-esm/chunk-JIVXIJ2T.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs +35 -0
  60. package/dist/lib/node-esm/chunk-NHXBSAQR.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-STMXUEPO.mjs → chunk-SB5ODNPX.mjs} +2 -3
  62. package/dist/lib/node-esm/{chunk-STMXUEPO.mjs.map → chunk-SB5ODNPX.mjs.map} +3 -3
  63. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs +45 -0
  64. package/dist/lib/node-esm/chunk-SCDGIGGU.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-SQICGJBW.mjs +81 -0
  66. package/dist/lib/node-esm/chunk-SQICGJBW.mjs.map +7 -0
  67. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +2 -0
  68. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs.map +7 -0
  69. package/dist/lib/node-esm/cli/index.mjs +90 -0
  70. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  71. package/dist/lib/node-esm/common/activation-events.mjs +24 -0
  72. package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
  73. package/dist/lib/node-esm/common/capabilities.mjs +46 -0
  74. package/dist/lib/node-esm/common/capabilities.mjs.map +7 -0
  75. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  76. package/dist/lib/node-esm/core/capability.mjs +1 -1
  77. package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
  78. package/dist/lib/node-esm/core/plugin.mjs +2 -2
  79. package/dist/lib/node-esm/index.mjs +37 -132
  80. package/dist/lib/node-esm/index.mjs.map +4 -4
  81. package/dist/lib/node-esm/{invoker-capability-PNMA5JOS.mjs → invoker-capability-3YDIVDWV.mjs} +16 -12
  82. package/dist/lib/node-esm/invoker-capability-3YDIVDWV.mjs.map +7 -0
  83. package/dist/lib/node-esm/meta.json +1 -1
  84. package/dist/lib/node-esm/testing/index.mjs +28 -20
  85. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  86. package/dist/lib/node-esm/{react → ui}/index.mjs +18 -19
  87. package/dist/lib/node-esm/ui/index.mjs.map +7 -0
  88. package/dist/types/src/{cli.d.ts → cli/cli.d.ts} +2 -2
  89. package/dist/types/src/cli/cli.d.ts.map +1 -0
  90. package/dist/types/src/cli/index.d.ts +2 -0
  91. package/dist/types/src/cli/index.d.ts.map +1 -0
  92. package/dist/types/src/common/activation-events.d.ts +27 -0
  93. package/dist/types/src/common/activation-events.d.ts.map +1 -0
  94. package/dist/types/src/common/capabilities.d.ts +115 -0
  95. package/dist/types/src/common/capabilities.d.ts.map +1 -0
  96. package/dist/types/src/common/index.d.ts +4 -9
  97. package/dist/types/src/common/index.d.ts.map +1 -1
  98. package/dist/types/src/common/operations.d.ts +1 -348
  99. package/dist/types/src/common/operations.d.ts.map +1 -1
  100. package/dist/types/src/common/translations.d.ts +0 -9
  101. package/dist/types/src/common/translations.d.ts.map +1 -1
  102. package/dist/types/src/core/activation-event.d.ts +1 -1
  103. package/dist/types/src/core/capability.d.ts +7 -7
  104. package/dist/types/src/core/capability.d.ts.map +1 -1
  105. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  106. package/dist/types/src/core/plugin.d.ts +1 -1
  107. package/dist/types/src/core/plugin.d.ts.map +1 -1
  108. package/dist/types/src/index.d.ts +1 -3
  109. package/dist/types/src/index.d.ts.map +1 -1
  110. package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
  111. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +11 -3
  112. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  113. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  114. package/dist/types/src/plugin-runtime/capability.d.ts +2 -2
  115. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  116. package/dist/types/src/testing/withPluginManager.d.ts +1 -1
  117. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  118. package/dist/types/src/{react → ui/components/App}/App.d.ts +1 -1
  119. package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
  120. package/dist/types/src/{react/Surface.stories.d.ts → ui/components/App/App.stories.d.ts} +7 -2
  121. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
  122. package/dist/types/src/ui/components/App/index.d.ts +2 -0
  123. package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
  124. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
  125. package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerProvider.d.ts +1 -1
  126. package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
  127. package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
  128. package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
  129. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +12 -0
  130. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
  131. package/dist/types/src/{react/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
  132. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
  133. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
  134. package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
  135. package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
  136. package/dist/types/src/ui/components/Surface/index.d.ts +20 -0
  137. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
  138. package/dist/types/src/{common/surface.d.ts → ui/components/Surface/types.d.ts} +20 -18
  139. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
  140. package/dist/types/src/ui/components/index.d.ts +4 -0
  141. package/dist/types/src/ui/components/index.d.ts.map +1 -0
  142. package/dist/types/src/ui/hooks/index.d.ts +7 -0
  143. package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
  144. package/dist/types/src/{react → ui/hooks}/useApp.d.ts +14 -9
  145. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
  146. package/dist/types/src/{react → ui/hooks}/useCapabilities.d.ts +6 -1
  147. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
  148. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
  149. package/dist/types/src/{react → ui/hooks}/useOperationResolver.d.ts +2 -2
  150. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +1 -0
  151. package/dist/types/src/{react/common.d.ts → ui/hooks/useSettingsState.d.ts} +1 -5
  152. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
  153. package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
  154. package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
  155. package/dist/types/src/ui/index.d.ts +3 -0
  156. package/dist/types/src/ui/index.d.ts.map +1 -0
  157. package/dist/types/tsconfig.tsbuildinfo +1 -1
  158. package/moon.yml +6 -6
  159. package/package.json +72 -64
  160. package/src/{cli.ts → cli/cli.ts} +10 -10
  161. package/src/{playground/debug → cli}/index.ts +1 -1
  162. package/src/common/activation-events.ts +44 -0
  163. package/src/common/capabilities.ts +178 -0
  164. package/src/common/index.ts +4 -9
  165. package/src/common/operations.ts +2 -376
  166. package/src/common/translations.ts +0 -12
  167. package/src/context.ts +1 -1
  168. package/src/core/activation-event.ts +1 -1
  169. package/src/core/capability.ts +9 -9
  170. package/src/core/plugin-manager.test.ts +44 -44
  171. package/src/core/plugin-manager.ts +19 -0
  172. package/src/core/plugin.ts +3 -2
  173. package/src/index.ts +1 -3
  174. package/src/plugin-operation/OperationPlugin.ts +5 -5
  175. package/src/plugin-operation/history/capability.ts +5 -5
  176. package/src/plugin-operation/history/undo-mapping.ts +6 -3
  177. package/src/plugin-operation/invoker-capability.ts +5 -5
  178. package/src/plugin-operation/meta.ts +1 -1
  179. package/src/plugin-runtime/RuntimePlugin.ts +4 -4
  180. package/src/plugin-runtime/capability.ts +5 -5
  181. package/src/plugin-runtime/meta.ts +1 -1
  182. package/src/testing/service.ts +6 -6
  183. package/src/testing/withPluginManager.stories.tsx +6 -6
  184. package/src/testing/withPluginManager.tsx +11 -8
  185. package/src/ui/components/App/App.stories.tsx +92 -0
  186. package/src/{react → ui/components/App}/App.tsx +6 -9
  187. package/src/{playground/layout → ui/components/App}/index.ts +1 -1
  188. package/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.tsx +13 -14
  189. package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +1 -1
  190. package/src/ui/components/PluginManager/index.ts +5 -0
  191. package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +18 -16
  192. package/src/{react/Surface.tsx → ui/components/Surface/SurfaceComponent.tsx} +36 -56
  193. package/src/{react → ui/components/Surface}/SurfaceInfo.tsx +2 -2
  194. package/src/ui/components/Surface/context.ts +12 -0
  195. package/src/ui/components/Surface/index.ts +20 -0
  196. package/src/{common/surface.ts → ui/components/Surface/types.ts} +22 -25
  197. package/src/ui/components/index.ts +7 -0
  198. package/src/ui/hooks/index.ts +10 -0
  199. package/src/{react → ui/hooks}/useApp.tsx +29 -25
  200. package/src/{react → ui/hooks}/useCapabilities.ts +9 -5
  201. package/src/{react → ui/hooks}/useOperationResolver.ts +5 -5
  202. package/src/{react/common.ts → ui/hooks/useSettingsState.ts} +0 -11
  203. package/src/ui/hooks/useSurface.ts +13 -0
  204. package/src/ui/index.ts +6 -0
  205. package/tsconfig.json +2 -29
  206. package/tsconfig.node.json +1 -3
  207. package/typedoc.json +2 -4
  208. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +0 -149
  209. package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +0 -7
  210. package/dist/lib/browser/capability-7PCNSWBT.mjs.map +0 -7
  211. package/dist/lib/browser/capability-KP3PFEXD.mjs +0 -31
  212. package/dist/lib/browser/capability-KP3PFEXD.mjs.map +0 -7
  213. package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +0 -7
  214. package/dist/lib/browser/chunk-BLQJSGL3.mjs +0 -732
  215. package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +0 -7
  216. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  217. package/dist/lib/browser/chunk-FMZN33N4.mjs.map +0 -7
  218. package/dist/lib/browser/chunk-H4WPA7U7.mjs +0 -77
  219. package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +0 -7
  220. package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +0 -7
  221. package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +0 -7
  222. package/dist/lib/browser/common/index.mjs +0 -38
  223. package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +0 -7
  224. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +0 -64
  225. package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +0 -7
  226. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +0 -150
  227. package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +0 -7
  228. package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +0 -7
  229. package/dist/lib/node-esm/capability-RCUNM2M7.mjs +0 -32
  230. package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +0 -7
  231. package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +0 -7
  232. package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +0 -7
  233. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +0 -733
  234. package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +0 -7
  235. package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +0 -78
  237. package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +0 -7
  238. package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +0 -7
  239. package/dist/lib/node-esm/common/index.mjs +0 -39
  240. package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +0 -7
  241. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +0 -65
  242. package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +0 -7
  243. package/dist/types/src/cli.d.ts.map +0 -1
  244. package/dist/types/src/common/activation-event.d.ts +0 -66
  245. package/dist/types/src/common/activation-event.d.ts.map +0 -1
  246. package/dist/types/src/common/capability.d.ts +0 -265
  247. package/dist/types/src/common/capability.d.ts.map +0 -1
  248. package/dist/types/src/common/collaboration.d.ts +0 -26
  249. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  250. package/dist/types/src/common/file.d.ts +0 -14
  251. package/dist/types/src/common/file.d.ts.map +0 -1
  252. package/dist/types/src/common/graph.d.ts +0 -21
  253. package/dist/types/src/common/graph.d.ts.map +0 -1
  254. package/dist/types/src/common/plugin.d.ts +0 -201
  255. package/dist/types/src/common/plugin.d.ts.map +0 -1
  256. package/dist/types/src/common/surface.d.ts.map +0 -1
  257. package/dist/types/src/playground/debug/Debug.d.ts +0 -8
  258. package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
  259. package/dist/types/src/playground/debug/index.d.ts +0 -2
  260. package/dist/types/src/playground/debug/index.d.ts.map +0 -1
  261. package/dist/types/src/playground/debug/plugin.d.ts +0 -3
  262. package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
  263. package/dist/types/src/playground/generator/Main.d.ts +0 -8
  264. package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
  265. package/dist/types/src/playground/generator/Toolbar.d.ts +0 -8
  266. package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
  267. package/dist/types/src/playground/generator/generator.d.ts +0 -19
  268. package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
  269. package/dist/types/src/playground/generator/index.d.ts +0 -3
  270. package/dist/types/src/playground/generator/index.d.ts.map +0 -1
  271. package/dist/types/src/playground/generator/plugin.d.ts +0 -3
  272. package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
  273. package/dist/types/src/playground/layout/Layout.d.ts +0 -10
  274. package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
  275. package/dist/types/src/playground/layout/index.d.ts +0 -2
  276. package/dist/types/src/playground/layout/index.d.ts.map +0 -1
  277. package/dist/types/src/playground/layout/plugin.d.ts +0 -3
  278. package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
  279. package/dist/types/src/playground/logger/Toolbar.d.ts +0 -8
  280. package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
  281. package/dist/types/src/playground/logger/index.d.ts +0 -2
  282. package/dist/types/src/playground/logger/index.d.ts.map +0 -1
  283. package/dist/types/src/playground/logger/plugin.d.ts +0 -3
  284. package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
  285. package/dist/types/src/playground/logger/schema.d.ts +0 -27
  286. package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
  287. package/dist/types/src/playground/playground.stories.d.ts +0 -11
  288. package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
  289. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -3
  290. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  291. package/dist/types/src/plugin-settings/actions.d.ts +0 -61
  292. package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
  293. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -6
  294. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
  295. package/dist/types/src/plugin-settings/index.d.ts +0 -3
  296. package/dist/types/src/plugin-settings/index.d.ts.map +0 -1
  297. package/dist/types/src/plugin-settings/meta.d.ts +0 -3
  298. package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
  299. package/dist/types/src/plugin-settings/operation-resolver.d.ts +0 -6
  300. package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +0 -1
  301. package/dist/types/src/plugin-settings/translations.d.ts +0 -11
  302. package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
  303. package/dist/types/src/react/App.d.ts.map +0 -1
  304. package/dist/types/src/react/App.stories.d.ts.map +0 -1
  305. package/dist/types/src/react/DefaultFallback.d.ts +0 -8
  306. package/dist/types/src/react/DefaultFallback.d.ts.map +0 -1
  307. package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
  308. package/dist/types/src/react/ErrorBoundary.d.ts.map +0 -1
  309. package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +0 -1
  310. package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
  311. package/dist/types/src/react/Surface.d.ts +0 -14
  312. package/dist/types/src/react/Surface.d.ts.map +0 -1
  313. package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
  314. package/dist/types/src/react/SurfaceInfo.d.ts.map +0 -1
  315. package/dist/types/src/react/common.d.ts.map +0 -1
  316. package/dist/types/src/react/index.d.ts +0 -9
  317. package/dist/types/src/react/index.d.ts.map +0 -1
  318. package/dist/types/src/react/types.d.ts +0 -12
  319. package/dist/types/src/react/types.d.ts.map +0 -1
  320. package/dist/types/src/react/useApp.d.ts.map +0 -1
  321. package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
  322. package/dist/types/src/react/useLoading.d.ts.map +0 -1
  323. package/dist/types/src/react/useOperationResolver.d.ts.map +0 -1
  324. package/src/common/activation-event.ts +0 -99
  325. package/src/common/capability.ts +0 -343
  326. package/src/common/collaboration.ts +0 -31
  327. package/src/common/file.ts +0 -22
  328. package/src/common/graph.ts +0 -30
  329. package/src/common/plugin.ts +0 -364
  330. package/src/playground/debug/Debug.tsx +0 -49
  331. package/src/playground/debug/plugin.ts +0 -16
  332. package/src/playground/generator/Main.tsx +0 -80
  333. package/src/playground/generator/Toolbar.tsx +0 -57
  334. package/src/playground/generator/generator.ts +0 -48
  335. package/src/playground/generator/index.ts +0 -6
  336. package/src/playground/generator/plugin.ts +0 -21
  337. package/src/playground/layout/Layout.tsx +0 -37
  338. package/src/playground/layout/plugin.ts +0 -18
  339. package/src/playground/logger/Toolbar.tsx +0 -33
  340. package/src/playground/logger/index.ts +0 -5
  341. package/src/playground/logger/plugin.ts +0 -42
  342. package/src/playground/logger/schema.ts +0 -22
  343. package/src/playground/playground.stories.tsx +0 -54
  344. package/src/plugin-settings/SettingsPlugin.ts +0 -19
  345. package/src/plugin-settings/actions.ts +0 -64
  346. package/src/plugin-settings/app-graph-builder.ts +0 -140
  347. package/src/plugin-settings/index.ts +0 -6
  348. package/src/plugin-settings/meta.ts +0 -10
  349. package/src/plugin-settings/operation-resolver.ts +0 -55
  350. package/src/plugin-settings/translations.ts +0 -19
  351. package/src/react/App.stories.tsx +0 -63
  352. package/src/react/DefaultFallback.tsx +0 -26
  353. package/src/react/ErrorBoundary.tsx +0 -56
  354. package/src/react/index.ts +0 -14
  355. package/src/react/types.ts +0 -27
  356. /package/dist/lib/{node-esm/react/index.mjs.map → browser/chunk-YAFEA4GV.mjs.map} +0 -0
  357. /package/dist/lib/{node-esm/common/index.mjs.map → browser/common/activation-events.mjs.map} +0 -0
  358. /package/dist/lib/browser/{react/index.mjs.map → common/capabilities.mjs.map} +0 -0
  359. /package/dist/lib/browser/{common → ui}/index.mjs.map +0 -0
  360. /package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.d.ts +0 -0
  361. /package/dist/types/src/{react → ui/components/Surface}/SurfaceInfo.d.ts +0 -0
  362. /package/dist/types/src/{react → ui/hooks}/useLoading.d.ts +0 -0
  363. /package/src/{react → ui/hooks}/useLoading.tsx +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/ui/components/App/App.tsx", "../../../src/helpers.ts", "../../../src/ui/hooks/useApp.tsx", "../../../src/ui/hooks/useCapabilities.ts", "../../../src/ui/hooks/useLoading.tsx", "../../../src/ui/hooks/useOperationResolver.ts", "../../../src/ui/hooks/useSettingsState.ts", "../../../src/ui/hooks/useSurface.ts", "../../../src/ui/components/PluginManager/PluginManagerProvider.ts", "../../../src/ui/components/Surface/context.ts", "../../../src/ui/components/Surface/SurfaceComponent.tsx", "../../../src/ui/components/Surface/SurfaceInfo.tsx", "../../../src/ui/components/Surface/types.ts", "../../../src/ui/components/Surface/index.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { type PropsWithChildren } from 'react';\n\nimport { Capabilities } from '../../../common';\nimport { topologicalSort } from '../../../helpers';\nimport { LoadingState, type UseAppOptions, useCapabilities, useLoading } from '../../hooks';\n\nexport type AppProps = Pick<UseAppOptions, 'placeholder' | 'debounce'> & {\n ready: boolean;\n error: unknown;\n};\n\nexport const App = ({ placeholder: Placeholder, ready, error, debounce }: AppProps) => {\n const reactContexts = useCapabilities(Capabilities.ReactContext);\n const reactRoots = useCapabilities(Capabilities.ReactRoot);\n const stage = useLoading(ready, debounce);\n\n if (error) {\n // This triggers the error boundary to provide UI feedback for the startup error.\n throw error;\n }\n\n // TODO(wittjosiah): Consider using Suspense instead.\n if (stage < LoadingState.Done) {\n if (!Placeholder) {\n return null;\n }\n\n return <Placeholder stage={stage} />;\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 2025 DXOS.org\n//\n\ntype DependencyNode = {\n id: string;\n dependsOn?: string[];\n};\n\n/**\n * Topologically sorts a list of nodes based on their dependencies.\n */\n// TODO(wittjosiah): Factor out?\nexport const topologicalSort = <T extends DependencyNode>(nodes: T[]): T[] => {\n const getDependencies = (nodeId: string, seen = new Set<string>(), path = new Set<string>()): string[] => {\n if (path.has(nodeId)) {\n throw new Error(`Circular dependency detected involving ${nodeId}`);\n }\n if (seen.has(nodeId)) {\n return [];\n }\n\n const node = nodes.find((n) => n.id === nodeId);\n if (!node) {\n throw new Error(`Node ${nodeId} not found but is listed as a dependency`);\n }\n\n const newPath = new Set([...path, nodeId]);\n const newSeen = new Set([...seen, nodeId]);\n\n const dependsOn = node.dependsOn ?? [];\n return [...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)), nodeId];\n };\n\n // Get all unique dependencies.\n const allDependencies = nodes\n .map((node) => node.id)\n .flatMap((id) => getDependencies(id))\n .filter((id, index, self) => self.indexOf(id) === index);\n\n // Map back to original nodes\n return allDependencies\n .map((id) => nodes.find((node) => node.id === id))\n .filter((node): node is T => node !== undefined);\n};\n", "//\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 { runAndForwardErrors } 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 } from '../components';\n\nconst ENABLED_KEY = 'org.dxos.app-framework.enabled';\n\nexport type UseAppOptions = {\n pluginManager?: PluginManager.PluginManager;\n pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];\n plugins?: Plugin.Plugin[];\n core?: string[];\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 placeholder?: FC<{ stage: number }>;\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 core = [LayoutPluginId];\n * const default = [MyPluginId];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = useApp({ plugins, core, default, 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.\n * @param params.core Core plugins which will always be enabled.\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 * @param params.placeholder Placeholder component to render during startup.\n */\nexport const useApp = ({\n pluginManager,\n pluginLoader: pluginLoaderProp,\n plugins: pluginsProp,\n core: coreProp,\n defaults: defaultsProp,\n setupEvents: setupEventsProp,\n placeholder,\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 core = useDefaultValue(coreProp, () => plugins.map(({ meta }) => meta.id));\n const defaults = useDefaultValue(defaultsProp, () => []);\n const setupEvents = useDefaultValue(setupEventsProp, () => []);\n\n // TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.\n const pluginLoader = useMemo(\n () =>\n pluginLoaderProp ??\n ((id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.id === 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 // 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 manager = useMemo(\n () => pluginManager ?? PluginManager.make({ pluginLoader, plugins, core, enabled }),\n [pluginManager, pluginLoader, plugins, core, enabled],\n );\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 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, error: error$ }) =>\n Effect.sync(() => {\n if (event === ActivationEvents.Startup.id && state === 'activated') {\n clearTimeout(timeoutId);\n setReady(true);\n readyRef.current = true;\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 runAndForwardErrors(Fiber.interrupt(fiber));\n setError(new Error(`Startup timed out after ${timeout}ms`));\n }\n }, timeout);\n\n return () => {\n clearTimeout(timeoutId);\n void runAndForwardErrors(Fiber.interrupt(fiber));\n manager.capabilities.remove(Capabilities.PluginManager, manager);\n manager.capabilities.remove(Capabilities.AtomRegistry, manager.registry);\n };\n }, [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 <App placeholder={placeholder} ready={ready} error={error} debounce={debounce} />\n </RegistryContext.Provider>\n </ContextProtocolProvider>\n </PluginManagerProvider>\n </ErrorBoundary>\n ),\n [fallback, manager, placeholder, 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// Copyright 2025 DXOS.org\n//\n\nimport { type Atom, 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 { usePluginManager } from '../components';\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 */\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 get the current value of an atom capability.\n * Automatically subscribes to changes.\n * @example const settings = useAtomCapability(ThreadCapabilities.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(ThreadCapabilities.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 * 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, 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 useEffect(() => {\n if (!debounce) {\n return;\n }\n\n const i = setInterval(() => {\n setStage((stage) => {\n switch (stage) {\n case LoadingState.Loading: {\n if (!ready) {\n return LoadingState.FadeIn;\n } else {\n clearInterval(i);\n return LoadingState.Done;\n }\n }\n\n case LoadingState.FadeIn: {\n if (ready) {\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 2025 DXOS.org\n//\n\nimport { useEffect, useMemo } from 'react';\n\nimport { Capabilities } from '../../common';\nimport { usePluginManager } from '../components';\n\n/**\n * Hook to dynamically register an operation resolver (handler) within a React component.\n * The resolver is added when the component mounts and removed when it unmounts.\n *\n * @example\n * ```tsx\n * const scrollHandler = useMemo(() => OperationResolver.make({\n * operation: LayoutOperation.ScrollIntoView,\n * handler: (input) => Effect.sync(() => {\n * // Handle scroll\n * }),\n * }), [deps]);\n *\n * useOperationResolver(meta.id, scrollHandler);\n * ```\n */\nexport const useOperationResolver = (module: string, resolver: Capabilities.OperationResolver) => {\n const manager = usePluginManager();\n // Wrap single resolver in array as the capability expects an array.\n const resolverArray = useMemo(() => [resolver], [resolver]);\n\n useEffect(() => {\n manager.capabilities.contribute({\n module,\n interface: Capabilities.OperationResolver,\n implementation: resolverArray,\n });\n\n return () => manager.capabilities.remove(Capabilities.OperationResolver, resolverArray);\n }, [module, resolverArray]);\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 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type PluginManager } from '../../../core';\n\nconst PluginManagerContext = createContext<PluginManager.PluginManager | undefined>(undefined);\n\n/**\n * Get the plugin manager.\n */\nexport const usePluginManager = (): PluginManager.PluginManager =>\n useContext(PluginManagerContext) ?? raise(new Error('Missing PluginManagerContext'));\n\n/**\n * Context provider for a plugin manager.\n */\nexport const PluginManagerProvider = PluginManagerContext.Provider;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Context, createContext } from 'react';\n\nimport { type Props } from './types';\n\nexport type SurfaceContext = Pick<Props, 'id' | 'role' | 'data'>;\n\n// TODO(burdon): Use @radix-ui/react-context\nexport const SurfaceContext: Context<SurfaceContext | undefined> = createContext<SurfaceContext | undefined>(undefined);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, {\n Fragment,\n type NamedExoticComponent,\n type RefAttributes,\n Suspense,\n forwardRef,\n memo,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\n\nimport { log } from '@dxos/log';\nimport { ErrorBoundary } from '@dxos/react-error-boundary';\nimport { useDefaultValue } from '@dxos/react-hooks';\nimport { byPosition } from '@dxos/util';\n\nimport { Capabilities } from '../../../common';\nimport { type CapabilityManager } from '../../../core';\nimport { useCapabilities } from '../../hooks';\n\nimport { SurfaceContext } from './context';\nimport { SurfaceInfo } from './SurfaceInfo';\nimport { type Definition, type Props, type WebComponentDefinition } from './types';\n\nconst DEFAULT_PLACEHOLDER = <Fragment />;\n\nconst DEBUG = import.meta.env.VITE_DEBUG;\n\n/**\n * Wrapper component for rendering Web Component surfaces.\n * Handles creation, prop setting, and cleanup of Web Components.\n */\nconst WebComponentWrapper = memo(\n forwardRef<HTMLElement, Props & { definition: WebComponentDefinition }>(\n ({ id, role, data, limit, definition, ...rest }, forwardedRef) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const elementRef = useRef<HTMLElement | null>(null);\n const propsRef = useRef({ id, role, data, limit, ...rest });\n\n // Update props ref on every render\n propsRef.current = { id, role, data, limit, ...rest };\n\n // Create element only once\n useEffect(() => {\n if (!containerRef.current || elementRef.current) {\n return;\n }\n\n // Create the Web Component\n const element = document.createElement(definition.tagName);\n elementRef.current = element;\n\n // Set initial properties on the Web Component\n Object.assign(element, propsRef.current);\n\n // Append to container\n containerRef.current.appendChild(element);\n\n // Setup ref forwarding if provided\n if (typeof forwardedRef === 'function') {\n forwardedRef(element);\n } else if (forwardedRef) {\n forwardedRef.current = element;\n }\n\n // Cleanup on unmount to prevent memory leaks\n return () => {\n if (elementRef.current && containerRef.current?.contains(elementRef.current)) {\n containerRef.current.removeChild(elementRef.current);\n }\n if (typeof forwardedRef === 'function') {\n forwardedRef(null);\n } else if (forwardedRef) {\n forwardedRef.current = null;\n }\n elementRef.current = null;\n };\n }, [definition.tagName, forwardedRef]);\n\n // Update props on existing element without recreating it\n // This runs on every render to ensure all props (including those in `rest`) are kept up to date\n useEffect(() => {\n const element = elementRef.current;\n if (!element) {\n return;\n }\n\n // Update properties on the existing Web Component\n Object.assign(element, propsRef.current);\n });\n\n return <div ref={containerRef} />;\n },\n ),\n);\n\nWebComponentWrapper.displayName = 'WebComponentWrapper';\n\n/**\n * Wrapper component that provides context for a surface.\n */\n// TODO(burdon): Allow DebugPlugin to provide different fallback using react-ui ErrorFallback.\nconst SurfaceContextProvider = memo(\n forwardRef<HTMLElement, Props & { definition: Definition }>(\n ({ id, role, data, limit, fallback = ErrorFallback, definition, ...rest }, forwardedRef) => {\n const contextValue = useMemo(() => ({ id, role, data }), [id, role, data]);\n\n // Handle Web Component surfaces\n if (definition.kind === 'web-component') {\n return (\n <ErrorBoundary name='surface' resetKeys={[data]} FallbackComponent={fallback}>\n <SurfaceContext.Provider value={contextValue}>\n <WebComponentWrapper\n id={id}\n role={role}\n data={data}\n limit={limit}\n definition={definition}\n ref={forwardedRef}\n {...rest}\n />\n </SurfaceContext.Provider>\n </ErrorBoundary>\n );\n }\n\n // Handle React component surfaces\n const Component = definition.component;\n\n // TODO(burdon): Remove from production build?\n const debug = DEBUG || '__DX_DEBUG__' in window;\n if (debug) {\n return (\n <ErrorBoundary name='surface' resetKeys={[data]} FallbackComponent={fallback}>\n <div role='none' className='contents' data-id={id} data-role={role}>\n <SurfaceContext.Provider value={contextValue}>\n <SurfaceInfo ref={forwardedRef}>\n <Component id={id} role={role} data={data} limit={limit} {...rest} />\n </SurfaceInfo>\n </SurfaceContext.Provider>\n </div>\n </ErrorBoundary>\n );\n }\n\n return (\n <ErrorBoundary name='surface' resetKeys={[data]} FallbackComponent={fallback}>\n <div role='none' className='contents' data-id={id} data-role={role}>\n <SurfaceContext.Provider value={contextValue}>\n <Component id={id} role={role} data={data} limit={limit} {...rest} ref={forwardedRef} />\n </SurfaceContext.Provider>\n </div>\n </ErrorBoundary>\n );\n },\n ),\n);\n\nSurfaceContextProvider.displayName = 'SurfaceContextProvider';\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\n// TODO(burdon): Remove `ref` since relying on this would be error prone.\nexport const SurfaceComponent: NamedExoticComponent<Props & RefAttributes<HTMLElement>> = memo(\n forwardRef(({ id: _id, role, data: dataProp, limit, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {\n const data = useDefaultValue(dataProp, () => ({}));\n\n // TODO(wittjosiah): This will make all surfaces depend on a single signal.\n // This isn't ideal because it means that any change to the data will cause all surfaces to re-render.\n // This effectively means that plugin modules which contribute surfaces need to all be activated at startup.\n // This should be fine for now because it's how it worked prior to capabilities api anyway.\n // In the future, it would be nice to be able to bucket the surface contributions by role.\n const surfaces = useSurfaces();\n\n // NOTE: Memoizing the candidates makes the surface not re-render based on reactivity within data.\n const definitions = findCandidates(surfaces, { role, data });\n const candidates = limit ? definitions.slice(0, limit) : definitions;\n if (DEBUG && candidates.length === 0) {\n log.warn('no candidates for surface', { role, data });\n return null;\n }\n\n return (\n <Suspense fallback={placeholder}>\n {candidates.map((definition) => (\n <SurfaceContextProvider\n key={definition.id}\n id={definition.id}\n role={role}\n data={data}\n limit={limit}\n definition={definition}\n ref={forwardedRef}\n {...rest}\n />\n ))}\n </Suspense>\n );\n }),\n);\n\nSurfaceComponent.displayName = 'Surface';\n\n// TODO(burdon): Make user facing, with telemetry.\nconst ErrorFallback = ({ error }: Props) => {\n const { message } = error instanceof Error ? error : { message: String(error) };\n return (\n <div role='alert' data-testid='error-boundary-fallback'>\n <h1 className='flex gap-2 text-sm mt-2 text-info-text'>{message}</h1>\n </div>\n );\n};\n\nconst findCandidates = (surfaces: Definition[], { role, data }: Pick<Props, 'role' | 'data'>) => {\n return Object.values(surfaces)\n .filter((definition) =>\n Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,\n )\n .filter(({ filter }) => (filter ? filter(data ?? {}) : true))\n .toSorted(byPosition);\n};\n\n/**\n * @internal\n */\nexport const useSurfaces = () => {\n const surfaces = useCapabilities(Capabilities.ReactSurface);\n return useMemo(() => surfaces.flat(), [surfaces]);\n};\n\n/**\n * @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.\n */\nexport const isSurfaceAvailable = (\n capabilityManager: CapabilityManager.CapabilityManager,\n { role, data }: Pick<Props, 'role' | 'data'>,\n) => {\n const surfaces = capabilityManager.getAll(Capabilities.ReactSurface);\n const candidates = findCandidates(surfaces.flat(), { role, data });\n return candidates.length > 0;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, {\n type ReactElement,\n type Ref,\n cloneElement,\n forwardRef,\n useCallback,\n useLayoutEffect,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { addEventListener, combine } from '@dxos/async';\nimport { useMergeRefs } from '@dxos/react-hooks';\n\nimport { useSurface } from '../../hooks';\n\nexport type SurfaceInfoProps = {\n children: ReactElement<{ ref?: Ref<HTMLElement> }>;\n};\n\n/**\n * Debug wrapper for surfaces.\n */\nexport const SurfaceInfo = forwardRef<HTMLElement, SurfaceInfoProps>(({ children }, forwardedRef) => {\n const [rect, setRect] = useState<DOMRect | null>(null);\n const [expand, setExpand] = useState(false);\n const info = useSurface();\n\n const [root, setRoot] = useState<HTMLElement | null>(null);\n const measureRef = useCallback((node: HTMLElement | null) => setRoot(node), []);\n const mergedRef = useMergeRefs([measureRef, forwardedRef]);\n const childWithRef = cloneElement(children, { ref: mergedRef });\n\n useLayoutEffect(() => {\n if (!root) {\n setRect(null);\n return;\n }\n\n const measure = () => {\n setRect(root.getBoundingClientRect());\n };\n\n const observer = new ResizeObserver(measure);\n observer.observe(root);\n measure();\n\n return combine(\n addEventListener(window, 'scroll', measure, true),\n addEventListener(window, 'resize', measure),\n () => {\n observer.disconnect();\n },\n );\n }, [root]);\n\n const padding = 0;\n return (\n <>\n {childWithRef}\n {rect &&\n createPortal(\n <div\n role='none'\n className='z-[100] fixed flex flex-col-reverse scrollbar-none overflow-auto pointer-events-none'\n style={{\n top: rect.top + padding,\n left: rect.left + padding,\n width: rect.width - padding * 2,\n height: rect.height - padding * 2,\n }}\n >\n {expand ? (\n <div\n className='absolute inset-0 bg-deck-surface border border-green-500 cursor-pointer pointer-events-auto overflow-auto'\n onPointerDown={(ev) => ev.stopPropagation()}\n onClick={(ev) => {\n ev.stopPropagation();\n setExpand(false);\n }}\n >\n <pre className='p-2 text-xs text-description font-mono'>{JSON.stringify({ info }, null, 2)}</pre>\n </div>\n ) : (\n <span\n className='absolute right-1 bottom-0 flex items-center p-1 text-green-500 opacity-80 hover:opacity-100 text-xl cursor-pointer pointer-events-auto'\n title={info.id}\n onPointerDown={(ev) => ev.stopPropagation()}\n onClick={(ev) => {\n ev.stopPropagation();\n setExpand(true);\n }}\n >\n ⓘ\n </span>\n )}\n </div>,\n // TODO(burdon): Create well-known element to gather all debug portals.\n document.body,\n )}\n </>\n );\n});\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { FC, PropsWithChildren, ReactNode, RefCallback } from 'react';\n\nimport type { MakeOptional, Position } from '@dxos/util';\n\n/**\n * Props that are passed to the Surface component.\n */\nexport type Props<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: FC<{ error: Error; data?: any }>;\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n} & MakeOptional<CoreProps<T>, 'id' | 'data'> &\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n * Exclude known prop names to prevent overriding well-defined props.\n */\n {\n [K in keyof Record<string, any>]: K extends keyof CoreProps<T> | 'fallback' | 'placeholder' ? never : any;\n };\n\n/**\n * NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\n */\nexport type CoreProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n * NOTE: This must be a stable value.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n}>;\n\n// TODO(burdon): Remove ref since relying on this would be error prone.\nexport type ComponentProps<T extends Record<string, any> = Record<string, any>> = CoreProps<T> & {\n ref?: RefCallback<HTMLElement>;\n} & Record<string, any>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type ComponentFunction<T extends Record<string, any> = Record<string, any>> = (\n props: ComponentProps<T>,\n) => ReactNode;\n\n/**\n * Definition of when a React component surface should be rendered.\n */\nexport type ReactDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'react';\n id: string;\n role: string | string[];\n position?: Position;\n component: ComponentFunction<T>;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a Web Component surface should be rendered.\n */\nexport type WebComponentDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'web-component';\n id: string;\n role: string | string[];\n position?: Position;\n /**\n * The tag name of the Web Component to render.\n * The Web Component will receive the same props as React surfaces via properties/attributes.\n */\n tagName: string;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a surface (React or Web Component) should be rendered.\n */\nexport type Definition<T extends Record<string, any> = any> = ReactDefinition<T> | WebComponentDefinition<T>;\n\n/**\n * Creates a React surface definition.\n */\nexport const create = <T extends Record<string, any> = any>(\n definition: Omit<ReactDefinition<T>, 'kind'>,\n): ReactDefinition<T> => ({ ...definition, kind: 'react' });\n\n/**\n * Creates a Web Component surface definition.\n */\nexport const createWeb = <T extends Record<string, any> = any>(\n definition: Omit<WebComponentDefinition<T>, 'kind'>,\n): WebComponentDefinition<T> => ({ ...definition, kind: 'web-component' });\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(wittjosiah): Cleanup to avoid re-naming.\nimport { SurfaceContext } from './context';\nimport { SurfaceComponent, isSurfaceAvailable } from './SurfaceComponent';\nimport { type Definition as SurfaceDefinition, create as createSurface, createWeb as createWebSurface } 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 isAvailable = isSurfaceAvailable;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AAIA,OAAOA,YAAuC;;;ACSvC,IAAMC,kBAAkB,CAA2BC,UAAAA;AACxD,QAAMC,kBAAkB,CAACC,QAAgBC,OAAO,oBAAIC,IAAAA,GAAeC,OAAO,oBAAID,IAAAA,MAAa;AACzF,QAAIC,KAAKC,IAAIJ,MAAAA,GAAS;AACpB,YAAM,IAAIK,MAAM,0CAA0CL,MAAAA,EAAQ;IACpE;AACA,QAAIC,KAAKG,IAAIJ,MAAAA,GAAS;AACpB,aAAO,CAAA;IACT;AAEA,UAAMM,OAAOR,MAAMS,KAAK,CAACC,MAAMA,EAAEC,OAAOT,MAAAA;AACxC,QAAI,CAACM,MAAM;AACT,YAAM,IAAID,MAAM,QAAQL,MAAAA,0CAAgD;IAC1E;AAEA,UAAMU,UAAU,oBAAIR,IAAI;SAAIC;MAAMH;KAAO;AACzC,UAAMW,UAAU,oBAAIT,IAAI;SAAID;MAAMD;KAAO;AAEzC,UAAMY,YAAYN,KAAKM,aAAa,CAAA;AACpC,WAAO;SAAIA,UAAUC,QAAQ,CAACC,UAAUf,gBAAgBe,OAAOH,SAASD,OAAAA,CAAAA;MAAWV;;EACrF;AAGA,QAAMe,kBAAkBjB,MACrBkB,IAAI,CAACV,SAASA,KAAKG,EAAE,EACrBI,QAAQ,CAACJ,OAAOV,gBAAgBU,EAAAA,CAAAA,EAChCQ,OAAO,CAACR,IAAIS,OAAOC,SAASA,KAAKC,QAAQX,EAAAA,MAAQS,KAAAA;AAGpD,SAAOH,gBACJC,IAAI,CAACP,OAAOX,MAAMS,KAAK,CAACD,SAASA,KAAKG,OAAOA,EAAAA,CAAAA,EAC7CQ,OAAO,CAACX,SAAoBA,SAASe,MAAAA;AAC1C;;;ACxCA,SAASC,uBAAuB;AAChC,YAAYC,YAAY;AACxB,YAAYC,WAAW;AACvB,YA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AO,CAAClE,eACPmE,MAAMC,QAAQpE,WAAWH,IAAI,IAAIG,WAAWH,KAAKwE,SAASxE,IAAAA,IAAQG,WAAWH,SAASA,IAAAA,EAEvFqE,OAAO,CAAC,EAAEA,OAAM,MAAQA,SAASA,OAAOpE,QAAQ,CAAC,CAAA,IAAK,IAAA,EACtDwE,SAASC,UAAAA;AACd;AAKO,IAAMvB,cAAc,MAAA;AACzB,QAAMD,WAAWyB,gBAAgBC,qBAAaC,YAAY;AAC1D,SAAOjD,SAAQ,MAAMsB,SAAS4B,KAAI,GAAI;IAAC5B;GAAS;AAClD;AAKO,IAAM6B,qBAAqB,CAChCC,mBACA,EAAEhF,MAAMC,KAAI,MAAgC;AAE5C,QAAMiD,WAAW8B,kBAAkBC,OAAOL,qBAAaC,YAAY;AACnE,QAAMvB,aAAaD,eAAeH,SAAS4B,KAAI,GAAI;IAAE9E;IAAMC;EAAK,CAAA;AAChE,SAAOqD,WAAWE,SAAS;AAC7B;;;AE3IO,IAAM0B,SAAS,CACpBC,gBACwB;EAAE,GAAGA;EAAYC,MAAM;AAAQ;AAKlD,IAAMC,YAAY,CACvBF,gBAC+B;EAAE,GAAGA;EAAYC,MAAM;AAAgB;;;UC3GvDE,UAAAA;WAEFC,SAASC;WACTC,YAAYC;WAGZC,UAAUC;WAEVN,UAAUO;WACVC,cAAcC;AAC7B,GAViBT,YAAAA,UAAAA,CAAAA,EAAAA;;",
6
+ "names": ["React", "topologicalSort", "nodes", "getDependencies", "nodeId", "seen", "Set", "path", "has", "Error", "node", "find", "n", "id", "newPath", "newSeen", "dependsOn", "flatMap", "depId", "allDependencies", "map", "filter", "index", "self", "indexOf", "undefined", "RegistryContext", "Effect", "Fiber", "PubSub", "Queue", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "runAndForwardErrors", "invariant", "log", "ErrorBoundary", "ErrorFallback", "useAsyncEffect", "useDefaultValue", "ContextProtocolProvider", "ENABLED_KEY", "useApp", "pluginManager", "pluginLoader", "pluginLoaderProp", "plugins", "pluginsProp", "core", "coreProp", "defaults", "defaultsProp", "setupEvents", "setupEventsProp", "placeholder", "fallback", "ErrorFallback", "cacheEnabled", "safeMode", "debounce", "timeout", "useDefaultValue", "map", "meta", "id", "useMemo", "sync", "plugin", "find", "invariant", "readyRef", "useRef", "ready", "setReady", "useState", "errorRef", "error", "setError", "cached", "JSON", "parse", "localStorage", "getItem", "enabled", "length", "manager", "PluginManager", "make", "useEffect", "registry", "subscribe", "value", "setItem", "stringify", "setupDevtools", "useAsyncEffect", "capabilities", "contribute", "interface", "Capabilities", "implementation", "module", "AtomRegistry", "fiber", "gen", "queue", "activation", "listener", "forkDaemon", "take", "pipe", "tap", "event", "state", "error$", "ActivationEvents", "Startup", "clearTimeout", "timeoutId", "current", "forever", "all", "activate", "SetupReactSurface", "join", "scoped", "runFork", "setTimeout", "log", "warn", "eventsFired", "getEventsFired", "activeModules", "getActive", "pendingReset", "getPendingReset", "runAndForwardErrors", "interrupt", "Error", "remove", "useCallback", "ErrorBoundary", "name", "FallbackComponent", "PluginManagerProvider", "ContextProtocolProvider", "context", "PluginManagerContext", "RegistryContext", "Provider", "App", "globalThis", "composer", "useAtomValue", "useCallback", "invariant", "useCapabilities", "interfaceDef", "manager", "usePluginManager", "useAtomValue", "capabilities", "atom", "useCapability", "invariant", "length", "identifier", "useAtomCapability", "atomCapability", "useAtomCapabilityState", "registry", "Capabilities", "AtomRegistry", "value", "update", "useCallback", "fn", "set", "get", "useOperationInvoker", "OperationInvoker", "useEffect", "useState", "LoadingState", "useLoading", "ready", "debounce", "stage", "setStage", "useState", "useEffect", "i", "setInterval", "clearInterval", "useEffect", "useMemo", "useOperationResolver", "module", "resolver", "manager", "usePluginManager", "resolverArray", "useMemo", "useEffect", "capabilities", "contribute", "interface", "Capabilities", "OperationResolver", "implementation", "remove", "RegistryContext", "useAtomValue", "useCallback", "useContext", "useSettingsState", "atom", "registry", "useContext", "RegistryContext", "settings", "useAtomValue", "updateSettings", "useCallback", "fn", "set", "get", "useContext", "raise", "useSurface", "useContext", "Surface", "Context", "raise", "Error", "App", "placeholder", "Placeholder", "ready", "error", "debounce", "reactContexts", "useCapabilities", "Capabilities", "ReactContext", "reactRoots", "ReactRoot", "stage", "useLoading", "LoadingState", "Done", "React", "ComposedContext", "composeContexts", "map", "id", "root", "Component", "key", "contexts", "length", "children", "topologicalSort", "context", "reduce", "Acc", "Next", "createContext", "useContext", "raise", "PluginManagerContext", "createContext", "undefined", "usePluginManager", "useContext", "raise", "Error", "PluginManagerProvider", "Provider", "createContext", "SurfaceContext", "createContext", "undefined", "React", "Fragment", "Suspense", "forwardRef", "memo", "useEffect", "useMemo", "useRef", "log", "ErrorBoundary", "useDefaultValue", "byPosition", "React", "cloneElement", "forwardRef", "useCallback", "useLayoutEffect", "useState", "createPortal", "addEventListener", "combine", "useMergeRefs", "SurfaceInfo", "forwardRef", "children", "forwardedRef", "rect", "setRect", "useState", "expand", "setExpand", "info", "useSurface", "root", "setRoot", "measureRef", "useCallback", "node", "mergedRef", "useMergeRefs", "childWithRef", "cloneElement", "ref", "useLayoutEffect", "measure", "getBoundingClientRect", "observer", "ResizeObserver", "observe", "combine", "addEventListener", "window", "disconnect", "padding", "React", "createPortal", "div", "role", "className", "style", "top", "left", "width", "height", "onPointerDown", "ev", "stopPropagation", "onClick", "pre", "JSON", "stringify", "span", "title", "id", "document", "body", "DEFAULT_PLACEHOLDER", "React", "Fragment", "DEBUG", "env", "VITE_DEBUG", "WebComponentWrapper", "memo", "forwardRef", "id", "role", "data", "limit", "definition", "rest", "forwardedRef", "containerRef", "useRef", "elementRef", "propsRef", "current", "useEffect", "element", "document", "createElement", "tagName", "Object", "assign", "appendChild", "contains", "removeChild", "div", "ref", "displayName", "SurfaceContextProvider", "fallback", "ErrorFallback", "contextValue", "useMemo", "kind", "ErrorBoundary", "name", "resetKeys", "FallbackComponent", "SurfaceContext", "Provider", "value", "Component", "component", "debug", "window", "className", "data-id", "data-role", "SurfaceInfo", "SurfaceComponent", "_id", "dataProp", "placeholder", "useDefaultValue", "surfaces", "useSurfaces", "definitions", "findCandidates", "candidates", "slice", "length", "log", "warn", "Suspense", "map", "key", "error", "message", "Error", "String", "data-testid", "h1", "values", "filter", "Array", "isArray", "includes", "toSorted", "byPosition", "useCapabilities", "Capabilities", "ReactSurface", "flat", "isSurfaceAvailable", "capabilityManager", "getAll", "create", "definition", "kind", "createWeb", "Surface", "create", "createSurface", "createWeb", "createWebSurface", "Context", "SurfaceContext", "SurfaceComponent", "isAvailable", "isSurfaceAvailable"]
7
+ }
@@ -0,0 +1,8 @@
1
+ // src/context.ts
2
+ import { createContext } from "@dxos/web-context";
3
+ var PluginManagerContext = createContext("org.dxos.app-framework.plugin-manager");
4
+
5
+ export {
6
+ PluginManagerContext
7
+ };
8
+ //# sourceMappingURL=chunk-TGX63LTL.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/context.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('dxos.org/app-framework/plugin-manager');\n"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('org.dxos.app-framework.plugin-manager');\n"],
5
5
  "mappings": ";AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBC,cAA2C,uCAAA;",
6
6
  "names": ["createContext", "PluginManagerContext", "createContext"]
7
7
  }
@@ -0,0 +1,44 @@
1
+ import {
2
+ capability_exports
3
+ } from "./chunk-YNFPIQGB.mjs";
4
+
5
+ // src/common/translations.ts
6
+ import * as Schema from "effect/Schema";
7
+ var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.String, Schema.mutable(Schema.Struct({
8
+ ns: Schema.String,
9
+ count: Schema.optional(Schema.Number),
10
+ defaultValue: Schema.optional(Schema.String)
11
+ })))));
12
+
13
+ // src/common/operations.ts
14
+ import * as Schema2 from "effect/Schema";
15
+ import { Operation } from "@dxos/operation";
16
+ var UNDO_NAMESPACE = "org.dxos.app-framework.undo";
17
+ (function(UndoOperation2) {
18
+ UndoOperation2.ShowUndo = Operation.make({
19
+ meta: {
20
+ key: `${UNDO_NAMESPACE}.operation.show-undo`,
21
+ name: "Show Undo",
22
+ description: "Show an undo toast notification."
23
+ },
24
+ executionMode: "sync",
25
+ services: [
26
+ capability_exports.Service
27
+ ],
28
+ schema: {
29
+ input: Schema2.Struct({
30
+ message: Schema2.optional(Label.annotations({
31
+ description: "The message to display in the undo toast."
32
+ }))
33
+ }),
34
+ output: Schema2.Void
35
+ }
36
+ });
37
+ })(UndoOperation || (UndoOperation = {}));
38
+ var UndoOperation;
39
+
40
+ export {
41
+ Label,
42
+ UndoOperation
43
+ };
44
+ //# sourceMappingURL=chunk-TIEBZMTF.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/common/translations.ts", "../../../src/common/operations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * A Label represents translatable text - either a simple string or a tuple of [key, options].\n */\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Capability } from '../core';\n\nimport { Label } from './translations';\n\nconst UNDO_NAMESPACE = 'org.dxos.app-framework.undo';\n\n/**\n * Operations related to undo/history functionality.\n */\nexport namespace UndoOperation {\n /**\n * Show an undo toast notification.\n * Fired by HistoryTracker when an undoable operation is tracked.\n */\n export const ShowUndo = Operation.make({\n meta: {\n key: `${UNDO_NAMESPACE}.operation.show-undo`,\n name: 'Show Undo',\n description: 'Show an undo toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n message: Schema.optional(Label.annotations({ description: 'The message to display in the undo toast.' })),\n }),\n output: Schema.Void,\n },\n });\n}\n"],
5
+ "mappings": ";;;;;AAIA,YAAYA,YAAY;AAKjB,IAAMC,QAAeC,aACnBC,eACAC,eACEC,aACEF,eACAC,eACEE,cAAO;EACZC,IAAWJ;EACXK,OAAcC,gBAAgBC,aAAM;EACpCC,cAAqBF,gBAAgBN,aAAM;AAC7C,CAAA,CAAA,CAAA,CAAA,CAAA;;;ACfR,YAAYS,aAAY;AAExB,SAASC,iBAAiB;AAM1B,IAAMC,iBAAiB;UAKNC,gBAAAA;iBAKFC,WAAWC,UAAUC,KAAK;IACrCC,MAAM;MACJC,KAAK,GAAGN,cAAAA;MACRO,MAAM;MACNC,aAAa;IACf;IACAC,eAAe;IACfC,UAAU;MAACC,mBAAWC;;IACtBC,QAAQ;MACNC,OAAcC,eAAO;QACnBC,SAAgBC,iBAASC,MAAMC,YAAY;UAAEX,aAAa;QAA4C,CAAA,CAAA;MACxG,CAAA;MACAY,QAAeC;IACjB;EACF,CAAA;AACF,GApBiBpB,kBAAAA,gBAAAA,CAAAA,EAAAA;;",
6
+ "names": ["Schema", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "defaultValue", "Schema", "Operation", "UNDO_NAMESPACE", "UndoOperation", "ShowUndo", "Operation", "make", "meta", "key", "name", "description", "executionMode", "services", "Capability", "Service", "schema", "input", "Struct", "message", "optional", "Label", "annotations", "output", "Void"]
7
+ }
@@ -0,0 +1,80 @@
1
+ import {
2
+ capability_exports
3
+ } from "./chunk-YNFPIQGB.mjs";
4
+ import {
5
+ __export
6
+ } from "./chunk-J5LGTIGS.mjs";
7
+
8
+ // src/common/capabilities.ts
9
+ var capabilities_exports = {};
10
+ __export(capabilities_exports, {
11
+ AtomRegistry: () => AtomRegistry,
12
+ Command: () => Command,
13
+ HistoryTracker: () => HistoryTracker,
14
+ Layer: () => Layer,
15
+ ManagedRuntime: () => ManagedRuntime,
16
+ Null: () => Null,
17
+ OperationInvoker: () => OperationInvoker,
18
+ OperationResolver: () => OperationResolver,
19
+ PluginManager: () => PluginManager,
20
+ ReactContext: () => ReactContext,
21
+ ReactRoot: () => ReactRoot,
22
+ ReactSurface: () => ReactSurface,
23
+ UndoMapping: () => UndoMapping,
24
+ UndoRegistry: () => UndoRegistry,
25
+ getAtomValue: () => getAtomValue,
26
+ subscribeAtom: () => subscribeAtom,
27
+ updateAtomValue: () => updateAtomValue
28
+ });
29
+ import * as Effect from "effect/Effect";
30
+ var Null = capability_exports.make("org.dxos.app-framework.capability.null");
31
+ var PluginManager = capability_exports.make("org.dxos.app-framework.capability.plugin-manager");
32
+ var AtomRegistry = capability_exports.make("org.dxos.app-framework.capability.atom-registry");
33
+ var ReactContext = capability_exports.make("org.dxos.app-framework.capability.react-context");
34
+ var ReactRoot = capability_exports.make("org.dxos.app-framework.capability.react-root");
35
+ var ReactSurface = capability_exports.make("org.dxos.app-framework.common.react-surface");
36
+ var Command = capability_exports.make("org.dxos.app-framework.capability.command");
37
+ var Layer = capability_exports.make("org.dxos.app-framework.capability.layer");
38
+ var ManagedRuntime = capability_exports.make("org.dxos.app-framework.capability.managed-runtime");
39
+ var OperationResolver = capability_exports.make("org.dxos.app-framework.capability.operation-resolver");
40
+ var UndoMapping = capability_exports.make("org.dxos.app-framework.capability.undo-mapping");
41
+ var OperationInvoker = capability_exports.make("org.dxos.app-framework.capability.operation-invoker");
42
+ var UndoRegistry = capability_exports.make("org.dxos.app-framework.capability.undo-registry");
43
+ var HistoryTracker = capability_exports.make("org.dxos.app-framework.capability.history-tracker");
44
+ var getAtomValue = (atomCapability) => Effect.gen(function* () {
45
+ const registry = yield* capability_exports.get(AtomRegistry);
46
+ const atom = yield* capability_exports.get(atomCapability);
47
+ return registry.get(atom);
48
+ });
49
+ var updateAtomValue = (atomCapability, fn) => Effect.gen(function* () {
50
+ const registry = yield* capability_exports.get(AtomRegistry);
51
+ const atom = yield* capability_exports.get(atomCapability);
52
+ registry.set(atom, fn(registry.get(atom)));
53
+ });
54
+ var subscribeAtom = (atomCapability, callback) => Effect.gen(function* () {
55
+ const registry = yield* capability_exports.get(AtomRegistry);
56
+ const atom = yield* capability_exports.get(atomCapability);
57
+ return registry.subscribe(atom, () => callback(registry.get(atom)));
58
+ });
59
+
60
+ export {
61
+ Null,
62
+ PluginManager,
63
+ AtomRegistry,
64
+ ReactContext,
65
+ ReactRoot,
66
+ ReactSurface,
67
+ Command,
68
+ Layer,
69
+ ManagedRuntime,
70
+ OperationResolver,
71
+ UndoMapping,
72
+ OperationInvoker,
73
+ UndoRegistry,
74
+ HistoryTracker,
75
+ getAtomValue,
76
+ updateAtomValue,
77
+ subscribeAtom,
78
+ capabilities_exports
79
+ };
80
+ //# sourceMappingURL=chunk-WEBSGU5L.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/common/capabilities.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Command$ from '@effect/cli/Command';\nimport { type Atom, type Registry } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport type * as Layer$ from 'effect/Layer';\nimport type * as ManagedRuntime$ from 'effect/ManagedRuntime';\nimport type { FC, PropsWithChildren } from 'react';\n\nimport type { OperationInvoker as OperationInvoker$, OperationResolver as OperationResolver$ } from '@dxos/operation';\n\nimport { Capability as Capability$, type PluginManager as PluginManager$ } from '../core';\nimport type {\n HistoryTracker as HistoryTracker$,\n UndoMapping as UndoMapping$,\n UndoRegistry as UndoRegistry$,\n} from '../plugin-operation';\nimport type { Surface } from '../ui';\n\n/**\n * Null capability.\n * @category Capability\n */\nexport const Null = Capability$.make<null>('org.dxos.app-framework.capability.null');\n\n/**\n * @category Capability\n */\nexport const PluginManager = Capability$.make<PluginManager$.PluginManager>(\n 'org.dxos.app-framework.capability.plugin-manager',\n);\n\n/**\n * @category Capability\n */\nexport const AtomRegistry = Capability$.make<Registry.Registry>('org.dxos.app-framework.capability.atom-registry');\n\nexport type ReactContext = Readonly<{\n id: string;\n dependsOn?: string[];\n context: FC<PropsWithChildren>;\n}>;\n\n/**\n * @category Capability\n */\nexport const ReactContext = Capability$.make<ReactContext>('org.dxos.app-framework.capability.react-context');\n\nexport type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n\n/**\n * @category Capability\n */\nexport const ReactRoot = Capability$.make<ReactRoot>('org.dxos.app-framework.capability.react-root');\n\n/**\n * Surface definitions that can be either React components or Web Components.\n */\nexport type ReactSurface = Surface.Definition | readonly Surface.Definition[];\n\n/**\n * @category Capability\n */\nexport const ReactSurface = Capability$.make<ReactSurface>('org.dxos.app-framework.common.react-surface');\n\nexport type AnyCommand = Command$.Command<any, any, any, any>;\n\n/**\n * @category Capability\n */\nexport const Command = Capability$.make<AnyCommand>('org.dxos.app-framework.capability.command');\n\n/**\n * @category Capability\n */\nexport const Layer = Capability$.make<Layer$.Layer<any, any, any>>('org.dxos.app-framework.capability.layer');\n\nexport type ManagedRuntime = ManagedRuntime$.ManagedRuntime<any, any>;\n\n/**\n * @category Capability\n */\nexport const ManagedRuntime = Capability$.make<ManagedRuntime>('org.dxos.app-framework.capability.managed-runtime');\n\n//\n// Operation System Capabilities\n//\n\nexport type OperationResolver = OperationResolver$.OperationResolver<any, any, any, any>;\n\n/**\n * Handler registration for operations - contributed by plugins.\n * @category Capability\n */\nexport const OperationResolver = Capability$.make<OperationResolver[]>(\n 'org.dxos.app-framework.capability.operation-resolver',\n);\n\nexport type UndoMapping = UndoMapping$.UndoMapping;\n\n/**\n * Undo mapping registration - contributed by plugins.\n * @category Capability\n */\nexport const UndoMapping = Capability$.make<UndoMapping[]>('org.dxos.app-framework.capability.undo-mapping');\n\nexport type OperationInvoker = OperationInvoker$.OperationInvoker;\n\n/**\n * Operation invoker - provided by OperationPlugin.\n * @category Capability\n */\nexport const OperationInvoker = Capability$.make<OperationInvoker>(\n 'org.dxos.app-framework.capability.operation-invoker',\n);\n\nexport type UndoRegistry = UndoRegistry$.UndoRegistry;\n\n/**\n * Undo registry - provided by OperationPlugin.\n * @category Capability\n */\nexport const UndoRegistry = Capability$.make<UndoRegistry>('org.dxos.app-framework.capability.undo-registry');\n\nexport type HistoryTracker = HistoryTracker$.HistoryTracker;\n\n/**\n * History tracker - provided by OperationPlugin.\n * @category Capability\n */\nexport const HistoryTracker = Capability$.make<HistoryTracker>('org.dxos.app-framework.capability.history-tracker');\n\n//\n// Atom Capability Helpers\n//\n\n/**\n * Get the current value of an atom capability.\n * @example const settings = yield* Capabilities.getAtomValue(ThreadCapabilities.Settings);\n */\nexport const getAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n): Effect.Effect<T, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.get(atom);\n });\n\n/**\n * Update an atom capability value (requires writable atom).\n * @example yield* Capabilities.updateAtomValue(ThreadCapabilities.Settings, (s) => ({ ...s, foo: true }));\n */\nexport const updateAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Writable<T>>,\n fn: (current: T) => T,\n): Effect.Effect<void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n registry.set(atom, fn(registry.get(atom)));\n });\n\n/**\n * Subscribe to an atom capability.\n * @example const unsubscribe = yield* Capabilities.subscribeAtom(ThreadCapabilities.Settings, (value) => ...);\n */\nexport const subscribeAtom = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n callback: (value: T) => void,\n): Effect.Effect<() => void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.subscribe(atom, () => callback(registry.get(atom)));\n });\n"],
5
+ "mappings": ";;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAMA,YAAYA,YAAY;AAmBjB,IAAMC,OAAOC,mBAAYC,KAAW,wCAAA;AAKpC,IAAMC,gBAAgBF,mBAAYC,KACvC,kDAAA;AAMK,IAAME,eAAeH,mBAAYC,KAAwB,iDAAA;AAWzD,IAAMG,eAAeJ,mBAAYC,KAAmB,iDAAA;AAOpD,IAAMI,YAAYL,mBAAYC,KAAgB,8CAAA;AAU9C,IAAMK,eAAeN,mBAAYC,KAAmB,6CAAA;AAOpD,IAAMM,UAAUP,mBAAYC,KAAiB,2CAAA;AAK7C,IAAMO,QAAQR,mBAAYC,KAAkC,yCAAA;AAO5D,IAAMQ,iBAAiBT,mBAAYC,KAAqB,mDAAA;AAYxD,IAAMS,oBAAoBV,mBAAYC,KAC3C,sDAAA;AASK,IAAMU,cAAcX,mBAAYC,KAAoB,gDAAA;AAQpD,IAAMW,mBAAmBZ,mBAAYC,KAC1C,qDAAA;AASK,IAAMY,eAAeb,mBAAYC,KAAmB,iDAAA;AAQpD,IAAMa,iBAAiBd,mBAAYC,KAAqB,mDAAA;AAUxD,IAAMc,eAAe,CAC1BC,mBAEOC,WAAI,aAAA;AACT,QAAMC,WAAW,OAAOlB,mBAAYmB,IAAIhB,YAAAA;AACxC,QAAMiB,OAAO,OAAOpB,mBAAYmB,IAAIH,cAAAA;AACpC,SAAOE,SAASC,IAAIC,IAAAA;AACtB,CAAA;AAMK,IAAMC,kBAAkB,CAC7BL,gBACAM,OAEOL,WAAI,aAAA;AACT,QAAMC,WAAW,OAAOlB,mBAAYmB,IAAIhB,YAAAA;AACxC,QAAMiB,OAAO,OAAOpB,mBAAYmB,IAAIH,cAAAA;AACpCE,WAASK,IAAIH,MAAME,GAAGJ,SAASC,IAAIC,IAAAA,CAAAA,CAAAA;AACrC,CAAA;AAMK,IAAMI,gBAAgB,CAC3BR,gBACAS,aAEOR,WAAI,aAAA;AACT,QAAMC,WAAW,OAAOlB,mBAAYmB,IAAIhB,YAAAA;AACxC,QAAMiB,OAAO,OAAOpB,mBAAYmB,IAAIH,cAAAA;AACpC,SAAOE,SAASQ,UAAUN,MAAM,MAAMK,SAASP,SAASC,IAAIC,IAAAA,CAAAA,CAAAA;AAC9D,CAAA;",
6
+ "names": ["Effect", "Null", "Capability$", "make", "PluginManager", "AtomRegistry", "ReactContext", "ReactRoot", "ReactSurface", "Command", "Layer", "ManagedRuntime", "OperationResolver", "UndoMapping", "OperationInvoker", "UndoRegistry", "HistoryTracker", "getAtomValue", "atomCapability", "gen", "registry", "get", "atom", "updateAtomValue", "fn", "set", "subscribeAtom", "callback", "subscribe"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-YAFEA4GV.mjs.map
@@ -28,8 +28,7 @@ var get = (interfaceDef) => Effect.flatMap(Service, (manager) => Effect.try({
28
28
  var getAll = (interfaceDef) => Effect.map(Service, (manager) => manager.getAll(interfaceDef));
29
29
  var waitFor = (interfaceDef) => Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));
30
30
  var atom = (interfaceDef) => Effect.map(Service, (manager) => manager.atom(interfaceDef));
31
- var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
32
- var ModuleTag = Symbol.for("@dxos/app-framework/ModuleTag");
31
+ var ModuleTag = /* @__PURE__ */ Symbol.for("@dxos/app-framework/ModuleTag");
33
32
  var make = (identifier) => {
34
33
  return {
35
34
  identifier
@@ -74,4 +73,4 @@ export {
74
73
  makeModule,
75
74
  capability_exports
76
75
  };
77
- //# sourceMappingURL=chunk-6Y7PZV72.mjs.map
76
+ //# sourceMappingURL=chunk-YNFPIQGB.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/core/capability.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\n\nimport type * as CapabilityManager from './capability-manager';\nimport type * as Plugin from './plugin';\n\n//\n// Capability Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing CapabilityManager via the Effect layer system.\n * This allows capability modules to access the capability manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/CapabilityManager')<\n Service,\n CapabilityManager.CapabilityManager\n>() {}\n\n/**\n * Get a single capability from the capability manager.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation.\n * @throws If no capability is found.\n */\n// TODO(wittjosiah): Add custom tagged errors (Data.TaggedError) for app-framework to enable\n// type-safe error handling with Effect. Consider CapabilityNotFoundError, ModuleActivationError, etc.\nexport const get = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) =>\n Effect.try({\n try: () => manager.get(interfaceDef),\n catch: (error) => (error instanceof Error ? error : new Error(String(error))),\n }),\n );\n\n/**\n * Get all capabilities from the capability manager for a given interface.\n * @param interfaceDef The interface definition of the capability.\n * @returns An array of capability implementations.\n */\nexport const getAll = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T[], never, Service> =>\n Effect.map(Service, (manager) => manager.getAll(interfaceDef));\n\n/**\n * Wait for a capability to be available.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation once available.\n */\nexport const waitFor = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));\n\n/**\n * Get the Atom reference to capabilities for reactive access.\n * @param interfaceDef The interface definition of the capability.\n * @returns An Atom containing the array of capability implementations.\n */\nexport const atom = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<Atom.Atom<T[]>, never, Service> =>\n Effect.map(Service, (manager) => manager.atom(interfaceDef));\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * Symbol used to tag lazy capability functions with their module ID.\n */\nexport const ModuleTag: unique symbol = Symbol.for('@dxos/app-framework/ModuleTag');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\nexport namespace InterfaceDef {\n export type Implementation<I extends InterfaceDef<any>> = I extends InterfaceDef<infer T> ? T : never;\n}\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const make = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * A unique string identifier with a Typescript type associated with it.\n * When a capability is contributed to the application an implementation of the interface is provided.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n readonly interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n readonly implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n readonly deactivate?: () => Effect.Effect<void, Error>;\n};\n\nexport type Any = Capability<any>;\n\n/**\n * Union type representing all valid return types for a capability module.\n * Supports single capabilities, arrays, and tuples of different capability types.\n */\nexport type ModuleReturn = void | Any | Any[] | readonly Any[] | [Any, ...Any[]] | readonly [Any, ...Any[]];\n\n/**\n * Helper to define the implementation of a capability.\n */\nexport const contributes = <I extends InterfaceDef<any>>(\n interfaceDef: I,\n implementation: Capability<InterfaceDef.Implementation<I>>['implementation'],\n deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],\n): Capability<I> => {\n return {\n interface: interfaceDef,\n implementation,\n deactivate,\n } satisfies Capability<I>;\n};\n\ntype LoadCapability<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props?: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\ntype LoadCapabilities<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props?: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\n\ntype NormalizeReturn<R> = R extends readonly (infer A)[]\n ? A[]\n : R extends (infer A)[]\n ? A[]\n : R extends Any\n ? [R]\n : Any[];\n\nexport type LazyCapability<Props = void, Capabilities extends ModuleReturn = ModuleReturn, E extends Error = Error> = (\n props?: Props,\n) => Effect.Effect<NormalizeReturn<Capabilities>, E, Service | Plugin.Service | never>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n * Supports single capabilities, arrays, and tuples of different capability types.\n * @param name The export name (e.g., 'AppGraphBuilder') - used to auto-compute module IDs.\n * @param loader The lazy loader function.\n * @returns A lazy capability function with ModuleTag symbol attached.\n */\nexport const lazy = <T = void, R extends ModuleReturn = ModuleReturn>(\n name: string,\n c: LoadCapability<T, R> | LoadCapabilities<T, R>,\n): LazyCapability<T, R> => {\n const lazyFn: LazyCapability<T, R> = (props?: T) =>\n Effect.gen(function* () {\n const { default: getCapability } = yield* Effect.tryPromise(() => c());\n const result = yield* getCapability(props);\n const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [result];\n return normalized as NormalizeReturn<R>;\n });\n\n return Object.assign(lazyFn, { [ModuleTag]: name });\n};\n\n/**\n * Gets the module tag (export name) from a lazy capability function.\n * @param capability The lazy capability function.\n * @returns The module tag if present, undefined otherwise.\n */\n// TODO(wittjosiah): Stricter type for capability.\nexport const getModuleTag = (capability: unknown): string | undefined => {\n return capability && typeof capability === 'function' && ModuleTag in capability\n ? String(capability[ModuleTag])\n : undefined;\n};\n\n/**\n * Helper to define a capability module with explicit typing.\n * Wraps the default export function to provide better type inference and make the pattern explicit.\n *\n * This helper provides explicit typing for the module activation function,\n * making it clear that the function should:\n * - Access CapabilityManager via the Effect layer system (Capability.get, Capability.getAll, etc.)\n * - Return a capability, array of capabilities, or tuple of different capability types (sync or async)\n *\n * Supports returning multiple capabilities of different types as a tuple, which will be normalized\n * to an array at runtime for compatibility with the plugin system.\n *\n * @example\n * ```ts\n * // Module without options - single capability\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * const client = yield* Capability.get(ClientCapabilities.Client);\n * return contributes(Capabilities.SettingsStore, store);\n * })\n * );\n *\n * // Module with multiple capabilities\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * return [\n * contributes(Capabilities.SettingsStore, store),\n * contributes(Capabilities.Translations, translations),\n * ];\n * })\n * );\n *\n * // Module with additional options (context accessed via layer)\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* ({ observability }: { observability?: boolean }) {\n * const invoker = yield* Capability.get(Common.Capability.OperationInvoker);\n * return contributes(Capabilities.IntentResolver, ...);\n * })\n * );\n * ```\n */\nexport const makeModule = <\n TProps = void,\n TReturn extends ModuleReturn = ModuleReturn,\n E extends Error = Error,\n R extends Service | Plugin.Service | never = Service,\n>(\n fn: (props?: TProps) => Effect.Effect<TReturn, E, R>,\n): ((props?: TProps) => Effect.Effect<TReturn, E, R>) => fn;\n"],
5
- "mappings": ";;;;;AAAA;;;;;;;;;;;;;;AAKA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AAajB,IAAMC,UAAN,cAA8BC,YAAI,uCAAA,EAAA,EAAA;AAGpC;AAUE,IAAMC,MAAM,CAAIC,iBACdC,eAAQJ,SAAS,CAACK,YAChBC,WAAI;EACTA,KAAK,MAAMD,QAAQH,IAAIC,YAAAA;EACvBI,OAAO,CAACC,UAAWA,iBAAiBC,QAAQD,QAAQ,IAAIC,MAAMC,OAAOF,KAAAA,CAAAA;AACvE,CAAA,CAAA;AAQG,IAAMG,SAAS,CAAIR,iBACjBS,WAAIZ,SAAS,CAACK,YAAYA,QAAQM,OAAOR,YAAAA,CAAAA;AAO3C,IAAMU,UAAU,CAAIV,iBAClBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQQ,QAAQV,YAAAA,CAAAA;AAOhD,IAAMW,OAAO,CAAIX,iBACfS,WAAIZ,SAAS,CAACK,YAAYA,QAAQS,KAAKX,YAAAA,CAAAA;AAEhD,IAAMY,qBAAoCC,OAAOC,IAAI,oBAAA;AAK9C,IAAMC,YAA2BF,OAAOC,IAAI,+BAAA;AAiB5C,IAAME,OAAO,CAAIC,eAAAA;AACtB,SAAO;IAAEA;EAAW;AACtB;AAkCO,IAAMC,cAAc,CACzBlB,cACAmB,gBACAC,eAAAA;AAEA,SAAO;IACLC,WAAWrB;IACXmB;IACAC;EACF;AACF;AA4BO,IAAME,OAAO,CAClBC,MACAC,MAAAA;AAEA,QAAMC,SAA+B,CAACC,UAC7BC,WAAI,aAAA;AACT,UAAM,EAAEC,SAASC,cAAa,IAAK,OAAcC,kBAAW,MAAMN,EAAAA,CAAAA;AAClE,UAAMO,SAAS,OAAOF,cAAcH,KAAAA;AACpC,UAAMM,aAAaD,UAAU,OAAO,CAAA,IAAKE,MAAMC,QAAQH,MAAAA,IAAUE,MAAME,KAAKJ,MAAAA,IAAU;MAACA;;AACvF,WAAOC;EACT,CAAA;AAEF,SAAOI,OAAOC,OAAOZ,QAAQ;IAAE,CAACV,SAAAA,GAAYQ;EAAK,CAAA;AACnD;AAQO,IAAMe,eAAe,CAACC,eAAAA;AAC3B,SAAOA,cAAc,OAAOA,eAAe,cAAcxB,aAAawB,aAClEhC,OAAOgC,WAAWxB,SAAAA,CAAU,IAC5ByB;AACN;AA2CO,IAAMC,aAAa,CAMxBC,OACuDA;",
6
- "names": ["Context", "Effect", "Service", "Tag", "get", "interfaceDef", "flatMap", "manager", "try", "catch", "error", "Error", "String", "getAll", "map", "waitFor", "atom", "InterfaceDefTypeId", "Symbol", "for", "ModuleTag", "make", "identifier", "contributes", "implementation", "deactivate", "interface", "lazy", "name", "c", "lazyFn", "props", "gen", "default", "getCapability", "tryPromise", "result", "normalized", "Array", "isArray", "from", "Object", "assign", "getModuleTag", "capability", "undefined", "makeModule", "fn"]
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\n\nimport type * as CapabilityManager from './capability-manager';\nimport type * as Plugin from './plugin';\n\n//\n// Capability Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing CapabilityManager via the Effect layer system.\n * This allows capability modules to access the capability manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/CapabilityManager')<\n Service,\n CapabilityManager.CapabilityManager\n>() {}\n\n/**\n * Get a single capability from the capability manager.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation.\n * @throws If no capability is found.\n */\n// TODO(wittjosiah): Add custom tagged errors (Data.TaggedError) for app-framework to enable\n// type-safe error handling with Effect. Consider CapabilityNotFoundError, ModuleActivationError, etc.\nexport const get = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) =>\n Effect.try({\n try: () => manager.get(interfaceDef),\n catch: (error) => (error instanceof Error ? error : new Error(String(error))),\n }),\n );\n\n/**\n * Get all capabilities from the capability manager for a given interface.\n * @param interfaceDef The interface definition of the capability.\n * @returns An array of capability implementations.\n */\nexport const getAll = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T[], never, Service> =>\n Effect.map(Service, (manager) => manager.getAll(interfaceDef));\n\n/**\n * Wait for a capability to be available.\n * @param interfaceDef The interface definition of the capability.\n * @returns The capability implementation once available.\n */\nexport const waitFor = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<T, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.waitFor(interfaceDef));\n\n/**\n * Get the Atom reference to capabilities for reactive access.\n * @param interfaceDef The interface definition of the capability.\n * @returns An Atom containing the array of capability implementations.\n */\nexport const atom = <T>(interfaceDef: InterfaceDef<T>): Effect.Effect<Atom.Atom<T[]>, never, Service> =>\n Effect.map(Service, (manager) => manager.atom(interfaceDef));\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * Symbol used to tag lazy capability functions with their module ID.\n */\nexport const ModuleTag: unique symbol = Symbol.for('@dxos/app-framework/ModuleTag');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\nexport namespace InterfaceDef {\n export type Implementation<I extends InterfaceDef<any>> = I extends InterfaceDef<infer T> ? T : never;\n}\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const make = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * A unique string identifier with a Typescript type associated with it.\n * When a capability is contributed to the application an implementation of the interface is provided.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n readonly interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n readonly implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n readonly deactivate?: () => Effect.Effect<void, Error>;\n};\n\nexport type Any = Capability<any>;\n\n/**\n * Union type representing all valid return types for a capability module.\n * Supports single capabilities, arrays, and tuples of different capability types.\n */\nexport type ModuleReturn = void | Any | Any[] | readonly Any[] | [Any, ...Any[]] | readonly [Any, ...Any[]];\n\n/**\n * Helper to define the implementation of a capability.\n */\nexport const contributes = <I extends InterfaceDef<any>>(\n interfaceDef: I,\n implementation: Capability<InterfaceDef.Implementation<I>>['implementation'],\n deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],\n): Capability<I> => {\n return {\n interface: interfaceDef,\n implementation,\n deactivate,\n } satisfies Capability<I>;\n};\n\ntype LoadCapability<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\ntype LoadCapabilities<Props, Capabilities extends ModuleReturn = ModuleReturn> = () => Promise<{\n default: (props: Props) => Effect.Effect<Capabilities, Error, Service | Plugin.Service | never>;\n}>;\n\ntype NormalizeReturn<R> = R extends readonly (infer A)[]\n ? A[]\n : R extends (infer A)[]\n ? A[]\n : R extends Any\n ? [R]\n : Any[];\n\nexport type LazyCapability<Props = void, Capabilities extends ModuleReturn = ModuleReturn, E extends Error = Error> = (\n props: Props,\n) => Effect.Effect<NormalizeReturn<Capabilities>, E, Service | Plugin.Service | never>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n * Supports single capabilities, arrays, and tuples of different capability types.\n * @param name The export name (e.g., 'AppGraphBuilder') - used to auto-compute module IDs.\n * @param loader The lazy loader function.\n * @returns A lazy capability function with ModuleTag symbol attached.\n */\nexport const lazy = <T = void, R extends ModuleReturn = ModuleReturn>(\n name: string,\n c: LoadCapability<T, R> | LoadCapabilities<T, R>,\n): LazyCapability<T, R> => {\n const lazyFn: LazyCapability<T, R> = (props: T) =>\n Effect.gen(function* () {\n const { default: getCapability } = yield* Effect.tryPromise(() => c());\n const result = yield* getCapability(props);\n const normalized = result == null ? [] : Array.isArray(result) ? Array.from(result) : [result];\n return normalized as NormalizeReturn<R>;\n });\n\n return Object.assign(lazyFn, { [ModuleTag]: name });\n};\n\n/**\n * Gets the module tag (export name) from a lazy capability function.\n * @param capability The lazy capability function.\n * @returns The module tag if present, undefined otherwise.\n */\n// TODO(wittjosiah): Stricter type for capability.\nexport const getModuleTag = (capability: unknown): string | undefined => {\n return capability && typeof capability === 'function' && ModuleTag in capability\n ? String(capability[ModuleTag])\n : undefined;\n};\n\n/**\n * Helper to define a capability module with explicit typing.\n * Wraps the default export function to provide better type inference and make the pattern explicit.\n *\n * This helper provides explicit typing for the module activation function,\n * making it clear that the function should:\n * - Access CapabilityManager via the Effect layer system (Capability.get, Capability.getAll, etc.)\n * - Return a capability, array of capabilities, or tuple of different capability types (sync or async)\n *\n * Supports returning multiple capabilities of different types as a tuple, which will be normalized\n * to an array at runtime for compatibility with the plugin system.\n *\n * @example\n * ```ts\n * // Module without options - single capability\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * const client = yield* Capability.get(ClientCapabilities.Client);\n * return contributes(Capabilities.SettingsStore, store);\n * })\n * );\n *\n * // Module with multiple capabilities\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* () {\n * return [\n * contributes(Capabilities.SettingsStore, store),\n * contributes(Capabilities.Translations, translations),\n * ];\n * })\n * );\n *\n * // Module with required options (context accessed via layer)\n * export default Capability.makeModule(\n * Effect.fnUntraced(function* (props: { observability: boolean }) {\n * const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n * return contributes(Capabilities.IntentResolver, ...);\n * })\n * );\n * ```\n */\nexport const makeModule = <\n TProps = void,\n TReturn extends ModuleReturn = ModuleReturn,\n E extends Error = Error,\n R extends Service | Plugin.Service | never = Service,\n>(\n fn: (props: TProps) => Effect.Effect<TReturn, E, R>,\n): ((props: TProps) => Effect.Effect<TReturn, E, R>) => fn;\n"],
5
+ "mappings": ";;;;;AAAA;;;;;;;;;;;;;;AAKA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AAajB,IAAMC,UAAN,cAA8BC,YAAI,uCAAA,EAAA,EAAA;AAGpC;AAUE,IAAMC,MAAM,CAAIC,iBACdC,eAAQJ,SAAS,CAACK,YAChBC,WAAI;EACTA,KAAK,MAAMD,QAAQH,IAAIC,YAAAA;EACvBI,OAAO,CAACC,UAAWA,iBAAiBC,QAAQD,QAAQ,IAAIC,MAAMC,OAAOF,KAAAA,CAAAA;AACvE,CAAA,CAAA;AAQG,IAAMG,SAAS,CAAIR,iBACjBS,WAAIZ,SAAS,CAACK,YAAYA,QAAQM,OAAOR,YAAAA,CAAAA;AAO3C,IAAMU,UAAU,CAAIV,iBAClBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQQ,QAAQV,YAAAA,CAAAA;AAOhD,IAAMW,OAAO,CAAIX,iBACfS,WAAIZ,SAAS,CAACK,YAAYA,QAAQS,KAAKX,YAAAA,CAAAA;AAOzC,IAAMY,YAA2BC,uBAAOC,IAAI,+BAAA;AAiB5C,IAAMC,OAAO,CAAIC,eAAAA;AACtB,SAAO;IAAEA;EAAW;AACtB;AAkCO,IAAMC,cAAc,CACzBC,cACAC,gBACAC,eAAAA;AAEA,SAAO;IACLC,WAAWH;IACXC;IACAC;EACF;AACF;AA4BO,IAAME,OAAO,CAClBC,MACAC,MAAAA;AAEA,QAAMC,SAA+B,CAACC,UAC7BC,WAAI,aAAA;AACT,UAAM,EAAEC,SAASC,cAAa,IAAK,OAAcC,kBAAW,MAAMN,EAAAA,CAAAA;AAClE,UAAMO,SAAS,OAAOF,cAAcH,KAAAA;AACpC,UAAMM,aAAaD,UAAU,OAAO,CAAA,IAAKE,MAAMC,QAAQH,MAAAA,IAAUE,MAAME,KAAKJ,MAAAA,IAAU;MAACA;;AACvF,WAAOC;EACT,CAAA;AAEF,SAAOI,OAAOC,OAAOZ,QAAQ;IAAE,CAACb,SAAAA,GAAYW;EAAK,CAAA;AACnD;AAQO,IAAMe,eAAe,CAACC,eAAAA;AAC3B,SAAOA,cAAc,OAAOA,eAAe,cAAc3B,aAAa2B,aAClEC,OAAOD,WAAW3B,SAAAA,CAAU,IAC5B6B;AACN;AA2CO,IAAMC,aAAa,CAMxBC,OACsDA;",
6
+ "names": ["Context", "Effect", "Service", "Tag", "get", "interfaceDef", "flatMap", "manager", "try", "catch", "error", "Error", "String", "getAll", "map", "waitFor", "atom", "ModuleTag", "Symbol", "for", "make", "identifier", "contributes", "interfaceDef", "implementation", "deactivate", "interface", "lazy", "name", "c", "lazyFn", "props", "gen", "default", "getCapability", "tryPromise", "result", "normalized", "Array", "isArray", "from", "Object", "assign", "getModuleTag", "capability", "String", "undefined", "makeModule", "fn"]
7
7
  }
@@ -0,0 +1,89 @@
1
+ import "../chunk-TIEBZMTF.mjs";
2
+ import {
3
+ capabilities_exports
4
+ } from "../chunk-WEBSGU5L.mjs";
5
+ import {
6
+ activation_events_exports
7
+ } from "../chunk-M5IC326L.mjs";
8
+ import "../chunk-YAFEA4GV.mjs";
9
+ import {
10
+ plugin_manager_exports
11
+ } from "../chunk-2UI6ACB5.mjs";
12
+ import "../chunk-272IPLHQ.mjs";
13
+ import {
14
+ plugin_exports
15
+ } from "../chunk-7M4467QR.mjs";
16
+ import {
17
+ capability_exports
18
+ } from "../chunk-YNFPIQGB.mjs";
19
+ import "../chunk-J5LGTIGS.mjs";
20
+
21
+ // src/cli/cli.ts
22
+ import * as Command from "@effect/cli/Command";
23
+ import * as Effect from "effect/Effect";
24
+ import * as Layer from "effect/Layer";
25
+ import { invariant } from "@dxos/invariant";
26
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/cli/cli.ts";
27
+ var defaultPluginLoader = (plugins) => (id) => Effect.sync(() => {
28
+ const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
29
+ invariant(plugin, `Plugin not found: ${id}`, {
30
+ F: __dxlog_file,
31
+ L: 19,
32
+ S: void 0,
33
+ A: [
34
+ "plugin",
35
+ "`Plugin not found: ${id}`"
36
+ ]
37
+ });
38
+ return plugin;
39
+ });
40
+ var createCliApp = Effect.fn(function* ({ rootCommand, subCommands: subCommandsProp, pluginManager: pluginManagerProp, pluginLoader: pluginLoaderProp, plugins: pluginsProp = [], core: coreProp, enabled: enabledProp = [], safeMode = false }) {
41
+ const plugins = pluginsProp;
42
+ const core = coreProp ?? plugins.map(({ meta }) => meta.id);
43
+ const pluginLoader = pluginLoaderProp ?? defaultPluginLoader(plugins);
44
+ const enabled = safeMode ? [] : enabledProp;
45
+ const manager = pluginManagerProp ?? plugin_manager_exports.make({
46
+ pluginLoader,
47
+ plugins,
48
+ core,
49
+ enabled
50
+ });
51
+ manager.capabilities.contribute({
52
+ interface: capabilities_exports.PluginManager,
53
+ implementation: manager,
54
+ module: "org.dxos.app-framework.plugin-manager"
55
+ });
56
+ manager.capabilities.contribute({
57
+ interface: capabilities_exports.AtomRegistry,
58
+ implementation: manager.registry,
59
+ module: "org.dxos.app-framework.atom-registry"
60
+ });
61
+ yield* manager.activate(activation_events_exports.Startup);
62
+ const layers = manager.capabilities.getAll(capabilities_exports.Layer);
63
+ const capabilityServiceLayer = Layer.succeed(capability_exports.Service, manager.capabilities);
64
+ const pluginServiceLayer = Layer.succeed(plugin_exports.Service, manager);
65
+ const layer = Layer.mergeAll(capabilityServiceLayer, pluginServiceLayer, ...layers);
66
+ const pluginCommands = manager.capabilities.getAll(capabilities_exports.Command);
67
+ const subCommands = subCommandsProp ? [
68
+ ...subCommandsProp,
69
+ ...pluginCommands
70
+ ] : pluginCommands;
71
+ invariant(subCommands.length > 0, "No subcommands provided", {
72
+ F: __dxlog_file,
73
+ L: 103,
74
+ S: this,
75
+ A: [
76
+ "subCommands.length > 0",
77
+ "'No subcommands provided'"
78
+ ]
79
+ });
80
+ const command = rootCommand.pipe(Command.withSubcommands(subCommands));
81
+ return {
82
+ command,
83
+ layer
84
+ };
85
+ });
86
+ export {
87
+ createCliApp
88
+ };
89
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/cli/cli.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Command from '@effect/cli/Command';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nimport { invariant } from '@dxos/invariant';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { Capability, Plugin, PluginManager } from '../core';\n\nconst defaultPluginLoader =\n (plugins: Plugin.Plugin[]): PluginManager.ManagerOptions['pluginLoader'] =>\n (id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.id === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return plugin;\n });\n\ntype SubCommands = [Command.Command<any, any, any, any>, ...Array<Command.Command<any, any, any, any>>];\n\nexport type CreateCliAppOptions = {\n rootCommand: Command.Command<any, any, any, any>;\n subCommands?: SubCommands;\n pluginManager?: PluginManager.PluginManager;\n pluginLoader?: PluginManager.ManagerOptions['pluginLoader'];\n plugins?: Plugin.Plugin[];\n core?: string[];\n enabled?: string[];\n safeMode?: boolean;\n};\n\n/**\n * Creates a CLI application with plugin support.\n * Similar to useApp but for CLI environments.\n *\n * @example\n * const plugins = [ClientPluginCLI()];\n * const manager = await createCliApp({ plugins });\n * const commands = manager.capabilities.getAll(Capabilities.Command);\n *\n * @param options.pluginManager Optional existing PluginManager instance.\n * @param options.pluginLoader Function to load plugins by ID.\n * @param options.plugins All plugins available to the application.\n * @param options.core Core plugins which will always be enabled.\n * @param options.enabled Enabled plugins.\n * @param options.safeMode Whether to enable safe mode, which disables optional plugins.\n */\nexport const createCliApp = Effect.fn(function* ({\n rootCommand,\n subCommands: subCommandsProp,\n pluginManager: pluginManagerProp,\n pluginLoader: pluginLoaderProp,\n plugins: pluginsProp = [],\n core: coreProp,\n enabled: enabledProp = [],\n safeMode = false,\n}: CreateCliAppOptions) {\n const plugins = pluginsProp;\n const core = coreProp ?? plugins.map(({ meta }) => meta.id);\n const pluginLoader = pluginLoaderProp ?? defaultPluginLoader(plugins);\n const enabled = safeMode ? [] : enabledProp;\n const manager =\n pluginManagerProp ??\n PluginManager.make({\n pluginLoader,\n plugins,\n core,\n enabled,\n });\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 // Activate startup event to load CLI commands and Effect layers.\n yield* manager.activate(ActivationEvents.Startup);\n\n // Gather all layers and merge them into a single layer.\n const layers = manager.capabilities.getAll(Capabilities.Layer);\n const capabilityServiceLayer = Layer.succeed(Capability.Service, manager.capabilities);\n const pluginServiceLayer = Layer.succeed(Plugin.Service, manager);\n const layer = (Layer.mergeAll as (...args: Layer.Layer<any, any, any>[]) => Layer.Layer<any, any, never>)(\n capabilityServiceLayer,\n pluginServiceLayer,\n ...layers,\n );\n\n // Gather all commands and provide them to the root command.\n const pluginCommands = manager.capabilities.getAll(Capabilities.Command);\n const subCommands = subCommandsProp ? [...subCommandsProp, ...pluginCommands] : pluginCommands;\n invariant(subCommands.length > 0, 'No subcommands provided');\n const command = rootCommand.pipe(Command.withS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AACzD,QAAMuB,QAAeC,eACnBP,wBACAI,oBAAAA,GACGP,MAAAA;AAIL,QAAMW,iBAAiBzB,QAAQG,aAAaY,OAAOT,qBAAaoB,OAAO;AACvE,QAAMvC,cAAcC,kBAAkB;OAAIA;OAAoBqC;MAAkBA;AAChF1C,YAAUI,YAAYwC,SAAS,GAAG,2BAAA;;;;;;;;;AAClC,QAAMC,UAAU1C,YAAY2C,KAAaC,wBAAgB3C,WAAAA,CAAAA;AAEzD,SAAO;IAAEyC;IAASL;EAAM;AAC1B,CAAA;",
6
+ "names": ["Command", "Effect", "Layer", "invariant", "defaultPluginLoader", "plugins", "id", "sync", "plugin", "find", "meta", "invariant", "createCliApp", "fn", "rootCommand", "subCommands", "subCommandsProp", "pluginManager", "pluginManagerProp", "pluginLoader", "pluginLoaderProp", "pluginsProp", "core", "coreProp", "enabled", "enabledProp", "safeMode", "map", "manager", "PluginManager", "make", "capabilities", "contribute", "interface", "Capabilities", "implementation", "module", "AtomRegistry", "registry", "activate", "ActivationEvents", "Startup", "layers", "getAll", "Layer", "capabilityServiceLayer", "succeed", "Capability", "Service", "pluginServiceLayer", "Plugin", "layer", "mergeAll", "pluginCommands", "Command", "length", "command", "pipe", "withSubcommands"]
7
+ }
@@ -0,0 +1,23 @@
1
+ import {
2
+ ManagedRuntimeReady,
3
+ OperationInvokerReady,
4
+ SetupLayer,
5
+ SetupOperationResolver,
6
+ SetupReactSurface,
7
+ Startup
8
+ } from "../chunk-M5IC326L.mjs";
9
+ import "../chunk-YAFEA4GV.mjs";
10
+ import "../chunk-2UI6ACB5.mjs";
11
+ import "../chunk-272IPLHQ.mjs";
12
+ import "../chunk-7M4467QR.mjs";
13
+ import "../chunk-YNFPIQGB.mjs";
14
+ import "../chunk-J5LGTIGS.mjs";
15
+ export {
16
+ ManagedRuntimeReady,
17
+ OperationInvokerReady,
18
+ SetupLayer,
19
+ SetupOperationResolver,
20
+ SetupReactSurface,
21
+ Startup
22
+ };
23
+ //# sourceMappingURL=activation-events.mjs.map
@@ -0,0 +1,45 @@
1
+ import {
2
+ AtomRegistry,
3
+ Command,
4
+ HistoryTracker,
5
+ Layer,
6
+ ManagedRuntime,
7
+ Null,
8
+ OperationInvoker,
9
+ OperationResolver,
10
+ PluginManager,
11
+ ReactContext,
12
+ ReactRoot,
13
+ ReactSurface,
14
+ UndoMapping,
15
+ UndoRegistry,
16
+ getAtomValue,
17
+ subscribeAtom,
18
+ updateAtomValue
19
+ } from "../chunk-WEBSGU5L.mjs";
20
+ import "../chunk-YAFEA4GV.mjs";
21
+ import "../chunk-2UI6ACB5.mjs";
22
+ import "../chunk-272IPLHQ.mjs";
23
+ import "../chunk-7M4467QR.mjs";
24
+ import "../chunk-YNFPIQGB.mjs";
25
+ import "../chunk-J5LGTIGS.mjs";
26
+ export {
27
+ AtomRegistry,
28
+ Command,
29
+ HistoryTracker,
30
+ Layer,
31
+ ManagedRuntime,
32
+ Null,
33
+ OperationInvoker,
34
+ OperationResolver,
35
+ PluginManager,
36
+ ReactContext,
37
+ ReactRoot,
38
+ ReactSurface,
39
+ UndoMapping,
40
+ UndoRegistry,
41
+ getAtomValue,
42
+ subscribeAtom,
43
+ updateAtomValue
44
+ };
45
+ //# sourceMappingURL=capabilities.mjs.map
@@ -6,7 +6,7 @@ import {
6
6
  isOneOf,
7
7
  make,
8
8
  oneOf
9
- } from "../chunk-PKQT6C53.mjs";
9
+ } from "../chunk-272IPLHQ.mjs";
10
10
  import "../chunk-J5LGTIGS.mjs";
11
11
  export {
12
12
  allOf,
@@ -10,7 +10,7 @@ import {
10
10
  make,
11
11
  makeModule,
12
12
  waitFor
13
- } from "../chunk-6Y7PZV72.mjs";
13
+ } from "../chunk-YNFPIQGB.mjs";
14
14
  import "../chunk-J5LGTIGS.mjs";
15
15
  export {
16
16
  ModuleTag,