@dxos/app-framework 0.10.0 → 0.11.1

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 +120 -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,399 @@
1
+ import { eventKey } from "./core/activation-event.mjs";
2
+ import { contributes } from "./core/capability.mjs";
3
+ import { a as make } from "./chunk-plugin-manager.mjs";
4
+ import { Service, addModule, define, make as make$1, makeMeta } from "./core/plugin.mjs";
5
+ import { AtomRegistry, OperationInvoker, PluginManager, ProcessManagerRuntime, ReactRoot } from "./common/capabilities.mjs";
6
+ import { SetupReactSurface, Startup } from "./common/activation-events.mjs";
7
+ import { Surface, useApp } from "./ui.mjs";
8
+ import { DXN } from "@dxos/keys";
9
+ import { getProviderValue } from "@dxos/util";
10
+ import * as Effect from "effect/Effect";
11
+ import * as Layer from "effect/Layer";
12
+ import { invariant } from "@dxos/invariant";
13
+ import * as Duration from "effect/Duration";
14
+ import * as PubSub from "effect/PubSub";
15
+ import { EffectEx } from "@dxos/effect";
16
+ import * as Queue from "effect/Queue";
17
+ import { useEffect, useState } from "react";
18
+ import { ErrorFallback } from "@dxos/react-error-boundary";
19
+ import { downloadLogs } from "@dxos/storybook-addon-logger/download";
20
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
21
+ import { raise } from "@dxos/debug";
22
+ import { useAsyncEffect } from "@dxos/react-hooks";
23
+ //#region src/testing/harness.ts
24
+ var __dxlog_file$1 = "/__w/dxos/dxos/packages/sdk/app-framework/src/testing/harness.ts";
25
+ var DEFAULT_TIMEOUT_MS = 5e3;
26
+ /**
27
+ * Creates a TestHarness with the same bootstrap sequence that `useApp` performs,
28
+ * minus the React provider tree.
29
+ *
30
+ * For Node-only tests, this is enough to fire activation events, read
31
+ * capabilities, and invoke operations.
32
+ *
33
+ * For React tests, pass the returned harness to `render` or `renderSurface`
34
+ * from `@dxos/app-framework/testing-react`.
35
+ */
36
+ var createTestApp = async (opts) => {
37
+ const { plugins, enabled = plugins.filter(({ meta }) => !meta.profile.tags?.includes("system")).map((plugin) => plugin.meta.profile.key), setupEvents = [], autoStart = true, registerFrameworkCapabilities = true } = opts;
38
+ const pluginLoader = (id) => Effect.sync(() => {
39
+ const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);
40
+ invariant(plugin, `Plugin not found: ${id}`, {
41
+ "~LogMeta": "~LogMeta",
42
+ F: __dxlog_file$1,
43
+ L: 111,
44
+ S: void 0,
45
+ A: ["plugin", "`Plugin not found: ${id}`"]
46
+ });
47
+ return { plugin };
48
+ });
49
+ const manager = make({
50
+ pluginLoader,
51
+ plugins,
52
+ enabled
53
+ });
54
+ if (registerFrameworkCapabilities) {
55
+ manager.capabilities.contribute({
56
+ interface: PluginManager,
57
+ implementation: manager,
58
+ module: "org.dxos.app-framework.plugin-manager"
59
+ });
60
+ manager.capabilities.contribute({
61
+ interface: AtomRegistry,
62
+ implementation: manager.registry,
63
+ module: "org.dxos.app-framework.atom-registry"
64
+ });
65
+ }
66
+ if (autoStart) try {
67
+ await EffectEx.runAndForwardErrors(Effect.all([
68
+ ...setupEvents.map((event) => manager.activate(event)),
69
+ manager.activate(SetupReactSurface),
70
+ manager.activate(Startup)
71
+ ]));
72
+ } catch (err) {
73
+ await EffectEx.runAndForwardErrors(manager.shutdown()).catch(() => void 0);
74
+ throw err;
75
+ }
76
+ return new TestHarnessImpl(manager);
77
+ };
78
+ var TestHarnessImpl = class {
79
+ manager;
80
+ constructor(manager) {
81
+ this.manager = manager;
82
+ }
83
+ get capabilities() {
84
+ return this.manager.capabilities;
85
+ }
86
+ get registry() {
87
+ return this.manager.registry;
88
+ }
89
+ fire(event) {
90
+ return EffectEx.runAndForwardErrors(this.manager.activate(event));
91
+ }
92
+ reset(event) {
93
+ return EffectEx.runAndForwardErrors(this.manager.reset(event));
94
+ }
95
+ get(iface) {
96
+ return this.manager.capabilities.get(iface);
97
+ }
98
+ getAll(iface) {
99
+ return this.manager.capabilities.getAll(iface);
100
+ }
101
+ waitForCapability(iface, opts) {
102
+ const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;
103
+ return EffectEx.runAndForwardErrors(this.manager.capabilities.waitFor(iface).pipe(Effect.timeoutFail({
104
+ duration: Duration.millis(timeout),
105
+ onTimeout: () => timeoutError(iface.identifier)
106
+ })));
107
+ }
108
+ waitForEvent(event, opts) {
109
+ const key = typeof event === "string" ? event : eventKey(event);
110
+ const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;
111
+ const program = Effect.gen(this, function* () {
112
+ const queue = yield* PubSub.subscribe(this.manager.activation);
113
+ if (this.manager.getEventsFired().includes(key)) return;
114
+ while (true) {
115
+ const message = yield* Queue.take(queue);
116
+ if (message.event === key && message.state === "activated") return;
117
+ }
118
+ }).pipe(Effect.scoped, Effect.timeoutFail({
119
+ duration: Duration.millis(timeout),
120
+ onTimeout: () => timeoutError(key)
121
+ }));
122
+ return EffectEx.runAndForwardErrors(program);
123
+ }
124
+ async invoke(op, ...args) {
125
+ const result = await (await this.waitForCapability(OperationInvoker)).invokePromise(op, ...args);
126
+ if (result.error) throw result.error;
127
+ return result.data;
128
+ }
129
+ async runPromise(effect, options) {
130
+ return (await this.waitForCapability(ProcessManagerRuntime, { timeout: options?.timeout })).runPromise(effect, options?.signal ? { signal: options.signal } : void 0);
131
+ }
132
+ enable(id) {
133
+ return EffectEx.runAndForwardErrors(this.manager.enable(id));
134
+ }
135
+ disable(id) {
136
+ return EffectEx.runAndForwardErrors(this.manager.disable(id));
137
+ }
138
+ async dispose() {
139
+ await EffectEx.runAndForwardErrors(this.manager.shutdown());
140
+ }
141
+ [Symbol.asyncDispose]() {
142
+ return this.dispose();
143
+ }
144
+ };
145
+ var timeoutError = (id) => /* @__PURE__ */ new Error(`Timed out waiting for ${id}`);
146
+ //#endregion
147
+ //#region src/testing/operationCapture.ts
148
+ /**
149
+ * Creates a capture that wraps the real `Capabilities.OperationInvoker`:
150
+ *
151
+ * - **Mocked operations** (declared in `mockedOperations`) are intercepted: the call is recorded
152
+ * and returns `{ data: undefined }` without executing. Use this for side-effecting operations
153
+ * you don't want to run in tests, such as `LayoutOperation.Open` (navigation).
154
+ *
155
+ * - **All other operations** are forwarded to the real invoker and still execute normally. The
156
+ * call is still recorded so you can assert it was triggered even though it ran for real.
157
+ *
158
+ * Pass a `spyFn` wrapper (e.g. `fn` from `storybook/test`) to get Storybook Actions panel
159
+ * integration and vi-style matchers on the recording.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * import { fn } from 'storybook/test';
164
+ *
165
+ * const capture = makeOperationCapture(
166
+ * // These ops are mocked: captured but not executed.
167
+ * [AssistantOperation.RunPromptInNewChat, LayoutOperation.Open],
168
+ * fn,
169
+ * );
170
+ *
171
+ * // Wire into withPluginManager:
172
+ * capabilities: (manager) => capture.wrap(manager)
173
+ *
174
+ * // Assert in a play function:
175
+ * const calls = capture.getCalls(AssistantOperation.RunPromptInNewChat);
176
+ * expect(calls).toHaveLength(1);
177
+ * expect(calls[0].input.prompt).toBe('Draft a new document');
178
+ * ```
179
+ *
180
+ * @idiom org.dxos.app-framework.testing.operationCapture
181
+ * applies: Storybook play-function tests for components that call plugin operations
182
+ * instead-of: Loading every plugin whose operations the component triggers
183
+ * uses: {@link makeOperationCapture}, {@link withPluginManager}
184
+ */
185
+ var makeOperationCapture = (mockedOperations, spyFn) => {
186
+ const calls = [];
187
+ const mockedKeys = new Set(mockedOperations.map((op) => String(op.meta.key)));
188
+ const record = (op, input) => {
189
+ calls.push({
190
+ operationKey: String(op.meta.key),
191
+ input: input ?? {}
192
+ });
193
+ };
194
+ const recordFn = spyFn ? spyFn(record) : record;
195
+ return {
196
+ wrap(manager) {
197
+ let real;
198
+ const delegate = () => {
199
+ if (!real) real = manager.getAll(OperationInvoker).find((inv) => inv !== wrapped);
200
+ return real;
201
+ };
202
+ const wrapped = {
203
+ get invocations() {
204
+ return delegate().invocations;
205
+ },
206
+ get pendingFollowups() {
207
+ return delegate().pendingFollowups;
208
+ },
209
+ get awaitFollowups() {
210
+ return delegate().awaitFollowups;
211
+ },
212
+ invoke: (op, input, ...rest) => {
213
+ recordFn(op, input);
214
+ if (mockedKeys.has(String(op.meta.key))) return Effect.succeed(void 0);
215
+ return delegate().invoke(op, input, ...rest);
216
+ },
217
+ invokePromise: async (op, input, ...rest) => {
218
+ recordFn(op, input);
219
+ if (mockedKeys.has(String(op.meta.key))) return { data: void 0 };
220
+ return delegate().invokePromise(op, input, ...rest);
221
+ },
222
+ schedule: (op, input, ...rest) => {
223
+ recordFn(op, input);
224
+ if (mockedKeys.has(String(op.meta.key))) return Effect.succeed(void 0);
225
+ return delegate().schedule(op, input, ...rest);
226
+ }
227
+ };
228
+ return [contributes(OperationInvoker, wrapped)];
229
+ },
230
+ getCalls(op) {
231
+ const key = String(op.meta.key);
232
+ return calls.filter((c) => c.operationKey === key);
233
+ },
234
+ reset() {
235
+ calls.length = 0;
236
+ }
237
+ };
238
+ };
239
+ //#endregion
240
+ //#region src/testing/service.ts
241
+ var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/testing/service.ts";
242
+ /**
243
+ * Creates a Plugin.Service layer from a list of plugins.
244
+ * This is primarily used for testing.
245
+ */
246
+ var fromPlugins = (plugins) => Layer.effect(Service, Effect.gen(function* () {
247
+ const pluginLoader = (id) => Effect.sync(() => {
248
+ const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);
249
+ invariant(plugin, `Plugin not found: ${id}`, {
250
+ "~LogMeta": "~LogMeta",
251
+ F: __dxlog_file,
252
+ L: 26,
253
+ S: this,
254
+ A: ["plugin", "`Plugin not found: ${id}`"]
255
+ });
256
+ return { plugin };
257
+ });
258
+ const manager = make({
259
+ pluginLoader,
260
+ plugins,
261
+ enabled: plugins.map((plugin) => plugin.meta.profile.key)
262
+ });
263
+ manager.capabilities.contribute({
264
+ interface: PluginManager,
265
+ implementation: manager,
266
+ module: "org.dxos.app-framework.plugin-manager"
267
+ });
268
+ manager.capabilities.contribute({
269
+ interface: AtomRegistry,
270
+ implementation: manager.registry,
271
+ module: "org.dxos.app-framework.atom-registry"
272
+ });
273
+ yield* manager.activate(Startup);
274
+ return manager;
275
+ }));
276
+ //#endregion
277
+ //#region src/testing/StorybookErrorFallback.tsx
278
+ /**
279
+ * Default `ErrorBoundary` fallback for storybook-hosted apps (`withPluginManager`/`useApp`). Adds
280
+ * a "Download logs" action alongside the theme-independent default `ErrorFallback`, so a crashed
281
+ * story still offers a one-click way to grab the story's buffered logs, matching the manager
282
+ * toolbar's button (see `@dxos/storybook-addon-logger`).
283
+ *
284
+ * Deliberately does NOT depend on `@dxos/react-ui`'s themed components: `useApp`'s `ErrorBoundary`
285
+ * can catch failures that happen before/during an app's own theme setup, so its fallback must keep
286
+ * working even when no theme context is available — the same reason `ErrorFallback` itself uses
287
+ * inline styles rather than Tailwind/theme dependencies.
288
+ */
289
+ var StorybookErrorFallback = (props) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(ErrorFallback, { ...props }), /* @__PURE__ */ jsx("button", {
290
+ type: "button",
291
+ onClick: downloadLogs,
292
+ style: {
293
+ margin: "0 1rem 1rem",
294
+ padding: "0.25rem 0.75rem",
295
+ fontSize: "0.875rem",
296
+ background: "transparent",
297
+ border: "1px solid #888888",
298
+ borderRadius: "0.375rem",
299
+ cursor: "pointer"
300
+ },
301
+ children: "Download logs"
302
+ })] });
303
+ //#endregion
304
+ //#region src/testing/withPluginManager.tsx
305
+ /**
306
+ * @internal
307
+ */
308
+ var setupPluginManager = ({ capabilities, plugins = [], ...options } = {}) => {
309
+ const enabled = plugins.filter(({ meta }) => !meta.profile.tags?.includes("system")).map(({ meta }) => meta.profile.key);
310
+ const pluginManager = make({
311
+ pluginLoader: () => raise(/* @__PURE__ */ new Error("Not implemented")),
312
+ plugins: [StoryPlugin, ...plugins],
313
+ enabled,
314
+ ...options
315
+ });
316
+ if (capabilities) getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {
317
+ pluginManager.capabilities.contribute({
318
+ interface: capability.interface,
319
+ implementation: capability.implementation,
320
+ module: "story"
321
+ });
322
+ });
323
+ return pluginManager;
324
+ };
325
+ /**
326
+ * Wraps a story with a plugin manager.
327
+ * NOTE: This builds up and tears down the plugin manager on every render.
328
+ */
329
+ var withPluginManager = (init = {}) => {
330
+ return (Story, context) => {
331
+ const storyId = context.id;
332
+ const options = typeof init === "function" ? init(context) : init;
333
+ const [managerState, setManagerState] = useState();
334
+ useEffect(() => {
335
+ const pluginManager = setupPluginManager(options);
336
+ const capability = contributes(ReactRoot, {
337
+ id: storyId,
338
+ root: () => /* @__PURE__ */ jsx(Story, {})
339
+ });
340
+ pluginManager.capabilities.contribute({
341
+ ...capability,
342
+ module: "org.dxos.app-framework.with-plugin-manager"
343
+ });
344
+ setManagerState({
345
+ pluginManager,
346
+ setupEvents: options.setupEvents,
347
+ fireEvents: options.fireEvents,
348
+ fallback: options.fallback,
349
+ storyId
350
+ });
351
+ return () => {
352
+ pluginManager.capabilities.remove(capability.interface, capability.implementation);
353
+ EffectEx.runAndForwardErrors(pluginManager.shutdown());
354
+ };
355
+ }, [storyId, init]);
356
+ if (!managerState || managerState.storyId !== storyId) return /* @__PURE__ */ jsx(Fragment$1, {});
357
+ return /* @__PURE__ */ jsx(WithPluginManagerApp, { ...managerState });
358
+ };
359
+ };
360
+ var WithPluginManagerApp = ({ fallback, fireEvents, pluginManager, setupEvents, storyId }) => {
361
+ useAsyncEffect(async () => {
362
+ await Promise.all(fireEvents?.map((event) => pluginManager.activate(event)) ?? []);
363
+ }, [
364
+ fireEvents,
365
+ pluginManager,
366
+ storyId
367
+ ]);
368
+ return /* @__PURE__ */ jsx(useApp({
369
+ pluginManager,
370
+ setupEvents,
371
+ fallback: fallback ?? StorybookErrorFallback
372
+ }), {});
373
+ };
374
+ var StoryPlugin = define(makeMeta({
375
+ key: DXN.make("org.dxos.appFramework.story"),
376
+ name: "Story",
377
+ tags: ["system"]
378
+ })).pipe(addModule({
379
+ id: "Story",
380
+ activatesOn: Startup,
381
+ activate: () => Effect.succeed([])
382
+ }), make$1)();
383
+ //#endregion
384
+ //#region src/testing/withSurfaceDebug.tsx
385
+ /**
386
+ * Storybook decorator that enables the surface debug overlays (`<dx-surface>` wrappers + boundary
387
+ * badges) for the wrapped story. The flag is a `window` singleton, so it is (re)applied on every
388
+ * render — enabling it on decorated stories and clearing it otherwise, so the setting never leaks
389
+ * between stories. Prefer this over the `.storybook/preview` flag when the story must also render
390
+ * under the aggregate root Storybook, which does not load a per-package preview.
391
+ */
392
+ var withSurfaceDebug = (enabled = true) => (Story) => {
393
+ Surface.setDebug(enabled);
394
+ return /* @__PURE__ */ jsx(Story, {});
395
+ };
396
+ //#endregion
397
+ export { StorybookErrorFallback, createTestApp, fromPlugins, makeOperationCapture, setupPluginManager, withPluginManager, withSurfaceDebug };
398
+
399
+ //# sourceMappingURL=testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.mjs","names":[],"sources":["../../src/testing/harness.ts","../../src/testing/operationCapture.ts","../../src/testing/service.ts","../../src/testing/StorybookErrorFallback.tsx","../../src/testing/withPluginManager.tsx","../../src/testing/withSurfaceDebug.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Registry } from '@effect-atom/atom';\nimport * as Duration from 'effect/Duration';\nimport * as Effect from 'effect/Effect';\nimport * as PubSub from 'effect/PubSub';\nimport * as Queue from 'effect/Queue';\n\nimport { type Operation } from '@dxos/compute';\nimport { EffectEx } from '@dxos/effect';\nimport { invariant } from '@dxos/invariant';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { ActivationEvent, type Capability, type CapabilityManager, type Plugin, PluginManager } from '../core';\n\nexport type TestAppOptions = {\n /**\n * Plugins to register. Plugins whose `meta.profile.tags` includes `'system'` are treated as core\n * (force-enabled). For test convenience, plugins without a `'system'` tag are enabled by\n * default unless `enabled` is provided.\n */\n plugins: Plugin.Plugin[];\n /** Plugin ids that are enabled by default in addition to core. Defaults to all non-system plugin ids. */\n enabled?: string[];\n /** Additional activation events fired alongside SetupReactSurface. */\n setupEvents?: ActivationEvent.ActivationEvent[];\n /**\n * Whether to automatically fire SetupReactSurface + Startup during setup.\n * Defaults to true.\n */\n autoStart?: boolean;\n /**\n * Whether to register the PluginManager + AtomRegistry framework capabilities.\n * Defaults to true.\n */\n registerFrameworkCapabilities?: boolean;\n};\n\n/**\n * A running plugin manager plus helpers for driving it in tests.\n */\nexport interface TestHarness {\n readonly manager: PluginManager.PluginManager;\n readonly capabilities: CapabilityManager.CapabilityManager;\n readonly registry: Registry.Registry;\n\n /** Activate the given event. Equivalent to `manager.activate(event)`. */\n fire(event: ActivationEvent.ActivationEvent | string): Promise<boolean>;\n /** Re-activate all modules that were activated by the given event. */\n reset(event: ActivationEvent.ActivationEvent | string): Promise<boolean>;\n\n /** Returns the first contributed capability for the given interface. Throws if none are present. */\n get<T>(iface: Capability.InterfaceDef<T>): T;\n /** Returns all contributed capabilities for the given interface. */\n getAll<T>(iface: Capability.InterfaceDef<T>): T[];\n /** Waits until at least one capability is contributed for the given interface. */\n waitForCapability<T>(iface: Capability.InterfaceDef<T>, opts?: { timeout?: number }): Promise<T>;\n /** Waits until the given activation event has completed. */\n waitForEvent(event: ActivationEvent.ActivationEvent | string, opts?: { timeout?: number }): Promise<void>;\n\n /** Invokes an operation through the `Capabilities.OperationInvoker` capability. */\n invoke<I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I] : [input: I]): Promise<O>;\n\n /**\n * Waits for `Capabilities.ProcessManagerRuntime` and runs the given effect on it.\n * Convenience around `waitForCapability(ProcessManagerRuntime).runPromise(effect)`.\n */\n runPromise<A, E>(\n effect: Effect.Effect<A, E, Capabilities.ProcessManagerRuntimeServices>,\n options?: { readonly timeout?: number; readonly signal?: AbortSignal },\n ): Promise<A>;\n\n enable(id: string): Promise<boolean>;\n disable(id: string): Promise<boolean>;\n\n /** Shuts down the underlying plugin manager. */\n dispose(): Promise<void>;\n\n /** Async-disposable support so tests can use `await using harness = ...`. */\n [Symbol.asyncDispose](): Promise<void>;\n}\n\nconst DEFAULT_TIMEOUT_MS = 5_000;\n\n/**\n * Creates a TestHarness with the same bootstrap sequence that `useApp` performs,\n * minus the React provider tree.\n *\n * For Node-only tests, this is enough to fire activation events, read\n * capabilities, and invoke operations.\n *\n * For React tests, pass the returned harness to `render` or `renderSurface`\n * from `@dxos/app-framework/testing-react`.\n */\nexport const createTestApp = async (opts: TestAppOptions): Promise<TestHarness> => {\n const {\n plugins,\n enabled = plugins\n .filter(({ meta }) => !meta.profile.tags?.includes('system'))\n .map((plugin) => plugin.meta.profile.key),\n setupEvents = [],\n autoStart = true,\n registerFrameworkCapabilities = true,\n } = opts;\n\n const pluginLoader = (id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return { plugin };\n });\n\n const manager = PluginManager.make({ pluginLoader, plugins, enabled });\n\n if (registerFrameworkCapabilities) {\n manager.capabilities.contribute({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'org.dxos.app-framework.plugin-manager',\n });\n manager.capabilities.contribute({\n interface: Capabilities.AtomRegistry,\n implementation: manager.registry,\n module: 'org.dxos.app-framework.atom-registry',\n });\n }\n\n if (autoStart) {\n try {\n await EffectEx.runAndForwardErrors(\n Effect.all([\n ...setupEvents.map((event) => manager.activate(event)),\n manager.activate(ActivationEvents.SetupReactSurface),\n manager.activate(ActivationEvents.Startup),\n ]),\n );\n } catch (err) {\n await EffectEx.runAndForwardErrors(manager.shutdown()).catch(() => undefined);\n throw err;\n }\n }\n\n return new TestHarnessImpl(manager);\n};\n\nclass TestHarnessImpl implements TestHarness {\n constructor(readonly manager: PluginManager.PluginManager) {}\n\n get capabilities(): CapabilityManager.CapabilityManager {\n return this.manager.capabilities;\n }\n\n get registry(): Registry.Registry {\n return this.manager.registry;\n }\n\n fire(event: ActivationEvent.ActivationEvent | string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.activate(event));\n }\n\n reset(event: ActivationEvent.ActivationEvent | string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.reset(event));\n }\n\n get<T>(iface: Capability.InterfaceDef<T>): T {\n return this.manager.capabilities.get(iface);\n }\n\n getAll<T>(iface: Capability.InterfaceDef<T>): T[] {\n return this.manager.capabilities.getAll(iface);\n }\n\n waitForCapability<T>(iface: Capability.InterfaceDef<T>, opts?: { timeout?: number }): Promise<T> {\n const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;\n return EffectEx.runAndForwardErrors(\n this.manager.capabilities.waitFor(iface).pipe(\n Effect.timeoutFail({\n duration: Duration.millis(timeout),\n onTimeout: () => timeoutError(iface.identifier),\n }),\n ),\n );\n }\n\n waitForEvent(event: ActivationEvent.ActivationEvent | string, opts?: { timeout?: number }): Promise<void> {\n const key = typeof event === 'string' ? event : ActivationEvent.eventKey(event);\n const timeout = opts?.timeout ?? DEFAULT_TIMEOUT_MS;\n\n const program = Effect.gen(this, function* () {\n const queue = yield* PubSub.subscribe(this.manager.activation);\n // Re-check after subscribing to avoid a race where the event fires\n // between the caller invoking this and the subscription being installed.\n if (this.manager.getEventsFired().includes(key)) {\n return;\n }\n while (true) {\n const message = yield* Queue.take(queue);\n if (message.event === key && message.state === 'activated') {\n return;\n }\n }\n }).pipe(\n Effect.scoped,\n Effect.timeoutFail({\n duration: Duration.millis(timeout),\n onTimeout: () => timeoutError(key),\n }),\n );\n\n return EffectEx.runAndForwardErrors(program);\n }\n\n async invoke<I, O>(op: Operation.Definition<I, O>, ...args: [input?: I]): Promise<O> {\n const invoker = await this.waitForCapability(Capabilities.OperationInvoker);\n const result = await invoker.invokePromise(op as any, ...(args as [any]));\n if (result.error) {\n throw result.error;\n }\n return result.data as O;\n }\n\n async runPromise<A, E>(\n effect: Effect.Effect<A, E, Capabilities.ProcessManagerRuntimeServices>,\n options?: { readonly timeout?: number; readonly signal?: AbortSignal },\n ): Promise<A> {\n const runtime = await this.waitForCapability(Capabilities.ProcessManagerRuntime, { timeout: options?.timeout });\n return runtime.runPromise(effect, options?.signal ? { signal: options.signal } : undefined);\n }\n\n enable(id: string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.enable(id));\n }\n\n disable(id: string): Promise<boolean> {\n return EffectEx.runAndForwardErrors(this.manager.disable(id));\n }\n\n async dispose(): Promise<void> {\n await EffectEx.runAndForwardErrors(this.manager.shutdown());\n }\n\n [Symbol.asyncDispose](): Promise<void> {\n return this.dispose();\n }\n}\n\nconst timeoutError = (id: string) => new Error(`Timed out waiting for ${id}`);\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { type Operation } from '@dxos/compute';\n\nimport { Capabilities } from '../common';\nimport { Capability } from '../core';\n\nexport type CapturedCall<I = unknown> = {\n /** The DXN key string of the invoked operation. */\n operationKey: string;\n /** The input passed to the operation. */\n input: I;\n};\n\ntype CapabilityManagerLike = {\n get: (cap: Capability.InterfaceDef<Capabilities.OperationInvoker>) => Capabilities.OperationInvoker;\n getAll: (cap: Capability.InterfaceDef<Capabilities.OperationInvoker>) => Capabilities.OperationInvoker[];\n};\n\nexport type OperationCapture = {\n /**\n * Wraps the real OperationInvoker from the given manager. Pass to\n * `withPluginManager({ capabilities: (m) => capture.wrap(m) })`.\n */\n wrap(manager: CapabilityManagerLike): Capability.Any[];\n /** Returns all recorded calls (mocked or real) for the given operation. */\n getCalls<I, O>(op: Operation.Definition<I, O>): CapturedCall<I>[];\n /** Clears all recorded calls (useful between play function steps). */\n reset(): void;\n};\n\n/**\n * Creates a capture that wraps the real `Capabilities.OperationInvoker`:\n *\n * - **Mocked operations** (declared in `mockedOperations`) are intercepted: the call is recorded\n * and returns `{ data: undefined }` without executing. Use this for side-effecting operations\n * you don't want to run in tests, such as `LayoutOperation.Open` (navigation).\n *\n * - **All other operations** are forwarded to the real invoker and still execute normally. The\n * call is still recorded so you can assert it was triggered even though it ran for real.\n *\n * Pass a `spyFn` wrapper (e.g. `fn` from `storybook/test`) to get Storybook Actions panel\n * integration and vi-style matchers on the recording.\n *\n * @example\n * ```ts\n * import { fn } from 'storybook/test';\n *\n * const capture = makeOperationCapture(\n * // These ops are mocked: captured but not executed.\n * [AssistantOperation.RunPromptInNewChat, LayoutOperation.Open],\n * fn,\n * );\n *\n * // Wire into withPluginManager:\n * capabilities: (manager) => capture.wrap(manager)\n *\n * // Assert in a play function:\n * const calls = capture.getCalls(AssistantOperation.RunPromptInNewChat);\n * expect(calls).toHaveLength(1);\n * expect(calls[0].input.prompt).toBe('Draft a new document');\n * ```\n *\n * @idiom org.dxos.app-framework.testing.operationCapture\n * applies: Storybook play-function tests for components that call plugin operations\n * instead-of: Loading every plugin whose operations the component triggers\n * uses: {@link makeOperationCapture}, {@link withPluginManager}\n */\nexport const makeOperationCapture = (\n mockedOperations: readonly Operation.Definition.Any[],\n spyFn?: (impl: (...args: any[]) => any) => any,\n): OperationCapture => {\n const calls: CapturedCall[] = [];\n\n const mockedKeys = new Set(mockedOperations.map((op) => String(op.meta.key)));\n\n const record = (op: Operation.Definition<any, any>, input?: unknown) => {\n calls.push({ operationKey: String(op.meta.key), input: input ?? {} });\n };\n\n const recordFn = spyFn ? spyFn(record) : record;\n\n return {\n wrap(manager) {\n // Use getAll to find the real invoker that was registered before our wrapper. manager.get\n // returns the last contribution (ours, once added), but getAll returns them all in order.\n // On first invocation (when activation is complete) we find the non-wrapper contribution.\n let real: Capabilities.OperationInvoker | undefined;\n const delegate = () => {\n if (!real) {\n const all = manager.getAll(Capabilities.OperationInvoker);\n real = all.find((inv) => inv !== wrapped);\n }\n return real;\n };\n\n const wrapped: Capabilities.OperationInvoker = {\n get invocations() {\n return delegate()!.invocations;\n },\n get pendingFollowups() {\n return delegate()!.pendingFollowups;\n },\n get awaitFollowups() {\n return delegate()!.awaitFollowups;\n },\n invoke: (op: Operation.Definition<any, any>, input?: unknown, ...rest: any[]) => {\n recordFn(op, input);\n if (mockedKeys.has(String(op.meta.key))) {\n return Effect.succeed(undefined as any);\n }\n return (delegate()!.invoke as any)(op, input, ...rest);\n },\n invokePromise: async (op: Operation.Definition<any, any>, input?: unknown, ...rest: any[]) => {\n recordFn(op, input);\n if (mockedKeys.has(String(op.meta.key))) {\n return { data: undefined };\n }\n return (delegate()!.invokePromise as any)(op, input, ...rest);\n },\n schedule: (op: Operation.Definition<any, any>, input?: unknown, ...rest: any[]) => {\n recordFn(op, input);\n if (mockedKeys.has(String(op.meta.key))) {\n return Effect.succeed(undefined);\n }\n return (delegate()!.schedule as any)(op, input, ...rest);\n },\n };\n\n return [Capability.contributes(Capabilities.OperationInvoker, wrapped)];\n },\n getCalls<I, O>(op: Operation.Definition<I, O>): CapturedCall<I>[] {\n const key = String(op.meta.key);\n return calls.filter((c) => c.operationKey === key) as CapturedCall<I>[];\n },\n reset() {\n calls.length = 0;\n },\n };\n};\n","//\n// Copyright 2025 DXOS.org\n//\n\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 { Plugin, PluginManager } from '../core';\n\n/**\n * Creates a Plugin.Service layer from a list of plugins.\n * This is primarily used for testing.\n */\nexport const fromPlugins = (plugins: Plugin.Plugin[]) =>\n Layer.effect(\n Plugin.Service,\n Effect.gen(function* () {\n // TODO(wittjosiah): Try to dedupe logic between here, createCliApp and useApp.\n\n const pluginLoader = (id: string) =>\n Effect.sync(() => {\n const plugin = plugins.find((plugin) => plugin.meta.profile.key === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return { plugin };\n });\n\n const manager = PluginManager.make({\n pluginLoader,\n plugins,\n enabled: plugins.map((plugin) => plugin.meta.profile.key),\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 yield* manager.activate(ActivationEvents.Startup);\n\n return manager;\n }),\n );\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport React from 'react';\n\nimport { ErrorFallback, type FallbackProps } from '@dxos/react-error-boundary';\nimport { downloadLogs } from '@dxos/storybook-addon-logger/download';\n\n/**\n * Default `ErrorBoundary` fallback for storybook-hosted apps (`withPluginManager`/`useApp`). Adds\n * a \"Download logs\" action alongside the theme-independent default `ErrorFallback`, so a crashed\n * story still offers a one-click way to grab the story's buffered logs, matching the manager\n * toolbar's button (see `@dxos/storybook-addon-logger`).\n *\n * Deliberately does NOT depend on `@dxos/react-ui`'s themed components: `useApp`'s `ErrorBoundary`\n * can catch failures that happen before/during an app's own theme setup, so its fallback must keep\n * working even when no theme context is available — the same reason `ErrorFallback` itself uses\n * inline styles rather than Tailwind/theme dependencies.\n */\nexport const StorybookErrorFallback = (props: FallbackProps) => (\n <div>\n <ErrorFallback {...props} />\n <button\n type='button'\n onClick={downloadLogs}\n style={{\n margin: '0 1rem 1rem',\n padding: '0.25rem 0.75rem',\n fontSize: '0.875rem',\n background: 'transparent',\n border: '1px solid #888888',\n borderRadius: '0.375rem',\n cursor: 'pointer',\n }}\n >\n Download logs\n </button>\n </div>\n);\n","//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator, type StoryContext } from '@storybook/react';\nimport * as Effect from 'effect/Effect';\nimport React, { useEffect, useState } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { EffectEx } from '@dxos/effect';\nimport { DXN } from '@dxos/keys';\nimport { useAsyncEffect } from '@dxos/react-hooks';\nimport { type MaybeProvider, getProviderValue } from '@dxos/util';\n\nimport { ActivationEvents, Capabilities } from '../common';\nimport { type ActivationEvent, Capability, type CapabilityManager, Plugin, PluginManager } from '../core';\nimport { type UseAppOptions, useApp } from '../ui';\nimport { StorybookErrorFallback } from './StorybookErrorFallback';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n ...options\n}: UseAppOptions & Pick<WithPluginManagerOptions, 'capabilities'> = {}) => {\n // Auto-enable every non-system plugin so stories don't have to spell out\n // enablement. System-tagged plugins are force-enabled by the manager.\n const enabled = plugins\n .filter(({ meta }) => !meta.profile.tags?.includes('system'))\n .map(({ meta }) => meta.profile.key);\n const pluginManager = PluginManager.make({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin, ...plugins],\n enabled,\n ...options,\n });\n\n if (capabilities) {\n getProviderValue(capabilities, pluginManager.capabilities).forEach((capability) => {\n pluginManager.capabilities.contribute({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\ntype ManagedPluginManagerState = {\n fallback?: UseAppOptions['fallback'];\n fireEvents?: (ActivationEvent.ActivationEvent | string)[];\n pluginManager: PluginManager.PluginManager;\n setupEvents?: ActivationEvent.ActivationEvent[];\n storyId: string;\n};\n\nexport type WithPluginManagerOptions = UseAppOptions & {\n /** @deprecated */\n capabilities?: MaybeProvider<Capability.Any[], CapabilityManager.CapabilityManager>;\n /** @deprecated */\n fireEvents?: (ActivationEvent.ActivationEvent | string)[];\n};\n\nexport type WithPluginManagerInitializer<Args = void> =\n | WithPluginManagerOptions\n | ((context: StoryContext<Args>) => WithPluginManagerOptions);\n\n/**\n * Wraps a story with a plugin manager.\n * NOTE: This builds up and tears down the plugin manager on every render.\n */\nexport const withPluginManager = <Args,>(init: WithPluginManagerInitializer<Args> = {}): Decorator => {\n return (Story, context) => {\n const storyId = context.id;\n const options = typeof init === 'function' ? init(context as any) : init;\n const [managerState, setManagerState] = useState<ManagedPluginManagerState>();\n\n // Storybook replaces the full context object often, so key manager ownership by story id.\n useEffect(() => {\n const pluginManager = setupPluginManager(options);\n const capability = Capability.contributes(Capabilities.ReactRoot, {\n id: storyId,\n root: () => <Story />,\n });\n\n pluginManager.capabilities.contribute({\n ...capability,\n module: 'org.dxos.app-framework.with-plugin-manager',\n });\n\n setManagerState({\n pluginManager,\n setupEvents: options.setupEvents,\n fireEvents: options.fireEvents,\n fallback: options.fallback,\n storyId,\n });\n\n return () => {\n pluginManager.capabilities.remove(capability.interface, capability.implementation);\n void EffectEx.runAndForwardErrors(pluginManager.shutdown());\n };\n }, [storyId, init]);\n\n // Avoid mounting useApp with a stale manager from the previous story.\n if (!managerState || managerState.storyId !== storyId) {\n return <></>;\n }\n\n return <WithPluginManagerApp {...managerState} />;\n };\n};\n\nconst WithPluginManagerApp = ({\n fallback,\n fireEvents,\n pluginManager,\n setupEvents,\n storyId,\n}: ManagedPluginManagerState) => {\n // Fire deprecated events only after the effect-owned manager for this story exists.\n useAsyncEffect(async () => {\n await Promise.all(fireEvents?.map((event) => pluginManager.activate(event)) ?? []);\n }, [fireEvents, pluginManager, storyId]);\n\n // Default to a fallback that offers \"Download logs\" so a crashed story is still debuggable;\n // callers can override via `withPluginManager({ fallback })`.\n const App = useApp({ pluginManager, setupEvents, fallback: fallback ?? StorybookErrorFallback });\n return <App />;\n};\n\nconst storyMeta = Plugin.makeMeta({\n key: DXN.make('org.dxos.appFramework.story'),\n name: 'Story',\n tags: ['system'],\n});\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst StoryPlugin = Plugin.define(storyMeta).pipe(\n Plugin.addModule({\n id: 'Story',\n activatesOn: ActivationEvents.Startup,\n activate: () => Effect.succeed([]),\n }),\n Plugin.make,\n)();\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React from 'react';\n\nimport { Surface } from '../ui';\n\n/**\n * Storybook decorator that enables the surface debug overlays (`<dx-surface>` wrappers + boundary\n * badges) for the wrapped story. The flag is a `window` singleton, so it is (re)applied on every\n * render — enabling it on decorated stories and clearing it otherwise, so the setting never leaks\n * between stories. Prefer this over the `.storybook/preview` flag when the story must also render\n * under the aggregate root Storybook, which does not load a per-package preview.\n */\nexport const withSurfaceDebug =\n (enabled = true): Decorator =>\n (Story) => {\n Surface.setDebug(enabled);\n return <Story />;\n };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoFA,IAAM,qBAAqB;;;;;;;;;;;AAY3B,IAAa,gBAAgB,OAAO,SAA+C;CACjF,MAAM,EACJ,SACA,UAAU,QACP,QAAQ,EAAE,WAAW,CAAC,KAAK,QAAQ,MAAM,SAAS,QAAQ,CAAC,CAAA,CAC3D,KAAK,WAAW,OAAO,KAAK,QAAQ,GAAG,GAC1C,cAAc,CAAC,GACf,YAAY,MACZ,gCAAgC,SAC9B;CAEJ,MAAM,gBAAgB,OACpB,OAAO,WAAW;EAChB,MAAM,SAAS,QAAQ,MAAM,WAAW,OAAO,KAAK,QAAQ,QAAQ,EAAE;EACtE,UAAU,QAAQ,qBAAqB,MAAG;GAAA,YAAA;GAAA,GAAA;GAAA,GAAA;GAAA,GAAA,KAAA;GAAA,GAAA,CAAA,UAAA,2BAAA;EAAA,CAAC;EAC3C,OAAO,EAAE,OAAO;CAClB,CAAC;CAEH,MAAM,UAAU,KAAmB;EAAE;EAAc;EAAS;CAAQ,CAAC;CAErE,IAAI,+BAA+B;EACjC,QAAQ,aAAa,WAAW;GAC9B,WAAW;GACX,gBAAgB;GAChB,QAAQ;EACV,CAAC;EACD,QAAQ,aAAa,WAAW;GAC9B,WAAW;GACX,gBAAgB,QAAQ;GACxB,QAAQ;EACV,CAAC;CACH;CAEA,IAAI,WACF,IAAI;EACF,MAAM,SAAS,oBACb,OAAO,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