@dxos/app-framework 0.8.4-main.c85a9c8dae → 0.8.4-main.cb12b3f963

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 (325) hide show
  1. package/dist/lib/browser/{capability-7RLVE42K.mjs → capability-5RRH3WIB.mjs} +11 -10
  2. package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
  3. package/dist/lib/browser/{capability-2GL5JAGJ.mjs → capability-LUKGKUQH.mjs} +10 -9
  4. package/dist/lib/browser/{chunk-5RJNZV7K.mjs → chunk-23D4SJUE.mjs} +11 -13
  5. package/dist/lib/browser/{chunk-5RJNZV7K.mjs.map → chunk-23D4SJUE.mjs.map} +3 -3
  6. package/dist/lib/browser/{chunk-YNFPIQGB.mjs → chunk-3JWJXGLK.mjs} +5 -2
  7. package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
  9. package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-66IXTIVK.mjs} +3 -2
  11. package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
  13. package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
  14. package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
  15. package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-FJ4765WW.mjs.map} +3 -3
  16. package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
  17. package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
  18. package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
  19. package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
  20. package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
  21. package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
  22. package/dist/lib/browser/chunk-PC4NOADA.mjs +471 -0
  23. package/dist/lib/browser/chunk-PC4NOADA.mjs.map +7 -0
  24. package/dist/lib/browser/{chunk-REORGDJT.mjs → chunk-WBHCSOBW.mjs} +18 -18
  25. package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
  26. package/dist/lib/browser/{chunk-FNKT2QQ2.mjs → chunk-Z55LVAGN.mjs} +85 -17
  27. package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
  28. package/dist/lib/browser/{chunk-ZRWBPIZG.mjs → chunk-ZGJAZSNE.mjs} +9 -37
  29. package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
  30. package/dist/lib/browser/cli/index.mjs +16 -29
  31. package/dist/lib/browser/cli/index.mjs.map +3 -3
  32. package/dist/lib/browser/common/activation-events.mjs +9 -8
  33. package/dist/lib/browser/common/capabilities.mjs +9 -8
  34. package/dist/lib/browser/core/activation-event.mjs +1 -1
  35. package/dist/lib/browser/core/capability.mjs +3 -1
  36. package/dist/lib/browser/core/plugin-manager.mjs +8 -4
  37. package/dist/lib/browser/core/plugin.mjs +14 -4
  38. package/dist/lib/browser/core/url-loader.mjs +24 -0
  39. package/dist/lib/browser/index.mjs +37 -22
  40. package/dist/lib/browser/index.mjs.map +3 -3
  41. package/dist/lib/browser/{invoker-capability-BNLVNYHU.mjs → invoker-capability-K4GHUFXF.mjs} +22 -14
  42. package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
  43. package/dist/lib/browser/meta.json +1 -1
  44. package/dist/lib/browser/testing/index.mjs +184 -49
  45. package/dist/lib/browser/testing/index.mjs.map +4 -4
  46. package/dist/lib/browser/testing/react.mjs +78 -0
  47. package/dist/lib/browser/testing/react.mjs.map +7 -0
  48. package/dist/lib/browser/ui/index.mjs +18 -15
  49. package/dist/lib/node-esm/{capability-CHIMU6LX.mjs → capability-FCGZVIEG.mjs} +10 -9
  50. package/dist/lib/{browser/capability-2GL5JAGJ.mjs.map → node-esm/capability-FCGZVIEG.mjs.map} +1 -1
  51. package/dist/lib/node-esm/{capability-EVZK4REM.mjs → capability-JOIQ2MQE.mjs} +11 -10
  52. package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-37Z53PXZ.mjs} +2 -2
  54. package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-37Z53PXZ.mjs.map} +3 -3
  55. package/dist/lib/node-esm/chunk-42J2ZUQQ.mjs +472 -0
  56. package/dist/lib/node-esm/chunk-42J2ZUQQ.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
  58. package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
  59. package/dist/lib/node-esm/{chunk-2A4PRBIX.mjs → chunk-D347W3KO.mjs} +9 -37
  60. package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
  61. package/dist/lib/node-esm/{chunk-CJCQS2YL.mjs → chunk-HTBJU5FX.mjs} +85 -17
  62. package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
  64. package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
  65. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
  66. package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
  67. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs → chunk-SBS2YMPT.mjs} +11 -13
  68. package/dist/lib/node-esm/{chunk-VUIUFIGT.mjs.map → chunk-SBS2YMPT.mjs.map} +3 -3
  69. package/dist/lib/node-esm/{chunk-SB5ODNPX.mjs → chunk-SDJ4B2LU.mjs} +5 -2
  70. package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
  71. package/dist/lib/node-esm/{chunk-UFW652GS.mjs → chunk-WFSRZKBP.mjs} +18 -18
  72. package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
  73. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
  74. package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
  75. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
  76. package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
  77. package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-XOCUANHO.mjs} +3 -2
  78. package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
  79. package/dist/lib/node-esm/cli/index.mjs +16 -29
  80. package/dist/lib/node-esm/cli/index.mjs.map +3 -3
  81. package/dist/lib/node-esm/common/activation-events.mjs +9 -8
  82. package/dist/lib/node-esm/common/capabilities.mjs +9 -8
  83. package/dist/lib/node-esm/core/activation-event.mjs +1 -1
  84. package/dist/lib/node-esm/core/capability.mjs +3 -1
  85. package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
  86. package/dist/lib/node-esm/core/plugin.mjs +14 -4
  87. package/dist/lib/node-esm/core/url-loader.mjs +25 -0
  88. package/dist/lib/node-esm/index.mjs +37 -22
  89. package/dist/lib/node-esm/index.mjs.map +3 -3
  90. package/dist/lib/node-esm/{invoker-capability-VF6SP44V.mjs → invoker-capability-XEPW5LMJ.mjs} +22 -14
  91. package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
  92. package/dist/lib/node-esm/meta.json +1 -1
  93. package/dist/lib/node-esm/testing/index.mjs +184 -49
  94. package/dist/lib/node-esm/testing/index.mjs.map +4 -4
  95. package/dist/lib/node-esm/testing/react.mjs +79 -0
  96. package/dist/lib/node-esm/testing/react.mjs.map +7 -0
  97. package/dist/lib/node-esm/ui/index.mjs +18 -15
  98. package/dist/plugin/node-esm/index.mjs +875 -0
  99. package/dist/plugin/node-esm/index.mjs.map +7 -0
  100. package/dist/plugin/node-esm/meta.json +1 -0
  101. package/dist/types/src/common/activation-events.d.ts +1 -1
  102. package/dist/types/src/common/activation-events.d.ts.map +1 -1
  103. package/dist/types/src/common/annotations.d.ts +1 -0
  104. package/dist/types/src/common/annotations.d.ts.map +1 -0
  105. package/dist/types/src/common/capabilities.d.ts +4 -8
  106. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  107. package/dist/types/src/common/operations.d.ts +8 -22
  108. package/dist/types/src/common/operations.d.ts.map +1 -1
  109. package/dist/types/src/core/activation-event.d.ts +5 -5
  110. package/dist/types/src/core/activation-event.d.ts.map +1 -1
  111. package/dist/types/src/core/capability-manager.d.ts +5 -0
  112. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  113. package/dist/types/src/core/capability.d.ts +8 -2
  114. package/dist/types/src/core/capability.d.ts.map +1 -1
  115. package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
  116. package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
  117. package/dist/types/src/core/index.d.ts +6 -0
  118. package/dist/types/src/core/index.d.ts.map +1 -1
  119. package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
  120. package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
  121. package/dist/types/src/core/plugin-manager.d.ts +177 -4
  122. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  123. package/dist/types/src/core/plugin-manifest.d.ts +101 -0
  124. package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
  125. package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
  126. package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
  127. package/dist/types/src/core/plugin.d.ts +113 -7
  128. package/dist/types/src/core/plugin.d.ts.map +1 -1
  129. package/dist/types/src/core/registry.d.ts +101 -0
  130. package/dist/types/src/core/registry.d.ts.map +1 -0
  131. package/dist/types/src/core/url-loader.d.ts +127 -0
  132. package/dist/types/src/core/url-loader.d.ts.map +1 -0
  133. package/dist/types/src/core/url-loader.test.d.ts +2 -0
  134. package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
  135. package/dist/types/src/helpers.d.ts.map +1 -1
  136. package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -1
  137. package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
  138. package/dist/types/src/plugin-operation/history/errors.d.ts +30 -3
  139. package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
  140. package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
  141. package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
  142. package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
  143. package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
  144. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
  145. package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
  146. package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
  147. package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
  148. package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
  149. package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
  150. package/dist/types/src/plugin-operation/testing.d.ts +27 -77
  151. package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
  152. package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -1
  153. package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
  154. package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
  155. package/dist/types/src/testing/harness.d.ts +67 -0
  156. package/dist/types/src/testing/harness.d.ts.map +1 -0
  157. package/dist/types/src/testing/index.d.ts +1 -0
  158. package/dist/types/src/testing/index.d.ts.map +1 -1
  159. package/dist/types/src/testing/react.d.ts +27 -0
  160. package/dist/types/src/testing/react.d.ts.map +1 -0
  161. package/dist/types/src/testing/react.test.d.ts +2 -0
  162. package/dist/types/src/testing/react.test.d.ts.map +1 -0
  163. package/dist/types/src/testing/service.d.ts.map +1 -1
  164. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  165. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  166. package/dist/types/src/ui/components/App/App.d.ts +3 -2
  167. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  168. package/dist/types/src/ui/components/App/App.stories.d.ts +2 -2
  169. package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
  170. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
  171. package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
  172. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
  173. package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
  174. package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
  175. package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
  176. package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
  177. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
  178. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  179. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  180. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
  181. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
  182. package/dist/types/src/ui/components/Surface/index.d.ts +22 -6
  183. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  184. package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
  185. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  186. package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
  187. package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
  188. package/dist/types/src/ui/components/index.d.ts +1 -0
  189. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  190. package/dist/types/src/ui/hooks/index.d.ts +0 -1
  191. package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
  192. package/dist/types/src/ui/hooks/useApp.d.ts +43 -4
  193. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  194. package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
  195. package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
  196. package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
  197. package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
  198. package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
  199. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
  200. package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
  201. package/dist/types/src/vite-plugin/boot-loader/index.d.ts +52 -0
  202. package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
  203. package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
  204. package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
  205. package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
  206. package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
  207. package/dist/types/src/vite-plugin/index.d.ts +5 -0
  208. package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
  209. package/dist/types/src/vite-plugin/manifest.d.ts +41 -0
  210. package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
  211. package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
  212. package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
  213. package/dist/types/src/vite-plugin/packages.d.ts +13 -0
  214. package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
  215. package/dist/types/tsconfig.tsbuildinfo +1 -1
  216. package/moon.yml +15 -0
  217. package/package.json +48 -53
  218. package/src/cli/cli.ts +3 -3
  219. package/src/common/activation-events.ts +6 -6
  220. package/src/common/annotations.ts +3 -0
  221. package/src/common/capabilities.ts +18 -23
  222. package/src/common/operations.ts +7 -10
  223. package/src/context.ts +1 -1
  224. package/src/core/activation-event.ts +5 -2
  225. package/src/core/capability-manager.test.ts +1 -1
  226. package/src/core/capability-manager.ts +22 -1
  227. package/src/core/capability.ts +13 -2
  228. package/src/core/edge-registry-plugin-provider.ts +92 -0
  229. package/src/core/index.ts +6 -0
  230. package/src/core/plugin-asset-cache.ts +60 -0
  231. package/src/core/plugin-manager.test.ts +855 -29
  232. package/src/core/plugin-manager.ts +808 -188
  233. package/src/core/plugin-manifest.test.ts +75 -0
  234. package/src/core/plugin-manifest.ts +134 -0
  235. package/src/core/plugin.ts +144 -12
  236. package/src/core/registry.ts +157 -0
  237. package/src/core/url-loader.test.ts +221 -0
  238. package/src/core/url-loader.ts +388 -0
  239. package/src/plugin-operation/OperationPlugin.ts +2 -3
  240. package/src/plugin-operation/history/capability.ts +1 -2
  241. package/src/plugin-operation/history/errors.ts +2 -6
  242. package/src/plugin-operation/history/history-tracker.test.ts +37 -43
  243. package/src/plugin-operation/history/history-tracker.ts +1 -2
  244. package/src/plugin-operation/history/types.ts +1 -1
  245. package/src/plugin-operation/history/undo-mapping.ts +1 -1
  246. package/src/plugin-operation/history/undo-registry.test.ts +3 -4
  247. package/src/plugin-operation/history/undo-registry.ts +1 -1
  248. package/src/plugin-operation/invoker-capability.ts +19 -4
  249. package/src/plugin-operation/meta.ts +1 -1
  250. package/src/plugin-operation/testing.ts +26 -45
  251. package/src/plugin-runtime/RuntimePlugin.ts +2 -3
  252. package/src/plugin-runtime/meta.ts +1 -1
  253. package/src/testing/harness.ts +229 -0
  254. package/src/testing/index.ts +1 -0
  255. package/src/testing/react.test.tsx +48 -0
  256. package/src/testing/react.tsx +113 -0
  257. package/src/testing/service.ts +3 -3
  258. package/src/testing/withPluginManager.stories.tsx +1 -2
  259. package/src/testing/withPluginManager.tsx +40 -18
  260. package/src/ui/components/App/App.stories.tsx +5 -5
  261. package/src/ui/components/App/App.tsx +29 -5
  262. package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
  263. package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
  264. package/src/ui/components/Placeholder/index.ts +5 -0
  265. package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +8 -6
  266. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +16 -15
  267. package/src/ui/components/Surface/SurfaceComponent.tsx +109 -53
  268. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
  269. package/src/ui/components/Surface/index.ts +35 -1
  270. package/src/ui/components/Surface/types.test.ts +126 -0
  271. package/src/ui/components/Surface/types.ts +164 -12
  272. package/src/ui/components/index.ts +1 -0
  273. package/src/ui/hooks/index.ts +0 -1
  274. package/src/ui/hooks/useApp.test.tsx +159 -0
  275. package/src/ui/hooks/useApp.tsx +226 -15
  276. package/src/ui/hooks/useLoading.tsx +14 -6
  277. package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
  278. package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
  279. package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
  280. package/src/vite-plugin/boot-loader/index.ts +112 -0
  281. package/src/vite-plugin/composer/index.ts +306 -0
  282. package/src/vite-plugin/import-map/index.ts +524 -0
  283. package/src/vite-plugin/index.ts +10 -0
  284. package/src/vite-plugin/manifest.test.ts +46 -0
  285. package/src/vite-plugin/manifest.ts +57 -0
  286. package/src/vite-plugin/packages.ts +188 -0
  287. package/tsconfig.json +19 -1
  288. package/tsconfig.node.json +1 -1
  289. package/vitest.config.ts +1 -1
  290. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  291. package/dist/lib/browser/capability-7RLVE42K.mjs.map +0 -7
  292. package/dist/lib/browser/chunk-4CTRO67U.mjs +0 -703
  293. package/dist/lib/browser/chunk-4CTRO67U.mjs.map +0 -7
  294. package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
  295. package/dist/lib/browser/chunk-FNKT2QQ2.mjs.map +0 -7
  296. package/dist/lib/browser/chunk-HE27PNNQ.mjs +0 -824
  297. package/dist/lib/browser/chunk-HE27PNNQ.mjs.map +0 -7
  298. package/dist/lib/browser/chunk-NPUEVX42.mjs +0 -34
  299. package/dist/lib/browser/chunk-NPUEVX42.mjs.map +0 -7
  300. package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
  301. package/dist/lib/browser/chunk-REORGDJT.mjs.map +0 -7
  302. package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
  303. package/dist/lib/browser/chunk-YNFPIQGB.mjs.map +0 -7
  304. package/dist/lib/browser/chunk-ZRWBPIZG.mjs.map +0 -7
  305. package/dist/lib/browser/invoker-capability-BNLVNYHU.mjs.map +0 -7
  306. package/dist/lib/node-esm/capability-EVZK4REM.mjs.map +0 -7
  307. package/dist/lib/node-esm/chunk-2A4PRBIX.mjs.map +0 -7
  308. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs +0 -704
  309. package/dist/lib/node-esm/chunk-7CPNAEGV.mjs.map +0 -7
  310. package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
  311. package/dist/lib/node-esm/chunk-CJCQS2YL.mjs.map +0 -7
  312. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs +0 -825
  313. package/dist/lib/node-esm/chunk-DTCHT2X2.mjs.map +0 -7
  314. package/dist/lib/node-esm/chunk-JAZVHID3.mjs +0 -35
  315. package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +0 -7
  316. package/dist/lib/node-esm/chunk-SB5ODNPX.mjs.map +0 -7
  317. package/dist/lib/node-esm/chunk-UFW652GS.mjs.map +0 -7
  318. package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
  319. package/dist/lib/node-esm/invoker-capability-VF6SP44V.mjs.map +0 -7
  320. package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
  321. package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
  322. package/src/ui/hooks/useOperationResolver.ts +0 -40
  323. /package/dist/lib/{node-esm/capability-CHIMU6LX.mjs.map → browser/capability-LUKGKUQH.mjs.map} +0 -0
  324. /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
  325. /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
