@dxos/app-framework 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (294) hide show
  1. package/.storybook/main.mts +1 -1
  2. package/.storybook/preview.mts +2 -2
  3. package/CHANGELOG.md +93 -0
  4. package/TASKS.md +11 -0
  5. package/dist/lib/chunk-SurfaceManager.mjs +960 -0
  6. package/dist/lib/chunk-SurfaceManager.mjs.map +1 -0
  7. package/dist/lib/chunk-capability.mjs +15 -0
  8. package/dist/lib/chunk-capability.mjs.map +1 -0
  9. package/dist/lib/{browser/chunk-FJ4765WW.mjs → chunk-context.mjs} +4 -5
  10. package/dist/lib/chunk-context.mjs.map +1 -0
  11. package/dist/lib/chunk-history-tracker.mjs +160 -0
  12. package/dist/lib/chunk-history-tracker.mjs.map +1 -0
  13. package/dist/lib/chunk-plugin-manager.mjs +1390 -0
  14. package/dist/lib/chunk-plugin-manager.mjs.map +1 -0
  15. package/dist/lib/chunk-plugin-manifest.mjs +125 -0
  16. package/dist/lib/chunk-plugin-manifest.mjs.map +1 -0
  17. package/dist/lib/chunk-process-manager-capability.mjs +126 -0
  18. package/dist/lib/chunk-process-manager-capability.mjs.map +1 -0
  19. package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
  20. package/dist/lib/chunk-url-loader.mjs +347 -0
  21. package/dist/lib/chunk-url-loader.mjs.map +1 -0
  22. package/dist/lib/cli.mjs +78 -0
  23. package/dist/lib/cli.mjs.map +1 -0
  24. package/dist/lib/common/activation-events.mjs +35 -0
  25. package/dist/lib/common/activation-events.mjs.map +1 -0
  26. package/dist/lib/common/capabilities.mjs +184 -0
  27. package/dist/lib/common/capabilities.mjs.map +1 -0
  28. package/dist/lib/config.mjs +2 -0
  29. package/dist/lib/core/activation-event.mjs +55 -0
  30. package/dist/lib/core/activation-event.mjs.map +1 -0
  31. package/dist/lib/core/capability.mjs +189 -0
  32. package/dist/lib/core/capability.mjs.map +1 -0
  33. package/dist/lib/core/plugin-manager.mjs +2 -0
  34. package/dist/lib/core/plugin.mjs +340 -0
  35. package/dist/lib/core/plugin.mjs.map +1 -0
  36. package/dist/lib/core/url-loader.mjs +2 -0
  37. package/dist/lib/index.mjs +134 -0
  38. package/dist/lib/index.mjs.map +1 -0
  39. package/dist/lib/testing/react.mjs +70 -0
  40. package/dist/lib/testing/react.mjs.map +1 -0
  41. package/dist/lib/testing.mjs +399 -0
  42. package/dist/lib/testing.mjs.map +1 -0
  43. package/dist/lib/ui.mjs +636 -0
  44. package/dist/lib/ui.mjs.map +1 -0
  45. package/dist/lib/vite-plugin.mjs +986 -0
  46. package/dist/lib/vite-plugin.mjs.map +1 -0
  47. package/dist/plugin/node-esm/index.mjs +4 -3
  48. package/dist/plugin/node-esm/index.mjs.map +3 -3
  49. package/dist/plugin/node-esm/meta.json +1 -1
  50. package/dist/types/src/common/Role.d.ts +31 -0
  51. package/dist/types/src/common/Role.d.ts.map +1 -0
  52. package/dist/types/src/common/Role.test.d.ts +2 -0
  53. package/dist/types/src/common/Role.test.d.ts.map +1 -0
  54. package/dist/types/src/common/capabilities.d.ts +11 -2
  55. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  56. package/dist/types/src/common/index.d.ts +1 -0
  57. package/dist/types/src/common/index.d.ts.map +1 -1
  58. package/dist/types/src/core/capability-manager.d.ts +1 -1
  59. package/dist/types/src/core/capability-manager.d.ts.map +1 -1
  60. package/dist/types/src/core/capability.d.ts +38 -5
  61. package/dist/types/src/core/capability.d.ts.map +1 -1
  62. package/dist/types/src/core/plugin-manager.d.ts +1 -1
  63. package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
  64. package/dist/types/src/core/plugin.d.ts +14 -1
  65. package/dist/types/src/core/plugin.d.ts.map +1 -1
  66. package/dist/types/src/core/registry.d.ts +1 -1
  67. package/dist/types/src/core/registry.d.ts.map +1 -1
  68. package/dist/types/src/plugin-process-manager/history/capability.d.ts +1 -1
  69. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +1 -1
  70. package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -1
  71. package/dist/types/src/testing/StorybookErrorFallback.d.ts +15 -0
  72. package/dist/types/src/testing/StorybookErrorFallback.d.ts.map +1 -0
  73. package/dist/types/src/testing/harness.d.ts +1 -1
  74. package/dist/types/src/testing/harness.d.ts.map +1 -1
  75. package/dist/types/src/testing/index.d.ts +2 -0
  76. package/dist/types/src/testing/index.d.ts.map +1 -1
  77. package/dist/types/src/testing/react.d.ts +4 -4
  78. package/dist/types/src/testing/react.d.ts.map +1 -1
  79. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  80. package/dist/types/src/testing/withPluginManager.stories.d.ts +6 -0
  81. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  82. package/dist/types/src/testing/withSurfaceDebug.d.ts +10 -0
  83. package/dist/types/src/testing/withSurfaceDebug.d.ts.map +1 -0
  84. package/dist/types/src/ui/components/App/App.d.ts +0 -32
  85. package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
  86. package/dist/types/src/ui/components/App/index.d.ts +1 -0
  87. package/dist/types/src/ui/components/App/index.d.ts.map +1 -1
  88. package/dist/types/src/ui/components/App/loader.d.ts +35 -0
  89. package/dist/types/src/ui/components/App/loader.d.ts.map +1 -0
  90. package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts +26 -0
  91. package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts.map +1 -0
  92. package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts +15 -0
  93. package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts.map +1 -0
  94. package/dist/types/src/ui/components/HomeSection/index.d.ts +2 -0
  95. package/dist/types/src/ui/components/HomeSection/index.d.ts.map +1 -0
  96. package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts +14 -0
  97. package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts.map +1 -0
  98. package/dist/types/src/ui/components/NamePopover/index.d.ts +2 -0
  99. package/dist/types/src/ui/components/NamePopover/index.d.ts.map +1 -0
  100. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +21 -9
  101. package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
  102. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts +4 -1
  103. package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
  104. package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts +2 -0
  105. package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts.map +1 -0
  106. package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts +40 -0
  107. package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts.map +1 -0
  108. package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts +23 -0
  109. package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts.map +1 -0
  110. package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts +11 -0
  111. package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts.map +1 -0
  112. package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts +72 -0
  113. package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts.map +1 -0
  114. package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
  115. package/dist/types/src/ui/components/Surface/index.d.ts +20 -25
  116. package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
  117. package/dist/types/src/ui/components/Surface/types.d.ts +56 -52
  118. package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
  119. package/dist/types/src/ui/components/index.d.ts +2 -0
  120. package/dist/types/src/ui/components/index.d.ts.map +1 -1
  121. package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
  122. package/dist/types/tsconfig.tsbuildinfo +1 -1
  123. package/moon.yml +25 -18
  124. package/package.json +58 -73
  125. package/src/common/Role.test.ts +41 -0
  126. package/src/common/Role.ts +54 -0
  127. package/src/common/capabilities.ts +17 -2
  128. package/src/common/index.ts +1 -0
  129. package/src/core/capability-manager.test.ts +1 -1
  130. package/src/core/capability-manager.ts +1 -1
  131. package/src/core/capability.ts +45 -6
  132. package/src/core/plugin-manager.test.ts +38 -3
  133. package/src/core/plugin-manager.ts +18 -1
  134. package/src/core/plugin.ts +16 -1
  135. package/src/core/registry.ts +1 -1
  136. package/src/plugin-process-manager/process-manager-capability.ts +25 -2
  137. package/src/testing/StorybookErrorFallback.tsx +40 -0
  138. package/src/testing/harness.ts +1 -1
  139. package/src/testing/index.ts +2 -0
  140. package/src/testing/react.test.tsx +2 -1
  141. package/src/testing/react.tsx +14 -8
  142. package/src/testing/withPluginManager.stories.tsx +16 -1
  143. package/src/testing/withPluginManager.tsx +13 -2
  144. package/src/testing/withSurfaceDebug.tsx +22 -0
  145. package/src/ui/components/App/App.tsx +7 -35
  146. package/src/ui/components/App/index.ts +1 -0
  147. package/src/ui/components/App/loader.ts +39 -0
  148. package/src/ui/components/HomeSection/HomeSection.stories.tsx +43 -0
  149. package/src/ui/components/HomeSection/HomeSection.tsx +69 -0
  150. package/src/ui/components/HomeSection/index.ts +5 -0
  151. package/src/ui/components/NamePopover/NamePopover.tsx +70 -0
  152. package/src/ui/components/NamePopover/index.ts +5 -0
  153. package/src/ui/components/Surface/DESIGN.md +136 -0
  154. package/src/ui/components/Surface/SurfaceComponent.stories.tsx +70 -41
  155. package/src/ui/components/Surface/SurfaceComponent.test.tsx +403 -0
  156. package/src/ui/components/Surface/SurfaceComponent.tsx +209 -189
  157. package/src/ui/components/Surface/SurfaceDebug.tsx +435 -0
  158. package/src/ui/components/Surface/SurfaceManager.ts +95 -0
  159. package/src/ui/components/Surface/SurfaceManagerContext.ts +23 -0
  160. package/src/ui/components/Surface/SurfaceMetrics.ts +202 -0
  161. package/src/ui/components/Surface/SurfaceProfilerContext.tsx +12 -2
  162. package/src/ui/components/Surface/index.ts +24 -22
  163. package/src/ui/components/Surface/types.test.ts +47 -54
  164. package/src/ui/components/Surface/types.ts +66 -91
  165. package/src/ui/components/index.ts +2 -0
  166. package/src/ui/hooks/useApp.tsx +7 -3
  167. package/src/vite-plugin/boot-loader/loader-app/boot-loader.css +1 -1
  168. package/tsconfig.json +3 -0
  169. package/vite.config.ts +26 -0
  170. package/dist/lib/browser/capability-S44TE2H7.mjs +0 -35
  171. package/dist/lib/browser/capability-S44TE2H7.mjs.map +0 -7
  172. package/dist/lib/browser/chunk-3NQLTQCP.mjs +0 -47
  173. package/dist/lib/browser/chunk-3NQLTQCP.mjs.map +0 -7
  174. package/dist/lib/browser/chunk-53HJHMS5.mjs +0 -7
  175. package/dist/lib/browser/chunk-53HJHMS5.mjs.map +0 -7
  176. package/dist/lib/browser/chunk-FJ4765WW.mjs.map +0 -7
  177. package/dist/lib/browser/chunk-J5LGTIGS.mjs +0 -10
  178. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +0 -7
  179. package/dist/lib/browser/chunk-KRJ4KK2W.mjs +0 -505
  180. package/dist/lib/browser/chunk-KRJ4KK2W.mjs.map +0 -7
  181. package/dist/lib/browser/chunk-LUH4Y5F2.mjs +0 -430
  182. package/dist/lib/browser/chunk-LUH4Y5F2.mjs.map +0 -7
  183. package/dist/lib/browser/chunk-NKVRSMFN.mjs +0 -95
  184. package/dist/lib/browser/chunk-NKVRSMFN.mjs.map +0 -7
  185. package/dist/lib/browser/chunk-OO53M5UK.mjs +0 -260
  186. package/dist/lib/browser/chunk-OO53M5UK.mjs.map +0 -7
  187. package/dist/lib/browser/chunk-OPTS3ZSN.mjs +0 -83
  188. package/dist/lib/browser/chunk-OPTS3ZSN.mjs.map +0 -7
  189. package/dist/lib/browser/chunk-Q2GLJTVV.mjs +0 -12
  190. package/dist/lib/browser/chunk-Q2GLJTVV.mjs.map +0 -7
  191. package/dist/lib/browser/chunk-SYXIYT6T.mjs +0 -143
  192. package/dist/lib/browser/chunk-SYXIYT6T.mjs.map +0 -7
  193. package/dist/lib/browser/chunk-U5MESPM5.mjs +0 -603
  194. package/dist/lib/browser/chunk-U5MESPM5.mjs.map +0 -7
  195. package/dist/lib/browser/chunk-UGYCLOXE.mjs +0 -1471
  196. package/dist/lib/browser/chunk-UGYCLOXE.mjs.map +0 -7
  197. package/dist/lib/browser/chunk-VF37YTXJ.mjs +0 -28
  198. package/dist/lib/browser/chunk-VF37YTXJ.mjs.map +0 -7
  199. package/dist/lib/browser/chunk-YUVQIOTB.mjs +0 -60
  200. package/dist/lib/browser/chunk-YUVQIOTB.mjs.map +0 -7
  201. package/dist/lib/browser/cli/index.mjs +0 -74
  202. package/dist/lib/browser/cli/index.mjs.map +0 -7
  203. package/dist/lib/browser/common/activation-events.mjs +0 -20
  204. package/dist/lib/browser/common/activation-events.mjs.map +0 -7
  205. package/dist/lib/browser/common/capabilities.mjs +0 -56
  206. package/dist/lib/browser/common/capabilities.mjs.map +0 -7
  207. package/dist/lib/browser/config/index.mjs +0 -8
  208. package/dist/lib/browser/config/index.mjs.map +0 -7
  209. package/dist/lib/browser/core/activation-event.mjs +0 -20
  210. package/dist/lib/browser/core/activation-event.mjs.map +0 -7
  211. package/dist/lib/browser/core/capability.mjs +0 -32
  212. package/dist/lib/browser/core/capability.mjs.map +0 -7
  213. package/dist/lib/browser/core/plugin-manager.mjs +0 -19
  214. package/dist/lib/browser/core/plugin-manager.mjs.map +0 -7
  215. package/dist/lib/browser/core/plugin.mjs +0 -51
  216. package/dist/lib/browser/core/plugin.mjs.map +0 -7
  217. package/dist/lib/browser/core/url-loader.mjs +0 -24
  218. package/dist/lib/browser/core/url-loader.mjs.map +0 -7
  219. package/dist/lib/browser/index.mjs +0 -98
  220. package/dist/lib/browser/index.mjs.map +0 -7
  221. package/dist/lib/browser/meta.json +0 -1
  222. package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs +0 -132
  223. package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs.map +0 -7
  224. package/dist/lib/browser/testing/index.mjs +0 -359
  225. package/dist/lib/browser/testing/index.mjs.map +0 -7
  226. package/dist/lib/browser/testing/react.mjs +0 -78
  227. package/dist/lib/browser/testing/react.mjs.map +0 -7
  228. package/dist/lib/browser/ui/index.mjs +0 -60
  229. package/dist/lib/browser/ui/index.mjs.map +0 -7
  230. package/dist/lib/node-esm/capability-3YRF77LV.mjs +0 -36
  231. package/dist/lib/node-esm/capability-3YRF77LV.mjs.map +0 -7
  232. package/dist/lib/node-esm/chunk-2UPUZXGU.mjs +0 -9
  233. package/dist/lib/node-esm/chunk-2UPUZXGU.mjs.map +0 -7
  234. package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +0 -10
  235. package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +0 -7
  236. package/dist/lib/node-esm/chunk-4SE7SX7N.mjs +0 -261
  237. package/dist/lib/node-esm/chunk-4SE7SX7N.mjs.map +0 -7
  238. package/dist/lib/node-esm/chunk-BMW6P6QA.mjs +0 -48
  239. package/dist/lib/node-esm/chunk-BMW6P6QA.mjs.map +0 -7
  240. package/dist/lib/node-esm/chunk-COHOWGGJ.mjs +0 -144
  241. package/dist/lib/node-esm/chunk-COHOWGGJ.mjs.map +0 -7
  242. package/dist/lib/node-esm/chunk-DRT75WGD.mjs +0 -604
  243. package/dist/lib/node-esm/chunk-DRT75WGD.mjs.map +0 -7
  244. package/dist/lib/node-esm/chunk-FKMVORZN.mjs +0 -431
  245. package/dist/lib/node-esm/chunk-FKMVORZN.mjs.map +0 -7
  246. package/dist/lib/node-esm/chunk-FPW45EZH.mjs +0 -14
  247. package/dist/lib/node-esm/chunk-FPW45EZH.mjs.map +0 -7
  248. package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs +0 -84
  249. package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs.map +0 -7
  250. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  251. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
  252. package/dist/lib/node-esm/chunk-IL7O7IRX.mjs +0 -1472
  253. package/dist/lib/node-esm/chunk-IL7O7IRX.mjs.map +0 -7
  254. package/dist/lib/node-esm/chunk-ND2HETHD.mjs +0 -506
  255. package/dist/lib/node-esm/chunk-ND2HETHD.mjs.map +0 -7
  256. package/dist/lib/node-esm/chunk-TLKYZKPW.mjs +0 -29
  257. package/dist/lib/node-esm/chunk-TLKYZKPW.mjs.map +0 -7
  258. package/dist/lib/node-esm/chunk-VCPGX7WN.mjs +0 -62
  259. package/dist/lib/node-esm/chunk-VCPGX7WN.mjs.map +0 -7
  260. package/dist/lib/node-esm/chunk-XSZMX53L.mjs +0 -96
  261. package/dist/lib/node-esm/chunk-XSZMX53L.mjs.map +0 -7
  262. package/dist/lib/node-esm/cli/index.mjs +0 -75
  263. package/dist/lib/node-esm/cli/index.mjs.map +0 -7
  264. package/dist/lib/node-esm/common/activation-events.mjs +0 -21
  265. package/dist/lib/node-esm/common/activation-events.mjs.map +0 -7
  266. package/dist/lib/node-esm/common/capabilities.mjs +0 -57
  267. package/dist/lib/node-esm/common/capabilities.mjs.map +0 -7
  268. package/dist/lib/node-esm/config/index.mjs +0 -9
  269. package/dist/lib/node-esm/config/index.mjs.map +0 -7
  270. package/dist/lib/node-esm/core/activation-event.mjs +0 -21
  271. package/dist/lib/node-esm/core/activation-event.mjs.map +0 -7
  272. package/dist/lib/node-esm/core/capability.mjs +0 -33
  273. package/dist/lib/node-esm/core/capability.mjs.map +0 -7
  274. package/dist/lib/node-esm/core/plugin-manager.mjs +0 -20
  275. package/dist/lib/node-esm/core/plugin-manager.mjs.map +0 -7
  276. package/dist/lib/node-esm/core/plugin.mjs +0 -52
  277. package/dist/lib/node-esm/core/plugin.mjs.map +0 -7
  278. package/dist/lib/node-esm/core/url-loader.mjs +0 -25
  279. package/dist/lib/node-esm/core/url-loader.mjs.map +0 -7
  280. package/dist/lib/node-esm/index.mjs +0 -99
  281. package/dist/lib/node-esm/index.mjs.map +0 -7
  282. package/dist/lib/node-esm/meta.json +0 -1
  283. package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs +0 -133
  284. package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs.map +0 -7
  285. package/dist/lib/node-esm/testing/index.mjs +0 -360
  286. package/dist/lib/node-esm/testing/index.mjs.map +0 -7
  287. package/dist/lib/node-esm/testing/react.mjs +0 -79
  288. package/dist/lib/node-esm/testing/react.mjs.map +0 -7
  289. package/dist/lib/node-esm/ui/index.mjs +0 -61
  290. package/dist/lib/node-esm/ui/index.mjs.map +0 -7
  291. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +0 -11
  292. package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +0 -1
  293. package/src/ui/components/Surface/SurfaceInfo.tsx +0 -106
  294. package/vitest.config.ts +0 -14