@@ -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 Atom, type Registry } from '@effect-atom/atom-react';\nimport type * as Command$ from '@effect/cli/Command';\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 { OperationHandlerSet } from '@dxos/compute';\nimport { OperationInvoker as OperationInvoker$ } 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 const OperationHandler = Capability$.make<OperationHandlerSet.OperationHandlerSet>(\n 'org.dxos.app-framework.capability.operation-handler',\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;AAoBjB,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;AAMxD,IAAMS,mBAAmBV,mBAAYC,KAC1C,qDAAA;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", "OperationHandler", "UndoMapping", "OperationInvoker", "UndoRegistry", "HistoryTracker", "getAtomValue", "atomCapability", "gen", "registry", "get", "atom", "updateAtomValue", "fn", "set", "subscribeAtom", "callback", "subscribe"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getModuleTag
3
- } from "./chunk-YNFPIQGB.mjs";
3
+ } from "./chunk-3JWJXGLK.mjs";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-J5LGTIGS.mjs";
@@ -8,29 +8,36 @@ import {
8
8
  // src/core/plugin.ts
9
9
  var plugin_exports = {};
10
10
  __export(plugin_exports, {
11
+ LazyPluginError: () => LazyPluginError,
11
12
  PluginModuleTypeId: () => PluginModuleTypeId,
12
13
  PluginTypeId: () => PluginTypeId,
13
14
  Service: () => Service,
14
15
  activate: () => activate,
15
16
  addModule: () => addModule,
16
17
  define: () => define,
18
+ isLazy: () => isLazy,
17
19
  isPlugin: () => isPlugin,
18
20
  isPluginModule: () => isPluginModule,
21
+ lazy: () => lazy,
19
22
  make: () => make,
20
- reset: () => reset
23
+ reset: () => reset,
24
+ resolveLazy: () => resolveLazy,
25
+ shutdown: () => shutdown
21
26
  });
22
27
  import * as Context from "effect/Context";
23
28
  import * as Effect from "effect/Effect";
24
29
  import * as Option from "effect/Option";
25
30
  import * as Pipeable from "effect/Pipeable";
31
+ import { BaseError } from "@dxos/errors";
26
32
  import { invariant } from "@dxos/invariant";
27
33
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin.ts";
28
34
  var Service = class extends Context.Tag("@dxos/app-framework/PluginManager")() {
29
35
  };
30
36
  var activate = (event) => Effect.flatMap(Service, (manager) => manager.activate(event));
31
37
  var reset = (event) => Effect.flatMap(Service, (manager) => manager.reset(event));
38
+ var shutdown = () => Effect.flatMap(Service, (manager) => manager.shutdown());
32
39
  var computeModuleId = (pluginId, moduleName) => {
33
- return `${pluginId}/module/${moduleName}`;
40
+ return `${pluginId}.module.${moduleName}`;
34
41
  };
35
42
  var PluginModuleTypeId = /* @__PURE__ */ Symbol.for("@dxos/app-framework/PluginModule");
36
43
  var isPluginModule = (value) => {
@@ -40,14 +47,14 @@ var PluginModuleImpl = class {
40
47
  [PluginModuleTypeId] = PluginModuleTypeId;
41
48
  id;
42
49
  activatesOn;
43
- activatesBefore;
44
- activatesAfter;
50
+ firesBeforeActivation;
51
+ firesAfterActivation;
45
52
  activate;
46
53
  constructor(options) {
47
54
  this.id = options.id;
48
55
  this.activatesOn = options.activatesOn;
49
- this.activatesBefore = options.activatesBefore;
50
- this.activatesAfter = options.activatesAfter;
56
+ this.firesBeforeActivation = options.firesBeforeActivation;
57
+ this.firesAfterActivation = options.firesAfterActivation;
51
58
  this.activate = options.activate;
52
59
  }
53
60
  };
@@ -100,15 +107,7 @@ var resolveModule = (meta, module, options) => {
100
107
  const id = Option.fromNullable(moduleOptions.id).pipe(Option.match({
101
108
  onNone: () => {
102
109
  const exportName = getModuleTag(moduleOptions.activate);
103
- invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`, {
104
- F: __dxlog_file,
105
- L: 301,
106
- S: void 0,
107
- A: [
108
- "exportName",
109
- "`Plugin module missing name. Plugin: ${meta.id}`"
110
- ]
111
- });
110
+ invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 131, S: void 0, A: ["exportName", "`Plugin module missing name. Plugin: ${meta.id}`"] });
112
111
  return computeModuleId(meta.id, exportName);
113
112
  },
114
113
  onSome: (id2) => computeModuleId(meta.id, id2)
@@ -128,11 +127,76 @@ function make(builder) {
128
127
  meta
129
128
  });
130
129
  }
130
+ var LazyTag = /* @__PURE__ */ Symbol.for("@dxos/app-framework/Plugin/Lazy");
131
+ var lazy = (meta, loader) => {
132
+ const factory = (options) => {
133
+ const stub = new PluginImpl(meta, []);
134
+ Object.defineProperty(stub, LazyTag, {
135
+ value: {
136
+ loader,
137
+ options
138
+ },
139
+ enumerable: false
140
+ });
141
+ return stub;
142
+ };
143
+ return Object.assign(factory, {
144
+ meta
145
+ });
146
+ };
147
+ var isLazy = (plugin) => LazyTag in plugin;
148
+ var LazyPluginError = class extends BaseError.extend("LazyPluginError", "Failed to resolve lazy plugin") {
149
+ };
150
+ var resolveLazy = (plugin) => Effect.gen(function* () {
151
+ if (!isLazy(plugin)) {
152
+ return plugin;
153
+ }
154
+ const id = plugin.meta.id;
155
+ const { loader, options } = plugin[LazyTag];
156
+ const mod = yield* Effect.tryPromise({
157
+ try: loader,
158
+ catch: (error) => new LazyPluginError({
159
+ context: {
160
+ id,
161
+ reason: "load-failed"
162
+ },
163
+ cause: error
164
+ })
165
+ });
166
+ if (!mod || typeof mod.default !== "function") {
167
+ return yield* Effect.fail(new LazyPluginError({
168
+ context: {
169
+ id,
170
+ reason: "missing-default"
171
+ }
172
+ }));
173
+ }
174
+ const result = mod.default(options);
175
+ if (!isPlugin(result)) {
176
+ return yield* Effect.fail(new LazyPluginError({
177
+ context: {
178
+ id,
179
+ reason: "invalid-plugin"
180
+ }
181
+ }));
182
+ }
183
+ if (result.meta.id !== id) {
184
+ return yield* Effect.fail(new LazyPluginError({
185
+ context: {
186
+ id,
187
+ reason: "meta-mismatch",
188
+ returnedId: result.meta.id
189
+ }
190
+ }));
191
+ }
192
+ return result;
193
+ });
131
194
 
132
195
  export {
133
196
  Service,
134
197
  activate,
135
198
  reset,
199
+ shutdown,
136
200
  PluginModuleTypeId,
137
201
  isPluginModule,
138
202
  PluginTypeId,
@@ -140,6 +204,10 @@ export {
140
204
  define,
141
205
  addModule,
142
206
  make,
207
+ lazy,
208
+ isLazy,
209
+ LazyPluginError,
210
+ resolveLazy,
143
211
  plugin_exports
144
212
  };
145
- //# sourceMappingURL=chunk-FNKT2QQ2.mjs.map
213
+ //# sourceMappingURL=chunk-Z55LVAGN.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/core/plugin.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nimport { BaseError } from '@dxos/errors';\nimport { invariant } from '@dxos/invariant';\n\nimport type * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport type * as PluginManager from './plugin-manager';\n\n//\n// Plugin Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing PluginManager via the Effect layer system.\n * This allows lifecycle operations to access the plugin manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/PluginManager')<Service, PluginManager.PluginManager>() {}\n\n//\n// Lifecycle Functions\n//\n\n/**\n * Activates plugins based on the activation event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\nexport const activate = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.activate(event));\n\n/**\n * Re-activates the modules that were activated by the event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\nexport const reset = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.reset(event));\n\n/**\n * Shuts down the plugin manager, deactivating all active modules and clearing lifecycle state.\n * Accesses the PluginManager via the Effect layer system.\n */\nexport const shutdown = (): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.shutdown());\n\n/**\n * Computes a module ID from plugin ID and export name.\n */\nconst computeModuleId = (pluginId: string, moduleName: string): string => {\n return `${pluginId}.module.${moduleName}`;\n};\n\n/**\n * Identifier denoting a PluginModule.\n */\nexport const PluginModuleTypeId: unique symbol = Symbol.for('@dxos/app-framework/PluginModule');\nexport type PluginModuleTypeId = typeof PluginModuleTypeId;\n\n/**\n * Type guard to check if a value is a PluginModule.\n */\nexport const isPluginModule = (value: unknown): value is PluginModule => {\n return typeof value === 'object' && value !== null && PluginModuleTypeId in value;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\nexport interface PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId;\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvent.Events;\n\n /**\n * Events that this module fires *before* its own activation runs.\n *\n * When this module is asked to activate (via {@link activatesOn}), the\n * plugin manager first activates every event listed here, ensuring any\n * other modules that contribute to those events have completed before\n * this module's {@link activate} body executes. These events are fired\n * by the framework on this module's behalf — the module does not need\n * to wait for some other code to fire them.\n *\n * The module is marked as needing reset if a module activated by one\n * of these events is later removed.\n *\n * Read as: \"this module fires these events before [its] activation\".\n */\n firesBeforeActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Events that this module fires *after* its own activation completes.\n *\n * Once this module's {@link activate} body has finished executing, the\n * plugin manager activates every event listed here, causing any modules\n * listening on those events to run. These events are fired by the\n * framework on this module's behalf as part of this module's lifecycle.\n *\n * Read as: \"this module fires these events after [its] activation\".\n */\n firesAfterActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * CapabilityManager is accessed via the Effect layer system (Capability.Service).\n * PluginManager is accessed via Plugin.Service.\n * @param props Optional props passed to the module.\n * @returns The capabilities of the module.\n */\n activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;\n}\n\nexport type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & { id?: string };\n\nclass PluginModuleImpl implements PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId = PluginModuleTypeId;\n readonly id: PluginModule['id'];\n readonly activatesOn: PluginModule['activatesOn'];\n readonly firesBeforeActivation?: PluginModule['firesBeforeActivation'];\n readonly firesAfterActivation?: PluginModule['firesAfterActivation'];\n readonly activate: PluginModule['activate'];\n\n constructor(options: Omit<PluginModule, typeof PluginModuleTypeId>) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.firesBeforeActivation = options.firesBeforeActivation;\n this.firesAfterActivation = options.firesAfterActivation;\n this.activate = options.activate;\n }\n}\n\nexport type Meta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example org.dxos.plugin.example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Name of the author or organization that created the plugin.\n */\n author?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n\n /**\n * Icon hue (ChromaticPalette).\n */\n iconHue?: string;\n};\n\n/**\n * Identifier denoting a Plugin.\n */\nexport const PluginTypeId: unique symbol = Symbol.for('@dxos/app-framework/Plugin');\nexport type PluginTypeId = typeof PluginTypeId;\n\n/**\n * Type guard to check if a value is a Plugin.\n */\nexport const isPlugin = (value: unknown): value is Plugin => {\n return typeof value === 'object' && value !== null && PluginTypeId in value;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\n// TODO(burdon): Convert to ECHO schema.\nexport interface Plugin {\n readonly [PluginTypeId]: PluginTypeId;\n readonly meta: Readonly<Meta>;\n readonly modules: ReadonlyArray<PluginModule>;\n}\n\n/**\n * Internal implementation of Plugin.\n * @internal\n */\nclass PluginImpl implements Plugin {\n readonly [PluginTypeId]: PluginTypeId = PluginTypeId;\n\n constructor(\n private readonly _meta: Meta,\n private readonly _modules: PluginModule[],\n ) {}\n\n get meta(): Readonly<Meta> {\n return this._meta;\n }\n\n get modules(): ReadonlyArray<PluginModule> {\n return this._modules;\n }\n}\n\n/**\n * Builder interface for creating plugins incrementally.\n */\nexport interface PluginBuilder<T = void> extends Pipeable.Pipeable {\n readonly meta: Meta;\n readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;\n}\n\n/**\n * Builder implementation for creating plugins incrementally.\n */\nclass PluginBuilderImpl<T = void> implements PluginBuilder<T> {\n readonly meta: Meta;\n private readonly _modules: Array<PluginModuleOptions | ((options: T) => PluginModuleOptions)> = [];\n\n constructor(meta: Meta) {\n this.meta = meta;\n }\n\n get modules(): ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)> {\n return this._modules;\n }\n\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T> {\n this._modules.push(moduleOptions);\n return this;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new PluginBuilder to start building a plugin.\n */\nexport const define = <T = void>(meta: Meta): PluginBuilder<T> => new PluginBuilderImpl<T>(meta);\n\n/**\n * Adds a module to a plugin builder.\n * Supports both pipeline and direct call styles.\n * Modules can be either PluginModuleOptions or functions that receive options.\n */\nexport function addModule<T>(\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): (builder: PluginBuilder<T>) => PluginBuilder<T>;\nexport function addModule<T>(\n builder: PluginBuilder<T>,\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): PluginBuilder<T>;\nexport function addModule<T>(\n moduleOptionsOrBuilder: PluginModuleOptions | ((options: T) => PluginModuleOptions) | PluginBuilder<T>,\n moduleOptions?: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): ((builder: PluginBuilder<T>) => PluginBuilder<T>) | PluginBuilder<T> {\n // If second arg is provided, it's the direct call style: addModule(builder, moduleOptions)\n if (moduleOptions !== undefined) {\n return (moduleOptionsOrBuilder as PluginBuilder<T>).addModule(moduleOptions);\n }\n // Otherwise it's pipeline style: addModule(moduleOptions) returns a function\n const moduleOpts = moduleOptionsOrBuilder as PluginModuleOptions | ((options: T) => PluginModuleOptions);\n return (builder: PluginBuilder<T>) => builder.addModule(moduleOpts);\n}\n\nexport type PluginFactory<T = void> = ((options: T) => Plugin) & { meta: Meta };\n\n/**\n * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.\n */\nconst resolveModule = (\n meta: Meta,\n module: PluginModuleOptions | ((options: any) => PluginModuleOptions),\n options?: any,\n): PluginModuleImpl => {\n const moduleOptions = typeof module === 'function' ? module(options) : module;\n const id = Option.fromNullable(moduleOptions.id).pipe(\n Option.match({\n onNone: () => {\n const exportName = Capability.getModuleTag(moduleOptions.activate);\n invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`);\n return computeModuleId(meta.id, exportName);\n },\n onSome: (id) => computeModuleId(meta.id, id),\n }),\n );\n return new PluginModuleImpl({ ...moduleOptions, id });\n};\n\n/**\n * Creates a Plugin from a builder.\n * Supports both pipeline and direct call styles.\n * Always returns a factory function (options: T) => Plugin.\n * When T is void, the function takes no arguments: () => Plugin.\n */\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {\n const meta = builder.meta;\n\n const factory = (options: T) => {\n const modules = builder.modules.map((module) => resolveModule(meta, module, options));\n return new PluginImpl(meta, modules);\n };\n\n return Object.assign(factory, { meta });\n}\n\n//\n// Lazy plugin loading\n//\n\n/**\n * Symbol used to tag lazy plugin stubs with their loader closure.\n * Hidden from enumeration so plugin manager iteration / serialization paths\n * don't trip over it.\n */\nconst LazyTag: unique symbol = Symbol.for('@dxos/app-framework/Plugin/Lazy');\n\n/**\n * Async loader for a lazy plugin's real implementation.\n * The default export of the loaded module must be a `PluginFactory<T>` —\n * i.e. the same shape `Plugin.make` produces.\n */\nexport type LazyLoader<T = void> = () => Promise<{ default: PluginFactory<T> }>;\n\n/** Internal: payload carried on a lazy stub. */\ntype LazyPayload = { loader: LazyLoader<any>; options: unknown };\n\n/**\n * Defines a lazy plugin whose body is loaded on first enable.\n *\n * The returned factory produces a stub `Plugin` that exposes `meta`\n * synchronously (so callers can read `Plugin.meta.id` for free) but defers\n * loading the real plugin's modules until the manager calls\n * `Plugin.resolveLazy`. This lets the plugin's main entry point ship as a\n * tiny meta-only chunk — the heavy capabilities, schema, React surfaces,\n * etc. live behind the dynamic `import()` and become a separate Rollup\n * chunk that is only fetched when the plugin is enabled.\n *\n * @example\n * ```ts\n * // plugin-markdown/src/index.ts\n * import { Plugin } from '@dxos/app-framework';\n * import { meta } from './meta';\n *\n * export const MarkdownPlugin = Plugin.lazy(meta, () => import('./MarkdownPlugin'));\n *\n * // plugin-markdown/src/MarkdownPlugin.tsx\n * export const MarkdownPlugin = Plugin.define(meta).pipe(...heavy modules..., Plugin.make);\n * export default MarkdownPlugin;\n * ```\n */\nexport const lazy = <T = void>(meta: Meta, loader: LazyLoader<T>): PluginFactory<T> => {\n const factory = (options: T): Plugin => {\n const stub = new PluginImpl(meta, []);\n Object.defineProperty(stub, LazyTag, {\n value: { loader, options } satisfies LazyPayload,\n enumerable: false,\n });\n return stub;\n };\n return Object.assign(factory, { meta });\n};\n\n/**\n * Type guard for lazy plugin stubs produced by {@link lazy}.\n */\nexport const isLazy = (plugin: Plugin): boolean => LazyTag in plugin;\n\n/**\n * Tagged error for failures during lazy plugin resolution. `context.id` is\n * the lazy plugin's `meta.id`; `context.reason` discriminates the failure\n * mode (`'load-failed' | 'missing-default' | 'invalid-plugin' |\n * 'meta-mismatch'`) so callers can route on it.\n */\nexport class LazyPluginError extends BaseError.extend('LazyPluginError', 'Failed to resolve lazy plugin') {}\n\n/**\n * Resolves a lazy plugin stub to its real plugin.\n * Returns the plugin unchanged if it is not lazy. Failures surface as\n * {@link LazyPluginError} with `context.reason` indicating the failure mode\n * and (for loader failures) `cause` set to the original error.\n */\nexport const resolveLazy = (plugin: Plugin): Effect.Effect<Plugin, LazyPluginError> =>\n Effect.gen(function* () {\n if (!isLazy(plugin)) {\n return plugin;\n }\n const id = plugin.meta.id;\n const { loader, options } = (plugin as unknown as { [LazyTag]: LazyPayload })[LazyTag];\n const mod = yield* Effect.tryPromise({\n try: loader,\n catch: (error) => new LazyPluginError({ context: { id, reason: 'load-failed' }, cause: error }),\n });\n if (!mod || typeof mod.default !== 'function') {\n return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'missing-default' } }));\n }\n const result = mod.default(options);\n if (!isPlugin(result)) {\n return yield* Effect.fail(new LazyPluginError({ context: { id, reason: 'invalid-plugin' } }));\n }\n if (result.meta.id !== id) {\n return yield* Effect.fail(\n new LazyPluginError({ context: { id, reason: 'meta-mismatch', returnedId: result.meta.id } }),\n );\n }\n return result;\n });\n"],
5
+ "mappings": ";;;;;;;;AAAA;;;;;;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAM1B,IAAE,eAAA;AAUA,IAAA,UAAA,cAAA,YAAA,mCAAA,EAAA,EAAA;AACF;;;;AAiCA,IAAA,kBAAA,CAAA,UAAA,eAAA;AAEA,SAAA,GAAA,QAAA,WAAA,UAAA;;;AAWE,IAAA,iBAAA,CAAA,UAAA;AA2DF,SAAMC,OAAAA,UAAAA,YAAAA,UAAAA,QAAAA,sBAAAA;;IAEKC,yBAAuB;EACvBC,CAAAA,kBAAyC,IAAA;EACzCC;EACAC;EACAC;EAET;;cAEOH,SAAW;AAChB,SAAKC,KAAAA,QAAAA;AACL,SAAKC,cAAAA,QAAoB;AACzB,SAAKC,wBAAmBA,QAAQ;AAClC,SAAA,uBAAA,QAAA;AACF,SAAA,WAAA,QAAA;EA0DA;;;AAWE,IAAA,WAAA,CAAA,UAAA;AAaF,SAAA,OAAA,UAAA,YAAA,UAAA,QAAA,gBAAA;;;EAKW;EAET;eACmBC,IAAAA;cACAC,OAAAA,UAAAA;AAChB,SAAA,QAAA;AAECC,SAAAA,WAAuB;;EAE3B,IAAA,OAAA;AAEIC,WAAAA,KAAuC;;EAE3C,IAAA,UAAA;AACF,WAAA,KAAA;EAWA;;AAKmBF,IAAAA,oBAAAA,MAAkF;EAEnG;aACOC,CAAAA;EACP,YAAA,MAAA;AAEIC,SAAAA,OAAsF;;EAE1F,IAAA,UAAA;AAEAC,WAAUC,KAAAA;;YAER,eAAW;AACb,SAAA,SAAA,KAAA,aAAA;AAEAC,WAAO;;SAEL;AAEJ,WAAA,uBAAA,MAAA,SAAA;EAEA;;AAqBE,IAAA,SAAA,CAAA,SAAA,IAAA,kBAAA,IAAA;AACA,SAAID,UAAkBE,wBAAW,eAAA;AAEjC,MAAA,kBAAA,QAAA;AACA,WAAA,uBAAA,UAAA,aAAA;EACA;AAEF,QAAA,aAAA;AAIA,SAAA,CAAA,YAAA,QAAA,UAAA,UAAA;;AASE,IAAMZ,gBAAYa,CAAAA,MAAAA,QAAaH,YAAgB;QAE3CI,gBAAQ,OAAA,WAAA,aAAA,OAAA,OAAA,IAAA;aACAC,oBAAaC,cAAWC,EAAAA,EAAAA,KAAaP,aAAcN;YACzDc,MAAAA;AACA,YAAA,aAA8B,aAAEH,cAAAA,QAAAA;AAClC,gBAAA,YAAA,uCAAA,KAAA,EAAA,IAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,KAAA,GAAA,QAAA,GAAA,CAAA,cAAA,kDAAA,EAAA,CAAA;AACAI,aAASnB,gBAAOoB,KAAgBb,IAAKP,UAAIA;IAC3C;IAEF,QAAWD,CAAAA,QAAAA,gBAAiB,KAAA,IAAAC,GAAA;;SAAoBA,IAAAA,iBAAAA;IAAG,GAAA;IACrD;EASA,CAAA;;AAGE,SAAMqB,KAAWC,SAAAA;QACf,OAAMd,QAAUe;QAChB,UAAWC,CAAAA,YAAWjB;AACxB,UAAA,UAAA,QAAA,QAAA,IAAA,CAAA,WAAA,cAAA,MAAA,QAAA,OAAA,CAAA;AAEA,WAAOkB,IAAOC,WAAOL,MAAS,OAAA;;AAAO,SAAA,OAAA,OAAA,SAAA;IACvC;EAEE,CAAA;AACF;;AA8CI,IAAMM,OAAO,CAAIH,MAAAA,WAAWjB;QAC5BkB,UAAOG,CAAAA,YAAeD;UACpBE,OAAO,IAAA,WAAA,MAAA,CAAA,CAAA;0BAAEC,MAAAA,SAAAA;aAAQR;QAAQ;QACzBS;MACF;MACA,YAAOJ;IACT,CAAA;AACA,WAAOF;;AAA8B,SAAA,OAAA,OAAA,SAAA;IACrC;EAEF,CAAA;;;AAaA,IAAA,kBAAA,cAAA,UAAA,OAAA,mBAAA,+BAAA,EAAA;;IASM,cAAOO,CAAAA,WAAAA,WAAAA,aAAAA;AACT,MAAA,CAAA,OAAA,MAAA,GAAA;AACA,WAAWA;EACX;AACA,QAAMC,KAAAA,OAAM,KAAOC;QACjBC,EAAAA,QAAKL,QAAAA,IAAAA,OAAAA,OAAAA;QACLM,MAAQC,OAAcC,kBAAAA;;sBAA6BtC,IAAAA,gBAAAA;eAAIuC;QAAsB;QAAGC,QAAOH;MAAM;MAC/F,OAAA;IACKJ,CAAAA;;cAC6CQ,OAAS,IAAA,YAAA,YAAA;kBAAEzC,YAAAA,IAAAA,gBAAAA;eAAIuC;QAA0B;QAAE,QAAA;MAC7F;IACA,CAAA,CAAMG;EACN;QACE,SAAO,IAAOR,QAAOS,OAASL;gBAAkBG,MAAS,GAAA;kBAAEzC,YAAAA,IAAAA,gBAAAA;eAAIuC;QAAyB;QAAE,QAAA;MAC5F;IACIG,CAAAA,CAAAA;;aAEsBD,KAAAA,OAAS,IAAA;kBAAEzC,YAAAA,IAAAA,gBAAAA;eAAIuC;QAAyBK;QAA2B,QAAA;QAAE,YAAA,OAAA,KAAA;MAE/F;IACA,CAAA,CAAA;EACC;;;",
6
+ "names": ["Context", "Effect", "Option", "Pipeable", "BaseError", "invariant", "PluginModuleImpl", "id", "activatesOn", "firesBeforeActivation", "firesAfterActivation", "activate", "_meta", "_modules", "meta", "modules", "addModule", "moduleOptions", "pipe", "undefined", "fromNullable", "onNone", "exportName", "Capability", "getModuleTag", "invariant", "onSome", "computeModuleId", "factory", "options", "builder", "PluginImpl", "Object", "assign", "stub", "defineProperty", "value", "loader", "enumerable", "plugin", "mod", "Effect", "try", "catch", "error", "LazyPluginError", "reason", "cause", "context", "result", "fail", "returnedId"]
7
+ }
@@ -1,16 +1,13 @@
1
1
  import {
2
2
  UndoOperation
3
- } from "./chunk-5RJNZV7K.mjs";
3
+ } from "./chunk-23D4SJUE.mjs";
4
4
  import {
5
5
  __export
6
6
  } from "./chunk-J5LGTIGS.mjs";
7
7
 
8
8
  // src/plugin-operation/history/errors.ts
9
- import { OperationError } from "@dxos/operation";
10
- var EmptyHistoryError = class extends OperationError {
11
- constructor() {
12
- super("EMPTY_HISTORY", "Cannot undo: history is empty.");
13
- }
9
+ import { BaseError } from "@dxos/errors";
10
+ var EmptyHistoryError = class extends BaseError.extend("EmptyHistoryError", "Cannot undo: history is empty.") {
14
11
  };
15
12
 
16
13
  // src/plugin-operation/history/undo-mapping.ts
@@ -75,12 +72,7 @@ var make3 = (invoker, undoRegistry) => {
75
72
  if (inverseInput === void 0) {
76
73
  log("operation not undoable", {
77
74
  key: event.operation.meta.key
78
- }, {
79
- F: __dxlog_file,
80
- L: 58,
81
- S: void 0,
82
- C: (f, a) => f(...a)
83
- });
75
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 29, S: void 0 });
84
76
  return;
85
77
  }
86
78
  const entry = {
@@ -95,12 +87,7 @@ var make3 = (invoker, undoRegistry) => {
95
87
  log("history entry added", {
96
88
  key: event.operation.meta.key,
97
89
  historyLength: history.length
98
- }, {
99
- F: __dxlog_file,
100
- L: 72,
101
- S: void 0,
102
- C: (f, a) => f(...a)
103
- });
90
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 43, S: void 0 });
104
91
  if (history.length > HISTORY_LIMIT) {
105
92
  history.splice(0, history.length - HISTORY_LIMIT);
106
93
  }