@@ -0,0 +1,340 @@
1
+ import { t as __exportAll } from "../chunk-rolldown-runtime.mjs";
2
+ import { getModuleTag } from "./capability.mjs";
3
+ import { DXN } from "@dxos/keys";
4
+ import * as Context from "effect/Context";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Option from "effect/Option";
7
+ import { invariant } from "@dxos/invariant";
8
+ import * as Pipeable from "effect/Pipeable";
9
+ import * as Schema from "effect/Schema";
10
+ import { BaseError } from "@dxos/errors";
11
+ import { PluginProfileSchema, PluginReleaseSchema } from "@dxos/protocols";
12
+ //#region src/core/plugin.ts
13
+ var plugin_exports = /* @__PURE__ */ __exportAll({
14
+ LazyPluginError: () => LazyPluginError,
15
+ Meta: () => Meta,
16
+ PluginDependencyError: () => PluginDependencyError,
17
+ PluginModuleTypeId: () => PluginModuleTypeId,
18
+ PluginTypeId: () => PluginTypeId,
19
+ Profile: () => Profile,
20
+ Release: () => Release,
21
+ Service: () => Service,
22
+ activate: () => activate,
23
+ addModule: () => addModule,
24
+ define: () => define,
25
+ getMetaFromConfig: () => getMetaFromConfig,
26
+ getURI: () => getURI,
27
+ isLazy: () => isLazy,
28
+ isPlugin: () => isPlugin,
29
+ isPluginModule: () => isPluginModule,
30
+ lazy: () => lazy,
31
+ make: () => make,
32
+ makeMeta: () => makeMeta,
33
+ reset: () => reset,
34
+ resolveLazy: () => resolveLazy,
35
+ shutdown: () => shutdown
36
+ });
37
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/plugin.ts";
38
+ /**
39
+ * Effect Context.Tag for accessing PluginManager via the Effect layer system.
40
+ * This allows lifecycle operations to access the plugin manager without having it passed as an argument.
41
+ */
42
+ var Service = class extends Context.Tag("@dxos/app-framework/PluginManager")() {};
43
+ /**
44
+ * Activates plugins based on the activation event.
45
+ * Accesses the PluginManager via the Effect layer system.
46
+ * @param event The activation event.
47
+ * @returns Whether the activation was successful.
48
+ */
49
+ var activate = (event) => Effect.flatMap(Service, (manager) => manager.activate(event));
50
+ /**
51
+ * Re-activates the modules that were activated by the event.
52
+ * Accesses the PluginManager via the Effect layer system.
53
+ * @param event The activation event.
54
+ * @returns Whether the reset was successful.
55
+ */
56
+ var reset = (event) => Effect.flatMap(Service, (manager) => manager.reset(event));
57
+ /**
58
+ * Shuts down the plugin manager, deactivating all active modules and clearing lifecycle state.
59
+ * Accesses the PluginManager via the Effect layer system.
60
+ */
61
+ var shutdown = () => Effect.flatMap(Service, (manager) => manager.shutdown());
62
+ /**
63
+ * Computes a module ID from plugin ID and export name.
64
+ */
65
+ var computeModuleId = (pluginId, moduleName) => {
66
+ return `${pluginId}.module.${moduleName}`;
67
+ };
68
+ /**
69
+ * Identifier denoting a PluginModule.
70
+ */
71
+ var PluginModuleTypeId = Symbol.for("@dxos/app-framework/PluginModule");
72
+ /**
73
+ * Type guard to check if a value is a PluginModule.
74
+ */
75
+ var isPluginModule = (value) => {
76
+ return typeof value === "object" && value !== null && PluginModuleTypeId in value;
77
+ };
78
+ var PluginModuleImpl = class {
79
+ [PluginModuleTypeId] = PluginModuleTypeId;
80
+ id;
81
+ activatesOn;
82
+ firesBeforeActivation;
83
+ firesAfterActivation;
84
+ activate;
85
+ constructor(options) {
86
+ this.id = options.id;
87
+ this.activatesOn = options.activatesOn;
88
+ this.firesBeforeActivation = options.firesBeforeActivation;
89
+ this.firesAfterActivation = options.firesAfterActivation;
90
+ this.activate = options.activate;
91
+ }
92
+ };
93
+ /**
94
+ * Runtime plugin metadata, derived from the `@dxos/protocols` registry schemas (protocols owns the
95
+ * config + registry schemas; the runtime projection lives here).
96
+ *
97
+ * - {@link Profile}: version-independent identity + display + provenance — the wire `PluginProfileSchema`
98
+ * (which carries `key`, the display fields, `dependsOn`, `spec`) plus `author` (resolved at runtime
99
+ * from the publisher's handle/DID for registry plugins, or self-declared for bundled).
100
+ * - {@link Release}: a specific hosted release — the wire `PluginReleaseSchema` (version, moduleUrl, dependencies).
101
+ * - {@link Meta}: a resolved single-release view — `{ profile, release? }`, both nested. `release` is
102
+ * unset for bundled plugins (compiled in) and set for registry plugins.
103
+ */
104
+ var Profile = Schema.Struct({
105
+ ...PluginProfileSchema.fields,
106
+ author: Schema.optional(Schema.String)
107
+ });
108
+ var Release = PluginReleaseSchema;
109
+ var Meta = Schema.Struct({
110
+ profile: Profile,
111
+ release: Schema.optional(Release)
112
+ });
113
+ /** Constructs a bundled-plugin {@link Meta} from a canonical DXN. `profile.key` is the bare NSID derived from `key`. */
114
+ var makeMeta = (options) => {
115
+ const { key, ...rest } = options;
116
+ return { profile: {
117
+ ...rest,
118
+ key: DXN.getName(key)
119
+ } };
120
+ };
121
+ /** Returns the plugin's canonical DXN URI, constructed from `meta.profile.key` and `meta.release?.version`. */
122
+ var getURI = (meta) => DXN.make(meta.profile.key, meta.release?.version);
123
+ /**
124
+ * Derives a runtime {@link Meta} from a loaded `dx.config.ts` (the `@dxos/protocols` `Config2.Config`).
125
+ * Maps the flat authoring config to the nested profile; bundled plugins have no `release`.
126
+ */
127
+ var getMetaFromConfig = ({ plugin }) => {
128
+ const { key, ...rest } = plugin;
129
+ return makeMeta({
130
+ key: DXN.make(key),
131
+ ...rest
132
+ });
133
+ };
134
+ /**
135
+ * Identifier denoting a Plugin.
136
+ */
137
+ var PluginTypeId = Symbol.for("@dxos/app-framework/Plugin");
138
+ /**
139
+ * Type guard to check if a value is a Plugin.
140
+ */
141
+ var isPlugin = (value) => {
142
+ return typeof value === "object" && value !== null && PluginTypeId in value;
143
+ };
144
+ /**
145
+ * Internal implementation of Plugin.
146
+ * @internal
147
+ */
148
+ var PluginImpl = class {
149
+ _meta;
150
+ _modules;
151
+ [PluginTypeId] = PluginTypeId;
152
+ constructor(_meta, _modules) {
153
+ this._meta = _meta;
154
+ this._modules = _modules;
155
+ }
156
+ get meta() {
157
+ return this._meta;
158
+ }
159
+ get modules() {
160
+ return this._modules;
161
+ }
162
+ };
163
+ /**
164
+ * Builder implementation for creating plugins incrementally.
165
+ */
166
+ var PluginBuilderImpl = class {
167
+ meta;
168
+ _modules = [];
169
+ constructor(meta) {
170
+ this.meta = meta;
171
+ }
172
+ get modules() {
173
+ return this._modules;
174
+ }
175
+ addModule(moduleOptions) {
176
+ this._modules.push(moduleOptions);
177
+ return this;
178
+ }
179
+ pipe() {
180
+ return Pipeable.pipeArguments(this, arguments);
181
+ }
182
+ };
183
+ /**
184
+ * Creates a new PluginBuilder to start building a plugin.
185
+ */
186
+ var define = (meta) => new PluginBuilderImpl(meta);
187
+ function addModule(moduleOptionsOrBuilder, moduleOptions) {
188
+ if (moduleOptions !== void 0) return moduleOptionsOrBuilder.addModule(moduleOptions);
189
+ const moduleOpts = moduleOptionsOrBuilder;
190
+ return (builder) => builder.addModule(moduleOpts);
191
+ }
192
+ /**
193
+ * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.
194
+ */
195
+ var resolveModule = (meta, module, options) => {
196
+ const moduleOptions = typeof module === "function" ? module(options) : module;
197
+ const pluginName = meta.profile.key;
198
+ const id = Option.fromNullable(moduleOptions.id).pipe(Option.match({
199
+ onNone: () => {
200
+ const exportName = getModuleTag(moduleOptions.activate);
201
+ invariant(exportName, `Plugin module missing name. Plugin: ${meta.profile.key}`, {
202
+ "~LogMeta": "~LogMeta",
203
+ F: __dxlog_file,
204
+ L: 353,
205
+ S: void 0,
206
+ A: ["exportName", "`Plugin module missing name. Plugin: ${meta.profile.key}`"]
207
+ });
208
+ return computeModuleId(pluginName, exportName);
209
+ },
210
+ onSome: (id) => computeModuleId(pluginName, id)
211
+ }));
212
+ return new PluginModuleImpl({
213
+ ...moduleOptions,
214
+ id
215
+ });
216
+ };
217
+ function make(builder) {
218
+ const meta = builder.meta;
219
+ invariant(!meta.profile.dependsOn?.includes(meta.profile.key), `Plugin ${meta.profile.key} declares itself as a dependency.`, {
220
+ "~LogMeta": "~LogMeta",
221
+ F: __dxlog_file,
222
+ L: 372,
223
+ S: this,
224
+ A: ["!meta.profile.dependsOn?.includes(meta.profile.key)", "`Plugin ${meta.profile.key} declares itself as a dependency.`"]
225
+ });
226
+ const factory = (options) => {
227
+ const modules = builder.modules.map((module) => resolveModule(meta, module, options));
228
+ return new PluginImpl(meta, modules);
229
+ };
230
+ return Object.assign(factory, { meta });
231
+ }
232
+ /**
233
+ * Symbol used to tag lazy plugin stubs with their loader closure.
234
+ * Hidden from enumeration so plugin manager iteration / serialization paths
235
+ * don't trip over it.
236
+ */
237
+ var LazyTag = Symbol.for("@dxos/app-framework/Plugin/Lazy");
238
+ /**
239
+ * Defines a lazy plugin whose body is loaded on first enable.
240
+ *
241
+ * The returned factory produces a stub `Plugin` that exposes `meta`
242
+ * synchronously (so callers can read `Plugin.meta.profile.key` for free) but defers
243
+ * loading the real plugin's modules until the manager calls
244
+ * `Plugin.resolveLazy`. This lets the plugin's main entry point ship as a
245
+ * tiny meta-only chunk — the heavy capabilities, schema, React surfaces,
246
+ * etc. live behind the dynamic `import()` and become a separate Rollup
247
+ * chunk that is only fetched when the plugin is enabled.
248
+ *
249
+ * @example
250
+ * ```ts
251
+ * // plugin-markdown/src/index.ts
252
+ * import { Plugin } from '@dxos/app-framework';
253
+ * import { meta } from './meta';
254
+ *
255
+ * export const MarkdownPlugin = Plugin.lazy(meta, () => import('./MarkdownPlugin'));
256
+ *
257
+ * // plugin-markdown/src/MarkdownPlugin.tsx
258
+ * export const MarkdownPlugin = Plugin.define(meta).pipe(...heavy modules..., Plugin.make);
259
+ * export default MarkdownPlugin;
260
+ * ```
261
+ */
262
+ var lazy = (meta, loader) => {
263
+ const factory = (options) => {
264
+ const stub = new PluginImpl(meta, []);
265
+ Object.defineProperty(stub, LazyTag, {
266
+ value: {
267
+ loader,
268
+ options
269
+ },
270
+ enumerable: false
271
+ });
272
+ return stub;
273
+ };
274
+ return Object.assign(factory, { meta });
275
+ };
276
+ /**
277
+ * Type guard for lazy plugin stubs produced by {@link lazy}.
278
+ */
279
+ var isLazy = (plugin) => LazyTag in plugin;
280
+ /**
281
+ * Tagged error for failures during lazy plugin resolution. `context.id` is
282
+ * the lazy plugin's `meta.profile.key`; `context.reason` discriminates the failure
283
+ * mode (`'load-failed' | 'missing-default' | 'invalid-plugin' |
284
+ * 'meta-mismatch'`) so callers can route on it.
285
+ */
286
+ var LazyPluginError = class extends BaseError.extend("LazyPluginError", "Failed to resolve lazy plugin") {};
287
+ /**
288
+ * Tagged error for plugin-level dependency resolution failures.
289
+ *
290
+ * `context.id` is the plugin id the manager was acting on. `context.reason`
291
+ * discriminates the failure mode:
292
+ * - `'missing'` — declared dep is neither registered nor in the catalog.
293
+ * `context.missing` lists offending ids.
294
+ * - `'install-failed'` — dep was found in the catalog but `add()` failed.
295
+ * `cause` carries the original error.
296
+ * - `'cycle'` — closure walk detected a cycle. `context.path` is the cycle path.
297
+ * - `'core-dependent'` — cascade-disable would have to disable a core plugin.
298
+ * `context.coreDependent` is the blocking id.
299
+ */
300
+ var PluginDependencyError = class extends BaseError.extend("PluginDependencyError", "Plugin dependency resolution failed") {};
301
+ /**
302
+ * Resolves a lazy plugin stub to its real plugin.
303
+ * Returns the plugin unchanged if it is not lazy. Failures surface as
304
+ * {@link LazyPluginError} with `context.reason` indicating the failure mode
305
+ * and (for loader failures) `cause` set to the original error.
306
+ */
307
+ var resolveLazy = (plugin) => Effect.gen(function* () {
308
+ if (!isLazy(plugin)) return plugin;
309
+ const id = plugin.meta.profile.key;
310
+ const { loader, options } = plugin[LazyTag];
311
+ const mod = yield* Effect.tryPromise({
312
+ try: loader,
313
+ catch: (error) => new LazyPluginError({
314
+ context: {
315
+ id,
316
+ reason: "load-failed"
317
+ },
318
+ cause: error
319
+ })
320
+ });
321
+ if (!mod || typeof mod.default !== "function") return yield* Effect.fail(new LazyPluginError({ context: {
322
+ id,
323
+ reason: "missing-default"
324
+ } }));
325
+ const result = mod.default(options);
326
+ if (!isPlugin(result)) return yield* Effect.fail(new LazyPluginError({ context: {
327
+ id,
328
+ reason: "invalid-plugin"
329
+ } }));
330
+ if (result.meta.profile.key !== id) return yield* Effect.fail(new LazyPluginError({ context: {
331
+ id,
332
+ reason: "meta-mismatch",
333
+ returnedId: result.meta.profile.key
334
+ } }));
335
+ return result;
336
+ });
337
+ //#endregion
338
+ export { LazyPluginError, Meta, PluginDependencyError, PluginModuleTypeId, PluginTypeId, Profile, Release, Service, activate, addModule, define, getMetaFromConfig, getURI, isLazy, isPlugin, isPluginModule, lazy, make, makeMeta, reset, resolveLazy, shutdown, plugin_exports as t };
339
+
340
+ //# sourceMappingURL=plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/core/plugin.ts"],"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';\nimport * as Schema from 'effect/Schema';\nimport type * as Scope from 'effect/Scope';\n\nimport { BaseError } from '@dxos/errors';\nimport { invariant } from '@dxos/invariant';\nimport { DXN } from '@dxos/keys';\nimport { Config2, PluginProfileSchema, PluginReleaseSchema } from '@dxos/protocols';\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 *\n * Ordering between modules is expressed through shared activation events, not registration\n * order: a module `activatesOn` an event, fires events *after* it activates via\n * {@link PluginModule.firesAfterActivation} (publishing \"I'm ready\"), and forces prerequisites\n * to complete *before* it activates via {@link PluginModule.firesBeforeActivation}. To run\n * module B after module A, A declares `firesAfterActivation: [E]` and B declares\n * `activatesOn: E`. See `plugin-client/src/ClientPlugin.ts` for a worked example.\n *\n * @idiom org.dxos.app-framework.moduleActivationOrdering\n * applies: sequencing one plugin module's activation before or after another\n * instead-of: assuming module registration order controls activation order\n * uses: {@link PluginModule.firesAfterActivation}, {@link PluginModule.firesBeforeActivation}\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: (\n props?: any,\n ) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | Scope.Scope | 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\n/**\n * Runtime plugin metadata, derived from the `@dxos/protocols` registry schemas (protocols owns the\n * config + registry schemas; the runtime projection lives here).\n *\n * - {@link Profile}: version-independent identity + display + provenance — the wire `PluginProfileSchema`\n * (which carries `key`, the display fields, `dependsOn`, `spec`) plus `author` (resolved at runtime\n * from the publisher's handle/DID for registry plugins, or self-declared for bundled).\n * - {@link Release}: a specific hosted release — the wire `PluginReleaseSchema` (version, moduleUrl, dependencies).\n * - {@link Meta}: a resolved single-release view — `{ profile, release? }`, both nested. `release` is\n * unset for bundled plugins (compiled in) and set for registry plugins.\n */\nexport const Profile = Schema.Struct({\n ...PluginProfileSchema.fields,\n author: Schema.optional(Schema.String),\n});\nexport type Profile = Schema.Schema.Type<typeof Profile>;\n\nexport const Release = PluginReleaseSchema;\nexport type Release = Schema.Schema.Type<typeof Release>;\n\nexport const Meta = Schema.Struct({\n profile: Profile,\n release: Schema.optional(Release),\n});\nexport type Meta = Schema.Schema.Type<typeof Meta>;\n\n/** Options for {@link makeMeta}: the {@link Profile} content fields plus the canonical DXN `key`. */\nexport type MakeMetaOptions = {\n key: DXN.DXN;\n name: string;\n description?: string;\n author?: string;\n homePage?: string;\n source?: string;\n tags?: readonly string[];\n dependsOn?: readonly string[];\n spec?: string;\n icon?: Config2.Icon;\n screenshots?: ReadonlyArray<Config2.Screenshot>;\n};\n\n/** Constructs a bundled-plugin {@link Meta} from a canonical DXN. `profile.key` is the bare NSID derived from `key`. */\nexport const makeMeta = (options: MakeMetaOptions): Meta => {\n const { key, ...rest } = options;\n return { profile: { ...rest, key: DXN.getName(key) } };\n};\n\n/** Returns the plugin's canonical DXN URI, constructed from `meta.profile.key` and `meta.release?.version`. */\nexport const getURI = (meta: Meta): DXN.DXN => DXN.make(meta.profile.key, meta.release?.version);\n\n/**\n * Derives a runtime {@link Meta} from a loaded `dx.config.ts` (the `@dxos/protocols` `Config2.Config`).\n * Maps the flat authoring config to the nested profile; bundled plugins have no `release`.\n */\nexport const getMetaFromConfig = ({ plugin }: Config2.Config): Meta => {\n const { key, ...rest } = plugin;\n return makeMeta({ key: DXN.make(key), ...rest });\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 pluginName = meta.profile.key;\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.profile.key}`);\n return computeModuleId(pluginName, exportName);\n },\n onSome: (id) => computeModuleId(pluginName, 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 // `dependsOn` entries and `key` are both bare NSIDs, so compare directly.\n invariant(\n !meta.profile.dependsOn?.includes(meta.profile.key),\n `Plugin ${meta.profile.key} declares itself as a dependency.`,\n );\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.profile.key` 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.profile.key`; `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 * Tagged error for plugin-level dependency resolution failures.\n *\n * `context.id` is the plugin id the manager was acting on. `context.reason`\n * discriminates the failure mode:\n * - `'missing'` — declared dep is neither registered nor in the catalog.\n * `context.missing` lists offending ids.\n * - `'install-failed'` — dep was found in the catalog but `add()` failed.\n * `cause` carries the original error.\n * - `'cycle'` — closure walk detected a cycle. `context.path` is the cycle path.\n * - `'core-dependent'` — cascade-disable would have to disable a core plugin.\n * `context.coreDependent` is the blocking id.\n */\nexport class PluginDependencyError extends BaseError.extend(\n 'PluginDependencyError',\n 'Plugin dependency resolution failed',\n) {}\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.profile.key;\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.profile.key !== id) {\n return yield* Effect.fail(\n new LazyPluginError({ context: { id, reason: 'meta-mismatch', returnedId: result.meta.profile.key } }),\n );\n }\n return result;\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,UAAb,cAA6B,QAAQ,IAAI,mCAAmC,CAAC,CAAuC,CAAC,CAAC,CAAC;;;;;;;AAYvH,IAAa,YAAY,UACvB,OAAO,QAAQ,UAAU,YAAY,QAAQ,SAAS,KAAK,CAAC;;;;;;;AAQ9D,IAAa,SAAS,UACpB,OAAO,QAAQ,UAAU,YAAY,QAAQ,MAAM,KAAK,CAAC;;;;;AAM3D,IAAa,iBACX,OAAO,QAAQ,UAAU,YAAY,QAAQ,SAAS,CAAC;;;;AAKzD,IAAM,mBAAmB,UAAkB,eAA+B;CACxE,OAAO,GAAG,SAAS,UAAU;AAC/B;;;;AAKA,IAAa,qBAAoC,OA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gBAAgB,EAAE,SAAS;EAAE;EAAI,QAAQ;CAAkB,EAAE,CAAC,CAAC;CAE/F,MAAM,SAAS,IAAI,QAAQ,OAAO;CAClC,IAAI,CAAC,SAAS,MAAM,GAClB,OAAO,OAAO,OAAO,KAAK,IAAI,gBAAgB,EAAE,SAAS;EAAE;EAAI,QAAQ;CAAiB,EAAE,CAAC,CAAC;CAE9F,IAAI,OAAO,KAAK,QAAQ,QAAQ,IAC9B,OAAO,OAAO,OAAO,KACnB,IAAI,gBAAgB,EAAE,SAAS;EAAE;EAAI,QAAQ;EAAiB,YAAY,OAAO,KAAK,QAAQ;CAAI,EAAE,CAAC,CACvG;CAEF,OAAO;AACT,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { a as make, c as uninstall, i as isLocalUrl, n as getInstalledVersion, o as preload, r as getRemoteEntries, s as setInstalledVersion, t as RemotePluginLoadError } from "../chunk-url-loader.mjs";
2
+ export { RemotePluginLoadError, getInstalledVersion, getRemoteEntries, isLocalUrl, make, preload, setInstalledVersion, uninstall };
@@ -0,0 +1,134 @@
1
+ import { t as __exportAll } from "./chunk-rolldown-runtime.mjs";
2
+ import { t as activation_event_exports } from "./core/activation-event.mjs";
3
+ import { lazy, t as capability_exports } from "./core/capability.mjs";
4
+ import { c as capability_manager_exports, o as plugin_manager_exports, s as registry_exports } from "./chunk-plugin-manager.mjs";
5
+ import { addModule, define, make as make$1, makeMeta, t as plugin_exports } from "./core/plugin.mjs";
6
+ import { l as url_loader_exports, u as plugin_asset_cache_exports } from "./chunk-url-loader.mjs";
7
+ import { r as plugin_manifest_exports, t as PLUGIN_DEV_SERVER_PORT } from "./chunk-plugin-manifest.mjs";
8
+ import { t as capabilities_exports } from "./common/capabilities.mjs";
9
+ import { ProcessManagerReady, SetupProcessManager, Startup, t as activation_events_exports } from "./common/activation-events.mjs";
10
+ import { Config2 } from "./config.mjs";
11
+ import { t as PluginManagerContext } from "./chunk-context.mjs";
12
+ import { a as undo_mapping_exports, i as undo_registry_exports, o as EmptyHistoryError, t as history_tracker_exports } from "./chunk-history-tracker.mjs";
13
+ import { DXN } from "@dxos/keys";
14
+ import * as Effect from "effect/Effect";
15
+ import * as Schema from "effect/Schema";
16
+ import { Context } from "@dxos/context";
17
+ //#region src/core/edge-registry-plugin-provider.ts
18
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/edge-registry-plugin-provider.ts";
19
+ /**
20
+ * Maps a wire-format `PluginView` (from `@dxos/protocols`) to a runtime `Plugin.Meta`: the nested
21
+ * `profile` (the view's profile plus the resolved provenance `author`) and the latest `release`.
22
+ *
23
+ * This is the one translation seam between the nested wire view and the resolved runtime manifest.
24
+ * `profile.key` is the composer plugin id — a valid NSID — so `DXN.make(profile.key, release.version)`
25
+ * reconstructs the canonical plugin DXN.
26
+ */
27
+ var toRegistryPlugin = (entry) => {
28
+ if (!entry.releases?.length) return null;
29
+ const latestRelease = entry.releases.find((release) => release.version === entry.latestVersion) ?? entry.releases[0];
30
+ return {
31
+ profile: {
32
+ ...entry.profile,
33
+ author: entry.handle ?? entry.did
34
+ },
35
+ release: latestRelease
36
+ };
37
+ };
38
+ /**
39
+ * Implements `Registry.PluginProvider` against the Edge `/registry` HTTP endpoints.
40
+ *
41
+ * Lives in app-framework (rather than the more obvious home of `@dxos/edge-client`)
42
+ * because edge-client doesn't depend on app-framework; siting the implementation
43
+ * here keeps the dependency arrow `app-framework → edge-client` and avoids a
44
+ * cycle. The class needs only the public `EdgeHttpClient` type, so a one-way
45
+ * type-import is enough.
46
+ *
47
+ * `listVersions` is served directly from the `releases` array inlined on each
48
+ * entry — no separate endpoint is needed.
49
+ */
50
+ var EdgeRegistryPluginProvider = class {
51
+ _client;
52
+ #cachedPlugins = [];
53
+ #cachedEntries = [];
54
+ constructor(_client) {
55
+ this._client = _client;
56
+ }
57
+ listPlugins() {
58
+ return Effect.tryPromise({
59
+ try: () => this._client.getRegistryPlugins(Context.default(void 0, {
60
+ "~LogMeta": "~LogMeta",
61
+ F: __dxlog_file,
62
+ L: 58
63
+ })),
64
+ catch: (error) => error instanceof Error ? error : new Error(String(error))
65
+ }).pipe(Effect.map((body) => {
66
+ this.#cachedEntries = body.plugins;
67
+ const plugins = body.plugins.map(toRegistryPlugin).filter((entry) => entry !== null);
68
+ this.#cachedPlugins = plugins;
69
+ return plugins;
70
+ }));
71
+ }
72
+ listVersions(id) {
73
+ const entry = this.#cachedEntries.find((candidate) => candidate.profile.key === id);
74
+ if (!entry) return Effect.fail(/* @__PURE__ */ new Error(`Plugin not found in catalog: ${id}`));
75
+ return Effect.succeed(entry.releases);
76
+ }
77
+ getPlugin(id, version) {
78
+ const plugin = this.#cachedPlugins.find((candidate) => candidate.profile.key === id);
79
+ if (!plugin) return Effect.fail(/* @__PURE__ */ new Error(`Plugin not found in catalog: ${id}`));
80
+ if (version && version !== plugin.release?.version) return Effect.fail(/* @__PURE__ */ new Error(`Version ${version} not available for ${id}; only ${plugin.release?.version} is cached`));
81
+ return Effect.succeed(plugin);
82
+ }
83
+ };
84
+ //#endregion
85
+ //#region src/common/Role.ts
86
+ var Role_exports = /* @__PURE__ */ __exportAll({ make: () => make });
87
+ /**
88
+ * Mints a typed role token. The NSID is validated at compile time via
89
+ * {@link DXN.Name}: the final segment must be camelCase (no hyphens).
90
+ * Dynamic NSIDs (template-literal / runtime strings) are validated at runtime.
91
+ *
92
+ * Identity is structural; all tokens with the same `role` string are
93
+ * interchangeable at runtime.
94
+ */
95
+ var make = (nsid) => {
96
+ if (typeof nsid !== "string" || !/^[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(\.[a-zA-Z][a-zA-Z0-9]{0,62})$/.test(nsid)) throw new Error(`Invalid role NSID: "${nsid}". Must be a dotted name with a camelCase final segment (no hyphens in the last segment).`);
97
+ return { role: nsid };
98
+ };
99
+ //#endregion
100
+ //#region src/common/translations.ts
101
+ /**
102
+ * A Label represents translatable text - either a simple string or a tuple of [key, options].
103
+ */
104
+ var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.String, Schema.mutable(Schema.Struct({
105
+ ns: Schema.Union(Schema.String, Schema.Array(Schema.String)),
106
+ count: Schema.optional(Schema.Number),
107
+ defaultValue: Schema.optional(Schema.String)
108
+ })))));
109
+ //#endregion
110
+ //#region src/plugin-process-manager/meta.ts
111
+ var meta = makeMeta({
112
+ key: DXN.make("org.dxos.plugin.processManager"),
113
+ name: "Process Manager Plugin",
114
+ author: "DXOS",
115
+ description: "Hosts the process-manager runtime that composes contributed layer specs into a service resolver, exposes the operation invoker built on top of it, and registers undo/history tracking.",
116
+ tags: ["system"]
117
+ });
118
+ //#endregion
119
+ //#region src/plugin-process-manager/ProcessManagerPlugin.ts
120
+ var ProcessManagerCapability = lazy("ProcessManager", () => import("./chunk-process-manager-capability.mjs"));
121
+ var HistoryCapabilities = lazy("HistoryCapabilities", () => import("./chunk-capability.mjs"));
122
+ var ProcessManagerPlugin = define(meta).pipe(addModule({
123
+ activatesOn: Startup,
124
+ firesBeforeActivation: [SetupProcessManager],
125
+ firesAfterActivation: [ProcessManagerReady],
126
+ activate: ProcessManagerCapability
127
+ }), addModule({
128
+ activatesOn: ProcessManagerReady,
129
+ activate: HistoryCapabilities
130
+ }), make$1);
131
+ //#endregion
132
+ export { activation_event_exports as ActivationEvent, activation_events_exports as ActivationEvents, capabilities_exports as Capabilities, capability_exports as Capability, capability_manager_exports as CapabilityManager, Config2, EdgeRegistryPluginProvider, EmptyHistoryError, history_tracker_exports as HistoryTracker, Label, PLUGIN_DEV_SERVER_PORT, plugin_exports as Plugin, plugin_asset_cache_exports as PluginAssetCache, plugin_manager_exports as PluginManager, PluginManagerContext, plugin_manifest_exports as PluginManifest, ProcessManagerPlugin, registry_exports as Registry, Role_exports as Role, undo_mapping_exports as UndoMapping, undo_registry_exports as UndoRegistry, url_loader_exports as UrlLoader };
133
+
134
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/core/edge-registry-plugin-provider.ts","../../src/common/Role.ts","../../src/common/translations.ts","../../src/plugin-process-manager/meta.ts","../../src/plugin-process-manager/ProcessManagerPlugin.ts"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Context } from '@dxos/context';\nimport { type EdgeHttpClient } from '@dxos/edge-client';\nimport { type PluginView } from '@dxos/protocols';\n\nimport type * as Plugin from './plugin';\nimport * as Registry from './registry';\n\n/**\n * Maps a wire-format `PluginView` (from `@dxos/protocols`) to a runtime `Plugin.Meta`: the nested\n * `profile` (the view's profile plus the resolved provenance `author`) and the latest `release`.\n *\n * This is the one translation seam between the nested wire view and the resolved runtime manifest.\n * `profile.key` is the composer plugin id — a valid NSID — so `DXN.make(profile.key, release.version)`\n * reconstructs the canonical plugin DXN.\n */\nconst toRegistryPlugin = (entry: PluginView): Plugin.Meta | null => {\n if (!entry.releases?.length) {\n return null;\n }\n const latestRelease = entry.releases.find((release) => release.version === entry.latestVersion) ?? entry.releases[0];\n return {\n profile: {\n ...entry.profile,\n // Provenance: the verified publisher is the author (handle preferred, DID fallback).\n author: entry.handle ?? entry.did,\n },\n release: latestRelease,\n };\n};\n\n/**\n * Implements `Registry.PluginProvider` against the Edge `/registry` HTTP endpoints.\n *\n * Lives in app-framework (rather than the more obvious home of `@dxos/edge-client`)\n * because edge-client doesn't depend on app-framework; siting the implementation\n * here keeps the dependency arrow `app-framework → edge-client` and avoids a\n * cycle. The class needs only the public `EdgeHttpClient` type, so a one-way\n * type-import is enough.\n *\n * `listVersions` is served directly from the `releases` array inlined on each\n * entry — no separate endpoint is needed.\n */\nexport class EdgeRegistryPluginProvider implements Registry.PluginProvider {\n // Cached on first load so getPlugin/listVersions can resolve without re-fetching.\n #cachedPlugins: readonly Plugin.Meta[] = [];\n #cachedEntries: readonly PluginView[] = [];\n\n constructor(private readonly _client: EdgeHttpClient) {}\n\n listPlugins(): Effect.Effect<readonly Plugin.Meta[], Error> {\n return Effect.tryPromise({\n try: () => this._client.getRegistryPlugins(Context.default()),\n catch: (error) => (error instanceof Error ? error : new Error(String(error))),\n }).pipe(\n Effect.map((body) => {\n this.#cachedEntries = body.plugins;\n const plugins = body.plugins.map(toRegistryPlugin).filter((entry): entry is Plugin.Meta => entry !== null);\n this.#cachedPlugins = plugins;\n return plugins;\n }),\n );\n }\n\n listVersions(id: string): Effect.Effect<readonly Plugin.Release[], Error> {\n const entry = this.#cachedEntries.find((candidate) => candidate.profile.key === id);\n if (!entry) {\n return Effect.fail(new Error(`Plugin not found in catalog: ${id}`));\n }\n // Releases are already `PluginRelease`-shaped on the wire view; serve them directly.\n return Effect.succeed(entry.releases);\n }\n\n getPlugin(id: string, version?: string): Effect.Effect<Plugin.Meta, Error> {\n const plugin = this.#cachedPlugins.find((candidate) => candidate.profile.key === id);\n if (!plugin) {\n return Effect.fail(new Error(`Plugin not found in catalog: ${id}`));\n }\n if (version && version !== plugin.release?.version) {\n return Effect.fail(\n new Error(`Version ${version} not available for ${id}; only ${plugin.release?.version} is cached`),\n );\n }\n return Effect.succeed(plugin);\n }\n}\n","//\n// Copyright 2023 DXOS.org\n//\n\n// @import-as-namespace\n\nimport type { DXN } from '@dxos/keys';\n\n/**\n * A typed role token. Carries a role NSID for runtime dispatch plus a phantom\n * data type so consumers using `type={SomeToken}` and providers using\n * `AppSurface.object(SomeToken, ...)` share a single type-level contract.\n *\n * Mint via {@link make}. The `role` field holds the bare NSID (e.g.\n * `org.dxos.role.article`) — the dispatch key, `data-role` attribute value,\n * and what `.role` comparisons inside matched components see.\n */\nexport type Role<TData> = {\n readonly role: string;\n /** Covariant phantom; never accessed at runtime. */\n readonly _phantom?: TData;\n};\n\n/**\n * Narrow data type carried by a role token.\n */\nexport type Data<T> = T extends Role<infer D> ? D : never;\n\n/**\n * Mints a typed role token. The NSID is validated at compile time via\n * {@link DXN.Name}: the final segment must be camelCase (no hyphens).\n * Dynamic NSIDs (template-literal / runtime strings) are validated at runtime.\n *\n * Identity is structural; all tokens with the same `role` string are\n * interchangeable at runtime.\n */\nexport const make: {\n <TData = unknown, T extends string = string>(\n nsid: [DXN.Name<T>] extends [never] ? `Invalid NSID \"${T}\": final segment must be camelCase (no hyphens)` : T,\n ): Role<TData>;\n} = <TData>(nsid: string): Role<TData> => {\n // Runtime guard for dynamic NSIDs that bypass the compile-time DXN.Name<T> check.\n if (\n typeof nsid !== 'string' ||\n !/^[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(\\.[a-zA-Z][a-zA-Z0-9]{0,62})$/.test(\n nsid,\n )\n ) {\n throw new Error(\n `Invalid role NSID: \"${nsid}\". Must be a dotted name with a camelCase final segment (no hyphens in the last segment).`,\n );\n }\n return { role: nsid };\n};\n","//\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.Union(Schema.String, Schema.Array(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 { DXN } from '@dxos/keys';\n\nimport { Plugin } from '../core';\n\nexport const meta = Plugin.makeMeta({\n key: DXN.make('org.dxos.plugin.processManager'),\n name: 'Process Manager Plugin',\n author: 'DXOS',\n description:\n 'Hosts the process-manager runtime that composes contributed layer specs into a service resolver, exposes the operation invoker built on top of it, and registers undo/history tracking.',\n tags: ['system'],\n});\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvents } from '../common';\nimport { Capability, Plugin } from '../core';\nimport { meta } from './meta';\n\nconst ProcessManagerCapability = Capability.lazy('ProcessManager', () => import('./process-manager-capability'));\nconst HistoryCapabilities = Capability.lazy('HistoryCapabilities', () => import('./history/capability'));\n\nexport const ProcessManagerPlugin = Plugin.define(meta).pipe(\n Plugin.addModule({\n activatesOn: ActivationEvents.Startup,\n firesBeforeActivation: [ActivationEvents.SetupProcessManager],\n firesAfterActivation: [ActivationEvents.ProcessManagerReady],\n activate: ProcessManagerCapability,\n }),\n Plugin.addModule({\n activatesOn: ActivationEvents.ProcessManagerReady,\n activate: HistoryCapabilities,\n }),\n Plugin.make,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAM,oBAAoB,UAA0C;CAClE,IAAI,CAAC,MAAM,UAAU,QACnB,OAAO;CAET,MAAM,gBAAgB,MAAM,SAAS,MAAM,YAAY,QAAQ,YAAY,MAAM,aAAa,KAAK,MAAM,SAAS;CAClH,OAAO;EACL,SAAS;GACP,GAAG,MAAM;GAET,QAAQ,MAAM,UAAU,MAAM;EAChC;EACA,SAAS;CACX;AACF;;;;;;;;;;;;;AAcA,IAAa,6BAAb,MAA2E;CAK5C;CAH7B,iBAAyC,CAAC;CAC1C,iBAAwC,CAAC;CAEzC,YAAY,SAA0C;EAAzB,KAAA,UAAA;CAA0B;CAEvD,cAA4D;EAC1D,OAAO,OAAO,WAAW;GACvB,WAAW,KAAK,QAAQ,mBAAmB,QAAQ,QAAO,KAAA,GAAA;IAAA,YAAA;IAAA,GAAA;IAAA,GAAA;GAAA,CAAC,CAAC;GAC5D,QAAQ,UAAW,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;EAC7E,CAAC,CAAC,CAAC,KACD,OAAO,KAAK,SAAS;GACnB,KAAK,iBAAiB,KAAK;GAC3B,MAAM,UAAU,KAAK,QAAQ,IAAI,gBAAgB,CAAC,CAAC,QAAQ,UAAgC,UAAU,IAAI;GACzG,KAAK,iBAAiB;GACtB,OAAO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,sBAAsB,KAAgB,6BAA6B,OAAO,yBAAuB;AAEvG,IAAa,uBAAuB,OAAc,IAAI,CAAC,CAAC,KACtD,UAAiB;CACf,aAAa;CACb,uBAAuB,CAAC,mBAAoC;CAC5D,sBAAsB,CAAC,mBAAoC;CAC3D,UAAU;AACZ,CAAC,GACD,UAAiB;CACf,aAAa;CACb,UAAU;AACZ,CAAC,GACD,MACF"}
@@ -0,0 +1,70 @@
1
+ import { ReactContext } from "../common/capabilities.mjs";
2
+ import { t as PluginManagerContext } from "../chunk-context.mjs";
3
+ import { C as topologicalSort, b as PluginManagerProvider, o as SurfaceComponent, p as SurfaceManagerProvider, t as SurfaceManager } from "../chunk-SurfaceManager.mjs";
4
+ import { Fragment, useMemo } from "react";
5
+ import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
6
+ import { RegistryContext } from "@effect-atom/atom-react";
7
+ import { ContextProtocolProvider } from "@dxos/web-context-react";
8
+ import { render as render$1 } from "@testing-library/react";
9
+ //#region src/testing/react.tsx
10
+ /**
11
+ * Renders `ui` wrapped in the same provider tree as `useApp` plus every contributed
12
+ * `Capabilities.ReactContext`.
13
+ */
14
+ var render = (harness, ui, options) => {
15
+ const { reactContexts = [], ...rest } = options ?? {};
16
+ const Wrapper = ({ children }) => /* @__PURE__ */ jsx(HarnessProviders, {
17
+ harness,
18
+ extra: reactContexts,
19
+ children
20
+ });
21
+ return render$1(/* @__PURE__ */ jsx(Fragment$1, { children: ui }), {
22
+ ...rest,
23
+ wrapper: Wrapper
24
+ });
25
+ };
26
+ /**
27
+ * Renders a `Surface` with the given role token/data inside the harness provider tree.
28
+ */
29
+ var renderSurface = (harness, props, options) => {
30
+ const { type, data, limit, fallback, placeholder } = props;
31
+ return render(harness, /* @__PURE__ */ jsx(SurfaceComponent, {
32
+ type,
33
+ data,
34
+ limit,
35
+ fallback,
36
+ placeholder
37
+ }), options);
38
+ };
39
+ var HarnessProviders = ({ harness, extra, children }) => {
40
+ const ContributedContext = composeContexts(harness.getAll(ReactContext));
41
+ const ExtraContext = composeExtra(extra);
42
+ const surfaces = useMemo(() => new SurfaceManager(harness.manager.capabilities), [harness]);
43
+ return /* @__PURE__ */ jsx(PluginManagerProvider, {
44
+ value: harness.manager,
45
+ children: /* @__PURE__ */ jsx(ContextProtocolProvider, {
46
+ value: harness.manager,
47
+ context: PluginManagerContext,
48
+ children: /* @__PURE__ */ jsx(RegistryContext.Provider, {
49
+ value: harness.registry,
50
+ children: /* @__PURE__ */ jsx(SurfaceManagerProvider, {
51
+ value: surfaces,
52
+ children: /* @__PURE__ */ jsx(ContributedContext, { children: /* @__PURE__ */ jsx(ExtraContext, { children }) })
53
+ })
54
+ })
55
+ })
56
+ });
57
+ };
58
+ var composeContexts = (contexts) => {
59
+ if (contexts.length === 0) return Passthrough;
60
+ return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ jsx(Acc, { children: /* @__PURE__ */ jsx(Next, { children }) }));
61
+ };
62
+ var composeExtra = (contexts) => {
63
+ if (contexts.length === 0) return Passthrough;
64
+ return contexts.reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ jsx(Next, { children: /* @__PURE__ */ jsx(Acc, { children }) }), Passthrough);
65
+ };
66
+ var Passthrough = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
67
+ //#endregion
68
+ export { render, renderSurface };
69
+
70
+ //# sourceMappingURL=react.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.mjs","names":[],"sources":["../../../src/testing/react.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { RegistryContext } from '@effect-atom/atom-react';\nimport { type RenderOptions, type RenderResult, render as rtlRender } from '@testing-library/react';\nimport React, { type FC, Fragment, type PropsWithChildren, type ReactNode, useMemo } from 'react';\n\nimport { ContextProtocolProvider } from '@dxos/web-context-react';\n\nimport { Capabilities } from '../common';\nimport * as Role from '../common/Role';\nimport { PluginManagerContext } from '../context';\nimport { topologicalSort } from '../helpers';\nimport { PluginManagerProvider } from '../ui/components/PluginManager/PluginManagerProvider';\nimport { SurfaceComponent } from '../ui/components/Surface/SurfaceComponent';\nimport { SurfaceManager } from '../ui/components/Surface/SurfaceManager';\nimport { SurfaceManagerProvider } from '../ui/components/Surface/SurfaceManagerContext';\nimport { type TestHarness } from './harness';\n\nexport type HarnessRenderOptions = Omit<RenderOptions, 'wrapper'> & {\n /** Additional providers to wrap around the harness tree (applied innermost first). */\n reactContexts?: FC<PropsWithChildren>[];\n};\n\n/**\n * Renders `ui` wrapped in the same provider tree as `useApp` plus every contributed\n * `Capabilities.ReactContext`.\n */\nexport const render = (harness: TestHarness, ui: ReactNode, options?: HarnessRenderOptions): RenderResult => {\n const { reactContexts = [], ...rest } = options ?? {};\n const Wrapper = ({ children }: PropsWithChildren) => (\n <HarnessProviders harness={harness} extra={reactContexts}>\n {children}\n </HarnessProviders>\n );\n return rtlRender(<>{ui}</>, { ...rest, wrapper: Wrapper });\n};\n\nexport type RenderSurfaceProps<TToken extends Role.Role<any>> = {\n type: TToken;\n data?: TToken extends Role.Role<infer D> ? D : never;\n limit?: number;\n fallback?: FC<{ error: Error; data?: any }>;\n placeholder?: ReactNode;\n};\n\n/**\n * Renders a `Surface` with the given role token/data inside the harness provider tree.\n */\nexport const renderSurface = <TToken extends Role.Role<any>>(\n harness: TestHarness,\n props: RenderSurfaceProps<TToken>,\n options?: HarnessRenderOptions,\n): RenderResult => {\n const { type, data, limit, fallback, placeholder } = props;\n return render(\n harness,\n <SurfaceComponent type={type} data={data as any} limit={limit} fallback={fallback} placeholder={placeholder} />,\n options,\n );\n};\n\ntype HarnessProvidersProps = PropsWithChildren<{\n harness: TestHarness;\n extra: FC<PropsWithChildren>[];\n}>;\n\nconst HarnessProviders = ({ harness, extra, children }: HarnessProvidersProps) => {\n const contributed = harness.getAll(Capabilities.ReactContext);\n const ContributedContext = composeContexts(contributed);\n const ExtraContext = composeExtra(extra);\n // Mirror useApp's provider stack (see SurfaceManager) so the unit-test render path matches the app.\n const surfaces = useMemo(() => new SurfaceManager(harness.manager.capabilities), [harness]);\n return (\n <PluginManagerProvider value={harness.manager}>\n <ContextProtocolProvider value={harness.manager} context={PluginManagerContext}>\n <RegistryContext.Provider value={harness.registry}>\n <SurfaceManagerProvider value={surfaces}>\n <ContributedContext>\n <ExtraContext>{children}</ExtraContext>\n </ContributedContext>\n </SurfaceManagerProvider>\n </RegistryContext.Provider>\n </ContextProtocolProvider>\n </PluginManagerProvider>\n );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]): FC<PropsWithChildren> => {\n if (contexts.length === 0) {\n return Passthrough;\n }\n return topologicalSort(contexts)\n .map(({ context }) => context)\n .reduce((Acc, Next) => ({ children }: PropsWithChildren) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n\n// Composes in innermost-first order: the first context in the array wraps\n// `children` directly; subsequent contexts wrap the accumulator.\nconst composeExtra = (contexts: FC<PropsWithChildren>[]): FC<PropsWithChildren> => {\n if (contexts.length === 0) {\n return Passthrough;\n }\n return contexts.reduce<FC<PropsWithChildren>>(\n (Acc, Next) =>\n ({ children }: PropsWithChildren) => (\n <Next>\n <Acc>{children}</Acc>\n </Next>\n ),\n Passthrough,\n );\n};\n\nconst Passthrough: FC<PropsWithChildren> = ({ children }) => <Fragment>{children}</Fragment>;\n"],"mappings":";;;;;;;;;;;;;AA6BA,IAAa,UAAU,SAAsB,IAAe,YAAiD;CAC3G,MAAM,EAAE,gBAAgB,CAAC,GAAG,GAAG,SAAS,WAAW,CAAC;CACpD,MAAM,WAAW,EAAE,eACjB,oBAAC,kBAAD;EAA2B;EAAS,OAAO;EACxC;CACe,CAAA;CAEpB,OAAO,SAAU,oBAAA,YAAA,EAAA,UAAG,GAAK,CAAA,GAAG;EAAE,GAAG;EAAM,SAAS;CAAQ,CAAC;AAC3D;;;;AAaA,IAAa,iBACX,SACA,OACA,YACiB;CACjB,MAAM,EAAE,MAAM,MAAM,OAAO,UAAU,gBAAgB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