@@ -119,31 +106,16 @@ var make3 = (invoker, undoRegistry) => {
119
106
  log("undoing operation", {
120
107
  key: entry.operation.meta.key,
121
108
  inverseKey: entry.inverse.meta.key
122
- }, {
123
- F: __dxlog_file,
124
- L: 102,
125
- S: this,
126
- C: (f, a) => f(...a)
127
- });
109
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 65, S: this });
128
110
  yield* invoker._invokeCore(entry.inverse, entry.inverseInput);
129
111
  log("undo completed", {
130
112
  key: entry.operation.meta.key
131
- }, {
132
- F: __dxlog_file,
133
- L: 107,
134
- S: this,
135
- C: (f, a) => f(...a)
136
- });
113
+ }, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 71, S: this });
137
114
  });
138
115
  };
139
116
  const undoPromise = async () => {
140
117
  return runAndForwardErrors(undo()).then(() => ({})).catch((error) => {
141
- log.catch(error, void 0, {
142
- F: __dxlog_file,
143
- L: 115,
144
- S: void 0,
145
- C: (f, a) => f(...a)
146
- });
118
+ log.catch(error, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 78, S: void 0 });
147
119
  return {
148
120
  error
149
121
  };
@@ -167,4 +139,4 @@ export {
167
139
  make3 as make2,
168
140
  history_tracker_exports
169
141
  };
170
- //# sourceMappingURL=chunk-ZRWBPIZG.mjs.map
142
+ //# sourceMappingURL=chunk-ZGJAZSNE.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin-operation/history/errors.ts", "../../../src/plugin-operation/history/undo-mapping.ts", "../../../src/plugin-operation/history/undo-registry.ts", "../../../src/plugin-operation/history/history-tracker.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError } from '@dxos/errors';\n\nexport class EmptyHistoryError extends BaseError.extend('EmptyHistoryError', 'Cannot undo: history is empty.') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Operation } from '@dxos/compute';\n\n/**\n * Label type for translatable text (canonical definition in @dxos/app-toolkit).\n */\ntype Label = string | [string, { ns: string; count?: number; defaultValue?: string }];\n\n/**\n * Extract the input type from an OperationDefinition.\n */\nexport type InputOf<T> = T extends Operation.Definition<infer I, any> ? I : never;\n\n/**\n * Extract the output type from an OperationDefinition.\n */\nexport type OutputOf<T> = T extends Operation.Definition<any, infer O> ? O : never;\n\n/**\n * Message provider for undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\nexport type MessageProvider<Op extends Operation.Definition<any, any>> =\n | Label\n | ((input: InputOf<Op>, output: OutputOf<Op>) => Label);\n\n/**\n * Undo mapping that links a forward operation to its inverse.\n * Type parameters ensure deriveContext has correctly typed arguments.\n *\n * @template Op - The forward operation definition type.\n * @template Inv - The inverse operation definition type.\n */\nexport interface UndoMapping<\n Op extends Operation.Definition<any, any> = Operation.Definition<any, any>,\n Inv extends Operation.Definition<any, any> = Operation.Definition<any, any>,\n> {\n /** The forward operation. */\n readonly operation: Op;\n\n /** The inverse operation to invoke for undo. */\n readonly inverse: Inv;\n\n /**\n * Derives the input for the inverse operation from the forward operation's input and output.\n * @param input - The input that was passed to the forward operation.\n * @param output - The output that was returned by the forward operation.\n * @returns The input to pass to the inverse operation, or undefined to indicate the operation is not undoable.\n */\n readonly deriveContext: (input: InputOf<Op>, output: OutputOf<Op>) => InputOf<Inv> | undefined;\n\n /**\n * Optional message to show in the undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\n readonly message?: MessageProvider<Op>;\n}\n\n/**\n * Props for creating an UndoMapping.\n */\nexport interface UndoMappingProps<\n Op extends Operation.Definition<any, any>,\n Inv extends Operation.Definition<any, any>,\n> {\n /** The forward operation. */\n operation: Op;\n\n /** The inverse operation to invoke for undo. */\n inverse: Inv;\n\n /**\n * Derives the input for the inverse operation from the forward operation's input and output.\n * Return undefined to indicate the operation is not undoable.\n */\n deriveContext: (input: InputOf<Op>, output: OutputOf<Op>) => InputOf<Inv> | undefined;\n\n /**\n * Optional message to show in the undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\n message?: MessageProvider<Op>;\n}\n\n/**\n * Creates a type-safe undo mapping.\n *\n * @example\n * ```ts\n * // Static message\n * const mapping = UndoMapping.make({\n * operation: DeleteThread,\n * inverse: RestoreThread,\n * deriveContext: (input, output) => ({\n * thread: output.thread,\n * anchor: output.anchor,\n * }),\n * message: ['thread deleted label', { ns: '@dxos/plugin-thread' }],\n * });\n *\n * // Dynamic message based on input/output\n * const mapping = UndoMapping.make({\n * operation: RemoveObjects,\n * inverse: RestoreObjects,\n * deriveContext: (_input, output) => output,\n * message: (input, _output) =>\n * input.objects.length === 1\n * ? ['object deleted label', { ns: getTypename(input.objects[0]) }]\n * : ['objects deleted label', { ns: '@dxos/plugin-space' }],\n * });\n * ```\n */\nexport const make = <Op extends Operation.Definition<any, any>, Inv extends Operation.Definition<any, any>>(\n props: UndoMappingProps<Op, Inv>,\n): UndoMapping<Op, Inv> => props;\n\n/**\n * Resolves a message provider to a Label.\n */\nexport const resolveMessage = <Op extends Operation.Definition<any, any>>(\n message: MessageProvider<Op> | undefined,\n input: InputOf<Op>,\n output: OutputOf<Op>,\n): Label | undefined => {\n if (message === undefined) {\n return undefined;\n }\n if (typeof message === 'function') {\n return message(input, output);\n }\n return message;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Operation } from '@dxos/compute';\n\nimport type * as UndoMapping from './undo-mapping';\n\n//\n// Public Interface\n//\n\n/**\n * Lookup result from UndoRegistry.\n */\nexport type UndoMappingResult = {\n inverse: Operation.Definition<any, any>;\n /** Returns undefined to indicate the operation is not undoable. */\n deriveContext: (input: any, output: any) => any | undefined;\n /** Message provider - may be a static Label or a function. */\n message?: UndoMapping.MessageProvider<Operation.Definition<any, any>>;\n};\n\n/**\n * UndoRegistry interface - looks up inverse operations.\n */\nexport interface UndoRegistry {\n lookup: (operation: Operation.Definition<any, any>) => UndoMappingResult | undefined;\n}\n\n//\n// Factory\n//\n\n/**\n * Creates an UndoRegistry that looks up inverse operations.\n */\nexport const make = (getMappings: () => UndoMapping.UndoMapping[]): UndoRegistry => {\n const lookup = (operation: Operation.Definition<any, any>): UndoMappingResult | undefined => {\n const mappings = getMappings();\n const mapping = mappings.find((m) => m.operation.meta.key === operation.meta.key);\n if (!mapping) {\n return undefined;\n }\n\n return {\n inverse: mapping.inverse,\n deriveContext: mapping.deriveContext,\n message: mapping.message,\n };\n };\n\n return { lookup };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Stream from 'effect/Stream';\n\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { log } from '@dxos/log';\nimport { OperationInvoker } from '@dxos/operation';\n\nimport { UndoOperation } from '../../common';\nimport { EmptyHistoryError } from './errors';\nimport type { HistoryEntry } from './types';\nimport { resolveMessage } from './undo-mapping';\nimport type { UndoRegistry } from './undo-registry';\n\nconst HISTORY_LIMIT = 100;\n\n//\n// Public Interface\n//\n\n/**\n * HistoryTracker interface - tracks operation history and provides undo.\n */\nexport interface HistoryTracker {\n undo: () => Effect.Effect<void, Error>;\n undoPromise: () => Promise<{ error?: Error }>;\n canUndo: () => boolean;\n}\n\n//\n// Factory\n//\n\n/**\n * Creates a HistoryTracker that subscribes to invocation events and provides undo.\n */\nexport const make = (\n invoker: OperationInvoker.OperationInvokerInternal,\n undoRegistry: UndoRegistry,\n): HistoryTracker => {\n const history: HistoryEntry[] = [];\n\n // Subscribe to invocation stream.\n const handleInvocation = (event: OperationInvoker.InvocationEvent) => {\n const mapping = undoRegistry.lookup(event.operation);\n if (!mapping) {\n // Operation is not undoable, skip.\n return;\n }\n\n const inverseInput = mapping.deriveContext(event.input, event.output);\n if (inverseInput === undefined) {\n // Operation is conditionally not undoable (deriveContext returned undefined).\n log('operation not undoable', { key: event.operation.meta.key });\n return;\n }\n\n const entry: HistoryEntry = {\n operation: event.operation,\n input: event.input,\n output: event.output,\n inverse: mapping.inverse,\n inverseInput,\n timestamp: event.timestamp,\n };\n\n history.push(entry);\n log('history entry added', { key: event.operation.meta.key, historyLength: history.length });\n\n // Trim history if it exceeds limit.\n if (history.length > HISTORY_LIMIT) {\n history.splice(0, history.length - HISTORY_LIMIT);\n }\n\n // Show undo toast (resolve message if it's a function).\n const resolvedMessage = resolveMessage(mapping.message, event.input, event.output);\n Effect.runFork(\n invoker.invoke(UndoOperation.ShowUndo, {\n message: resolvedMessage,\n }),\n );\n };\n\n // Fork a fiber to consume the invocation stream.\n Effect.runFork(\n Stream.fromPubSub(invoker.invocations).pipe(\n Stream.runForEach((event) => Effect.sync(() => handleInvocation(event))),\n ),\n );\n\n const undo = (): Effect.Effect<void, Error> => {\n return Effect.gen(function* () {\n const entry = history.pop();\n if (!entry) {\n return yield* Effect.fail(new EmptyHistoryError());\n }\n\n log('undoing operation', { key: entry.operation.meta.key, inverseKey: entry.inverse.meta.key });\n\n // Use _invokeCore to skip event emission (avoid undo-of-undo loops).\n yield* invoker._invokeCore(entry.inverse, entry.inverseInput);\n\n log('undo completed', { key: entry.operation.meta.key });\n });\n };\n\n const undoPromise = async (): Promise<{ error?: Error }> => {\n return runAndForwardErrors(undo())\n .then(() => ({}))\n .catch((error) => {\n log.catch(error);\n return { error };\n });\n };\n\n const canUndo = (): boolean => {\n return history.length > 0;\n };\n\n return {\n undo,\n undoPromise,\n canUndo,\n };\n};\n"],
5
+ "mappings": "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",
6
+ "names": ["BaseError", "EmptyHistoryError", "extend", "make", "props", "resolveMessage", "message", "input", "output", "undefined", "make", "getMappings", "lookup", "operation", "mappings", "mapping", "find", "m", "meta", "key", "undefined", "inverse", "deriveContext", "message", "make", "Effect", "Stream", "runAndForwardErrors", "log", "HISTORY_LIMIT", "make", "handleInvocation", "log", "input", "event", "output", "inverse", "mapping", "inverseInput", "timestamp", "history", "entry", "key", "operation", "historyLength", "length", "message", "resolvedMessage", "Effect", "fail", "inverseKey", "invoker", "_invokeCore", "meta", "error", "undoPromise", "canUndo"]
7
+ }
@@ -1,21 +1,22 @@
1
- import "../chunk-5RJNZV7K.mjs";
1
+ import "../chunk-23D4SJUE.mjs";
2
2
  import {
3
3
  capabilities_exports
4
- } from "../chunk-REORGDJT.mjs";
4
+ } from "../chunk-WBHCSOBW.mjs";
5
5
  import {
6
6
  activation_events_exports
7
- } from "../chunk-NPUEVX42.mjs";
8
- import "../chunk-YAFEA4GV.mjs";
7
+ } from "../chunk-45CHLTBV.mjs";
8
+ import "../chunk-FO3IYSLV.mjs";
9
+ import "../chunk-CZ4BIAHH.mjs";
9
10
  import {
10
11
  plugin_manager_exports
11
- } from "../chunk-HE27PNNQ.mjs";
12
- import "../chunk-PKQT6C53.mjs";
12
+ } from "../chunk-NBXPP7JR.mjs";
13
+ import "../chunk-66IXTIVK.mjs";
13
14
  import {
14
15
  plugin_exports
15
- } from "../chunk-FNKT2QQ2.mjs";
16
+ } from "../chunk-Z55LVAGN.mjs";
16
17
  import {
17
18
  capability_exports
18
- } from "../chunk-YNFPIQGB.mjs";
19
+ } from "../chunk-3JWJXGLK.mjs";
19
20
  import "../chunk-J5LGTIGS.mjs";
20
21
 
21
22
  // src/cli/cli.ts
@@ -26,16 +27,10 @@ import { invariant } from "@dxos/invariant";
26
27
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/cli/cli.ts";
27
28
  var defaultPluginLoader = (plugins) => (id) => Effect.sync(() => {
28
29
  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;
30
+ invariant(plugin, `Plugin not found: ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 12, S: void 0, A: ["plugin", "`Plugin not found: ${id}`"] });
31
+ return {
32
+ plugin
33
+ };
39
34
  });
40
35
  var createCliApp = Effect.fn(function* ({ rootCommand, subCommands: subCommandsProp, pluginManager: pluginManagerProp, pluginLoader: pluginLoaderProp, plugins: pluginsProp = [], core: coreProp, enabled: enabledProp = [], safeMode = false }) {
41
36
  const plugins = pluginsProp;
@@ -51,12 +46,12 @@ var createCliApp = Effect.fn(function* ({ rootCommand, subCommands: subCommandsP
51
46
  manager.capabilities.contribute({
52
47
  interface: capabilities_exports.PluginManager,
53
48
  implementation: manager,
54
- module: "dxos.org/app-framework/plugin-manager"
49
+ module: "org.dxos.app-framework.plugin-manager"
55
50
  });
56
51
  manager.capabilities.contribute({
57
52
  interface: capabilities_exports.AtomRegistry,
58
53
  implementation: manager.registry,
59
- module: "dxos.org/app-framework/atom-registry"
54
+ module: "org.dxos.app-framework.atom-registry"
60
55
  });
61
56
  yield* manager.activate(activation_events_exports.Startup);
62
57
  const layers = manager.capabilities.getAll(capabilities_exports.Layer);
@@ -68,15 +63,7 @@ var createCliApp = Effect.fn(function* ({ rootCommand, subCommands: subCommandsP
68
63
  ...subCommandsProp,
69
64
  ...pluginCommands
70
65
  ] : 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
- });
66
+ invariant(subCommands.length > 0, "No subcommands provided", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 66, S: this, A: ["subCommands.length > 0", "'No subcommands provided'"] });
80
67
  const command = rootCommand.pipe(Command.withSubcommands(subCommands));
81
68
  return {
82
69
  command,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
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: 'dxos.org/app-framework/plugin-manager',\n });\n\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'dxos.org/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.withSubcommands(subCommands as SubCommands));\n\n return { command, layer };\n});\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AAEvB,SAASC,iBAAiB;;AAK1B,IAAMC,sBACJ,CAACC,YACD,CAACC,OACQC,YAAK,MAAA;AACV,QAAMC,SAASH,QAAQI,KAAK,CAACD,YAAWA,QAAOE,KAAKJ,OAAOA,EAAAA;AAC3DK,YAAUH,QAAQ,qBAAqBF,EAAAA,IAAI;;;;;;;;;AAC3C,SAAOE;AACT,CAAA;AA+BG,IAAMI,eAAsBC,UAAG,WAAW,EAC/CC,aACAC,aAAaC,iBACbC,eAAeC,mBACfC,cAAcC,kBACdf,SAASgB,cAAc,CAAA,GACvBC,MAAMC,UACNC,SAASC,cAAc,CAAA,GACvBC,WAAW,MAAK,GACI;AACpB,QAAMrB,UAAUgB;AAChB,QAAMC,OAAOC,YAAYlB,QAAQsB,IAAI,CAAC,EAAEjB,KAAI,MAAOA,KAAKJ,EAAE;AAC1D,QAAMa,eAAeC,oBAAoBhB,oBAAoBC,OAAAA;AAC7D,QAAMmB,UAAUE,WAAW,CAAA,IAAKD;AAChC,QAAMG,UACJV,qBACAW,uBAAcC,KAAK;IACjBX;IACAd;IACAiB;IACAE;EACF,CAAA;AAEFI,UAAQG,aAAaC,WAAW;IAC9BC,WAAWC,qBAAaL;IACxBM,gBAAgBP;IAChBQ,QAAQ;EACV,CAAA;AAEAR,UAAQG,aAAaC,WAAW;IAC9BC,WAAWC,qBAAaG;IACxBF,gBAAgBP,QAAQU;IACxBF,QAAQ;EACV,CAAA;AAGA,SAAOR,QAAQW,SAASC,0BAAiBC,OAAO;AAGhD,QAAMC,SAASd,QAAQG,aAAaY,OAAOT,qBAAaU,KAAK;AAC7D,QAAMC,yBAA+BC,cAAQC,mBAAWC,SAASpB,QAAQG,YAAY;AACrF,QAAMkB,qBAA2BH,cAAQI,eAAOF,SAASpB,OAAAA;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"]
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.withSubcommands(subCommands as SubCommands));\n\n return { command, layer };\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AAEvB,SAASC,iBAAiB;AAK1B,IAAA,eAAMC;0BAKUC,CAAAA,YAAS,CAAA,OAAoBC,YAAI,MAAA;AAC3C,QAAA,SAAO,QAAA,KAAA,CAAAD,YAAAA,QAAA,KAAA,OAAA,EAAA;YAAEA,QAAAA,qBAAAA,EAAAA,IAAAA,EAAAA,YAAAA,YAAAA,GAAAA,cAAAA,GAAAA,IAAAA,GAAAA,QAAAA,GAAAA,CAAAA,UAAAA,2BAAAA,EAAAA,CAAAA;AAAO,SAAA;IAClB;EAeJ;;AA2BQE,IAAOC,eAAoBC,UAAK,WAAQ,EAAKC,aAAO,aAAA,iBAAA,eAAA,mBAAA,cAAA,kBAAA,SAAA,cAAA,CAAA,GAAA,MAAA,UAAA,SAAA,cAAA,CAAA,GAAA,WAAA,MAAA,GAAA;AAC1D,QAAMC,UAAAA;AACN,QAAMC,OAAAA,YAAUC,QAAgBC,IAAAA,CAAAA,EAAAA,KAAAA,MAAAA,KAAAA,EAAAA;AAChC,QAAMC,eACJC,oBACAC,oBAAmB,OAAA;QACjBN,UAAAA,WAAAA,CAAAA,IAAAA;QACAO,UAAAA,qBAAAA,uBAAAA,KAAAA;IACAX;IACAK;IACF;IAEFG;;UAEEI,aAAgBJ,WAAAA;IAChBK,WAAQ,qBAAA;IACV,gBAAA;IAEAL,QAAQM;;UAENF,aAAgBJ,WAAQO;IACxBF,WAAQ,qBAAA;IACV,gBAAA,QAAA;IAEA,QAAA;EACA,CAAA;AAGA,SAAMG,QAASR,SAAQM,0BAAaG,OAAOC;AAE3C,QAAMC,SAAAA,QAAAA,aAA2BC,OAAQC,qBAAc,KAAEb;AACzD,QAAMc,yBACJC,cAAAA,mBACAJ,SAAAA,QAAAA,YACGH;AAGL,QAAA,qBAAA,cAAA,eAAA,SAAA,OAA4D;AAC5D,QAAMQ,QAAAA,eAAiBhB,wBAA4BU,oBAAoB,GAAA,MAAA;yBAC7BO,QAAAA,aAAAA,OAAAA,qBAAAA,OAAAA;sBAAoBD,kBAAAA;IAAkBA,GAAAA;IAChFE,GAAAA;EACA,IAAA;AAEA,YAAO,YAAA,SAAA,GAAA,2BAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,MAAA,GAAA,CAAA,0BAAA,2BAAA,EAAA,CAAA;QAAEC,UAAAA,YAAAA,KAAAA,wBAAAA,WAAAA,CAAAA;SAASL;IAAM;IACvB;;;",
6
+ "names": ["Command", "Effect", "Layer", "invariant", "defaultPluginLoader", "plugin", "id", "core", "coreProp", "map", "meta", "pluginLoader", "enabled", "safeMode", "enabledProp", "manager", "pluginManagerProp", "PluginManager", "plugins", "implementation", "module", "capabilities", "registry", "layers", "getAll", "Capabilities", "pluginServiceLayer", "succeed", "Plugin", "layer", "capabilityServiceLayer", "pluginCommands", "subCommandsProp", "invariant", "command"]
7
7
  }
@@ -2,21 +2,22 @@ import {
2
2
  ManagedRuntimeReady,
3
3
  OperationInvokerReady,
4
4
  SetupLayer,
5
- SetupOperationResolver,
5
+ SetupOperationHandler,
6
6
  SetupReactSurface,
7
7
  Startup
8
- } from "../chunk-NPUEVX42.mjs";
9
- import "../chunk-YAFEA4GV.mjs";
10
- import "../chunk-HE27PNNQ.mjs";
11
- import "../chunk-PKQT6C53.mjs";
12
- import "../chunk-FNKT2QQ2.mjs";
13
- import "../chunk-YNFPIQGB.mjs";
8
+ } from "../chunk-45CHLTBV.mjs";
9
+ import "../chunk-FO3IYSLV.mjs";
10
+ import "../chunk-CZ4BIAHH.mjs";
11
+ import "../chunk-NBXPP7JR.mjs";
12
+ import "../chunk-66IXTIVK.mjs";
13
+ import "../chunk-Z55LVAGN.mjs";
14
+ import "../chunk-3JWJXGLK.mjs";
14
15
  import "../chunk-J5LGTIGS.mjs";
15
16
  export {
16
17
  ManagedRuntimeReady,
17
18
  OperationInvokerReady,
18
19
  SetupLayer,
19
- SetupOperationResolver,
20
+ SetupOperationHandler,
20
21
  SetupReactSurface,
21
22
  Startup
22
23
  };
@@ -5,8 +5,8 @@ import {
5
5
  Layer,
6
6
  ManagedRuntime,
7
7
  Null,
8
+ OperationHandler,
8
9
  OperationInvoker,
9
- OperationResolver,
10
10
  PluginManager,
11
11
  ReactContext,
12
12
  ReactRoot,
@@ -16,12 +16,13 @@ import {
16
16
  getAtomValue,
17
17
  subscribeAtom,
18
18
  updateAtomValue
19
- } from "../chunk-REORGDJT.mjs";
20
- import "../chunk-YAFEA4GV.mjs";
21
- import "../chunk-HE27PNNQ.mjs";
22
- import "../chunk-PKQT6C53.mjs";
23
- import "../chunk-FNKT2QQ2.mjs";
24
- import "../chunk-YNFPIQGB.mjs";
19
+ } from "../chunk-WBHCSOBW.mjs";
20
+ import "../chunk-FO3IYSLV.mjs";
21
+ import "../chunk-CZ4BIAHH.mjs";
22
+ import "../chunk-NBXPP7JR.mjs";
23
+ import "../chunk-66IXTIVK.mjs";
24
+ import "../chunk-Z55LVAGN.mjs";
25
+ import "../chunk-3JWJXGLK.mjs";
25
26
  import "../chunk-J5LGTIGS.mjs";
26
27
  export {
27
28
  AtomRegistry,
@@ -30,8 +31,8 @@ export {
30
31
  Layer,
31
32
  ManagedRuntime,
32
33
  Null,
34
+ OperationHandler,
33
35
  OperationInvoker,
34
- OperationResolver,
35
36
  PluginManager,
36
37
  ReactContext,
37
38
  ReactRoot,
@@ -6,7 +6,7 @@ import {
6
6
  isOneOf,
7
7
  make,
8
8
  oneOf
9
- } from "../chunk-PKQT6C53.mjs";
9
+ } from "../chunk-66IXTIVK.mjs";
10
10
  import "../chunk-J5LGTIGS.mjs";
11
11
  export {
12
12
  allOf,
@@ -2,6 +2,7 @@ import {
2
2
  ModuleTag,
3
3
  Service,
4
4
  atom,
5
+ atomByModule,
5
6
  contributes,
6
7
  get,
7
8
  getAll,
@@ -10,12 +11,13 @@ import {
10
11
  make,
11
12
  makeModule,
12
13
  waitFor
13
- } from "../chunk-YNFPIQGB.mjs";
14
+ } from "../chunk-3JWJXGLK.mjs";
14
15
  import "../chunk-J5LGTIGS.mjs";
15
16
  export {
16
17
  ModuleTag,
17
18
  Service,
18
19
  atom,
20
+ atomByModule,
19
21
  contributes,
20
22
  get,
21
23
  getAll,
@@ -1,14 +1,18 @@
1
1
  import {
2
2
  ManagerTypeId,
3
+ PluginInitializationError,
4
+ PluginTimeoutError,
3
5
  isManager,
4
6
  make
5
- } from "../chunk-HE27PNNQ.mjs";
6
- import "../chunk-PKQT6C53.mjs";
7
- import "../chunk-FNKT2QQ2.mjs";
8
- import "../chunk-YNFPIQGB.mjs";
7
+ } from "../chunk-NBXPP7JR.mjs";
8
+ import "../chunk-66IXTIVK.mjs";
9
+ import "../chunk-Z55LVAGN.mjs";
10
+ import "../chunk-3JWJXGLK.mjs";
9
11
  import "../chunk-J5LGTIGS.mjs";
10
12
  export {
11
13
  ManagerTypeId,
14
+ PluginInitializationError,
15
+ PluginTimeoutError,
12
16
  isManager,
13
17
  make
14
18
  };