@dxos/app-framework 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446

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 (326) hide show
  1. package/dist/lib/browser/{app-graph-builder-6E7NCZ77.mjs → app-graph-builder-576BHZC7.mjs} +23 -23
  2. package/dist/lib/browser/app-graph-builder-576BHZC7.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-2KSDY3EZ.mjs → chunk-6AVTZPMT.mjs} +267 -325
  4. package/dist/lib/browser/chunk-6AVTZPMT.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-K3HOLGVH.mjs → chunk-PPIBZ5N4.mjs} +28 -40
  6. package/dist/lib/browser/chunk-PPIBZ5N4.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-KPRHX73H.mjs → chunk-SFPT4Z2C.mjs} +9 -9
  8. package/dist/lib/browser/chunk-SFPT4Z2C.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +8 -10
  10. package/dist/lib/browser/index.mjs.map +1 -1
  11. package/dist/lib/browser/{intent-dispatcher-VGUJBPPN.mjs → intent-dispatcher-3Q67MHZZ.mjs} +2 -2
  12. package/dist/lib/browser/{intent-resolver-QLFZY5R5.mjs → intent-resolver-O763LCLG.mjs} +3 -3
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/{store-QGVXOY4T.mjs → store-URSN7DZI.mjs} +6 -7
  15. package/dist/lib/browser/store-URSN7DZI.mjs.map +7 -0
  16. package/dist/lib/browser/testing/index.mjs +3 -7
  17. package/dist/lib/browser/testing/index.mjs.map +3 -3
  18. package/dist/lib/browser/worker.mjs +3 -5
  19. package/dist/lib/node/app-graph-builder-JZCSKYPY.cjs +146 -0
  20. package/dist/lib/node/app-graph-builder-JZCSKYPY.cjs.map +7 -0
  21. package/dist/lib/node/{chunk-JQMNABMK.cjs → chunk-JUSEAFDU.cjs} +4 -4
  22. package/dist/lib/node/chunk-JUSEAFDU.cjs.map +7 -0
  23. package/dist/lib/node/{chunk-2EBZ2ICH.cjs → chunk-YIFTVCOR.cjs} +247 -304
  24. package/dist/lib/node/chunk-YIFTVCOR.cjs.map +7 -0
  25. package/dist/lib/node/{chunk-7J66KH2T.cjs → chunk-YNTKVTVX.cjs} +67 -79
  26. package/dist/lib/node/chunk-YNTKVTVX.cjs.map +7 -0
  27. package/dist/lib/node/index.cjs +79 -81
  28. package/dist/lib/node/index.cjs.map +1 -1
  29. package/dist/lib/node/{intent-dispatcher-TASJBG5M.cjs → intent-dispatcher-H334XLFD.cjs} +8 -8
  30. package/dist/lib/node/{intent-dispatcher-TASJBG5M.cjs.map → intent-dispatcher-H334XLFD.cjs.map} +2 -2
  31. package/dist/lib/node/{intent-resolver-5CG5NIJY.cjs → intent-resolver-3F4POWAM.cjs} +12 -12
  32. package/dist/lib/node/meta.json +1 -1
  33. package/dist/lib/node/{store-IF3UR2KA.cjs → store-OFDHTDCB.cjs} +9 -10
  34. package/dist/lib/node/store-OFDHTDCB.cjs.map +7 -0
  35. package/dist/lib/node/testing/index.cjs +9 -14
  36. package/dist/lib/node/testing/index.cjs.map +3 -3
  37. package/dist/lib/node/worker.cjs +38 -40
  38. package/dist/lib/node/worker.cjs.map +2 -2
  39. package/dist/lib/node-esm/{app-graph-builder-LYCG5CO3.mjs → app-graph-builder-VYKLSMSZ.mjs} +23 -23
  40. package/dist/lib/node-esm/app-graph-builder-VYKLSMSZ.mjs.map +7 -0
  41. package/dist/lib/node-esm/{chunk-BOEJMAVK.mjs → chunk-AHKIPS2L.mjs} +267 -325
  42. package/dist/lib/node-esm/chunk-AHKIPS2L.mjs.map +7 -0
  43. package/dist/lib/node-esm/{chunk-JUJF5L4G.mjs → chunk-PHOUQACM.mjs} +9 -9
  44. package/dist/lib/node-esm/chunk-PHOUQACM.mjs.map +7 -0
  45. package/dist/lib/node-esm/{chunk-ISNBS46Y.mjs → chunk-R6A7Z4LU.mjs} +28 -40
  46. package/dist/lib/node-esm/chunk-R6A7Z4LU.mjs.map +7 -0
  47. package/dist/lib/node-esm/index.mjs +8 -10
  48. package/dist/lib/node-esm/index.mjs.map +1 -1
  49. package/dist/lib/node-esm/{intent-dispatcher-ZUSNX2OY.mjs → intent-dispatcher-YDE2ONZA.mjs} +2 -2
  50. package/dist/lib/node-esm/{intent-resolver-NGDHUKDD.mjs → intent-resolver-LAGJ7LXM.mjs} +3 -3
  51. package/dist/lib/node-esm/meta.json +1 -1
  52. package/dist/lib/node-esm/{store-NCRSE25X.mjs → store-EYSUVNCS.mjs} +6 -7
  53. package/dist/lib/node-esm/store-EYSUVNCS.mjs.map +7 -0
  54. package/dist/lib/node-esm/testing/index.mjs +3 -7
  55. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  56. package/dist/lib/node-esm/worker.mjs +3 -5
  57. package/dist/types/src/App.d.ts +1 -3
  58. package/dist/types/src/App.d.ts.map +1 -1
  59. package/dist/types/src/common/capabilities.d.ts +196 -6
  60. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  61. package/dist/types/src/common/events.d.ts.map +1 -1
  62. package/dist/types/src/common/file.d.ts +7 -7
  63. package/dist/types/src/common/file.d.ts.map +1 -1
  64. package/dist/types/src/common/index.d.ts +0 -1
  65. package/dist/types/src/common/index.d.ts.map +1 -1
  66. package/dist/types/src/common/layout.d.ts +158 -164
  67. package/dist/types/src/common/layout.d.ts.map +1 -1
  68. package/dist/types/src/common/surface.d.ts.map +1 -1
  69. package/dist/types/src/common/translations.d.ts +7 -7
  70. package/dist/types/src/common/translations.d.ts.map +1 -1
  71. package/dist/types/src/core/capabilities.d.ts +15 -33
  72. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  73. package/dist/types/src/core/events.d.ts +1 -4
  74. package/dist/types/src/core/events.d.ts.map +1 -1
  75. package/dist/types/src/core/manager.d.ts +11 -14
  76. package/dist/types/src/core/manager.d.ts.map +1 -1
  77. package/dist/types/src/core/plugin.d.ts +3 -4
  78. package/dist/types/src/core/plugin.d.ts.map +1 -1
  79. package/dist/types/src/helpers.d.ts.map +1 -1
  80. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  81. package/dist/types/src/playground/logger/schema.d.ts +6 -6
  82. package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
  83. package/dist/types/src/plugin-intent/actions.d.ts +14 -14
  84. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  85. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +3 -29
  86. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  87. package/dist/types/src/plugin-intent/intent.d.ts +20 -14
  88. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
  89. package/dist/types/src/plugin-settings/actions.d.ts +10 -10
  90. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  91. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +195 -2
  92. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  93. package/dist/types/src/plugin-settings/store.d.ts +2 -2
  94. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  95. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  96. package/dist/types/src/react/Surface.d.ts +2 -2
  97. package/dist/types/src/react/Surface.d.ts.map +1 -1
  98. package/dist/types/src/react/useCapabilities.d.ts +2 -2
  99. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  100. package/dist/types/src/react/useIntentResolver.d.ts.map +1 -1
  101. package/dist/types/src/testing/withPluginManager.d.ts +2 -5
  102. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  103. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  104. package/dist/types/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +20 -29
  106. package/project.json +1 -2
  107. package/src/App.tsx +4 -16
  108. package/src/common/capabilities.ts +4 -7
  109. package/src/common/file.ts +7 -7
  110. package/src/common/index.ts +0 -1
  111. package/src/common/layout.ts +128 -159
  112. package/src/common/translations.ts +7 -7
  113. package/src/core/capabilities.test.ts +36 -55
  114. package/src/core/capabilities.ts +58 -82
  115. package/src/core/events.ts +1 -4
  116. package/src/core/manager.test.ts +22 -22
  117. package/src/core/manager.ts +16 -24
  118. package/src/core/plugin.ts +3 -4
  119. package/src/playground/generator/generator.ts +4 -4
  120. package/src/playground/logger/schema.ts +5 -5
  121. package/src/playground/playground.stories.tsx +1 -1
  122. package/src/plugin-intent/actions.ts +9 -9
  123. package/src/plugin-intent/intent-dispatcher.test.ts +42 -23
  124. package/src/plugin-intent/intent-dispatcher.ts +13 -25
  125. package/src/plugin-intent/intent.ts +20 -22
  126. package/src/plugin-settings/actions.ts +8 -8
  127. package/src/plugin-settings/app-graph-builder.ts +94 -129
  128. package/src/plugin-settings/store.ts +17 -20
  129. package/src/react/Surface.stories.tsx +1 -1
  130. package/src/react/Surface.tsx +3 -3
  131. package/src/react/useCapabilities.ts +19 -9
  132. package/src/testing/withPluginManager.stories.tsx +1 -0
  133. package/src/testing/withPluginManager.tsx +3 -11
  134. package/tsconfig.json +0 -3
  135. package/dist/lib/browser/app-graph-builder-6E7NCZ77.mjs.map +0 -7
  136. package/dist/lib/browser/chunk-2KSDY3EZ.mjs.map +0 -7
  137. package/dist/lib/browser/chunk-K3HOLGVH.mjs.map +0 -7
  138. package/dist/lib/browser/chunk-KPRHX73H.mjs.map +0 -7
  139. package/dist/lib/browser/store-QGVXOY4T.mjs.map +0 -7
  140. package/dist/lib/node/app-graph-builder-4IWMG67O.cjs +0 -146
  141. package/dist/lib/node/app-graph-builder-4IWMG67O.cjs.map +0 -7
  142. package/dist/lib/node/chunk-2EBZ2ICH.cjs.map +0 -7
  143. package/dist/lib/node/chunk-7J66KH2T.cjs.map +0 -7
  144. package/dist/lib/node/chunk-JQMNABMK.cjs.map +0 -7
  145. package/dist/lib/node/store-IF3UR2KA.cjs.map +0 -7
  146. package/dist/lib/node-esm/app-graph-builder-LYCG5CO3.mjs.map +0 -7
  147. package/dist/lib/node-esm/chunk-BOEJMAVK.mjs.map +0 -7
  148. package/dist/lib/node-esm/chunk-ISNBS46Y.mjs.map +0 -7
  149. package/dist/lib/node-esm/chunk-JUJF5L4G.mjs.map +0 -7
  150. package/dist/lib/node-esm/store-NCRSE25X.mjs.map +0 -7
  151. package/dist/types/src/common/collaboration.d.ts +0 -26
  152. package/dist/types/src/common/collaboration.d.ts.map +0 -1
  153. package/src/common/collaboration.ts +0 -24
  154. package/typedoc/.nojekyll +0 -1
  155. package/typedoc/assets/hierarchy.js +0 -1
  156. package/typedoc/assets/highlight.css +0 -106
  157. package/typedoc/assets/icons.js +0 -18
  158. package/typedoc/assets/icons.svg +0 -1
  159. package/typedoc/assets/main.js +0 -60
  160. package/typedoc/assets/navigation.js +0 -1
  161. package/typedoc/assets/search.js +0 -1
  162. package/typedoc/assets/style.css +0 -1640
  163. package/typedoc/classes/CollaborationActions.InsertContent.html +0 -460
  164. package/typedoc/classes/ErrorBoundary.html +0 -125
  165. package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
  166. package/typedoc/classes/IntentAction.Track.html +0 -266
  167. package/typedoc/classes/LayoutAction.AddToast.html +0 -265
  168. package/typedoc/classes/LayoutAction.Close.html +0 -382
  169. package/typedoc/classes/LayoutAction.Expose.html +0 -265
  170. package/typedoc/classes/LayoutAction.Open.html +0 -1123
  171. package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
  172. package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
  173. package/typedoc/classes/LayoutAction.Set.html +0 -460
  174. package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
  175. package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
  176. package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
  177. package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -811
  178. package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
  179. package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
  180. package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
  181. package/typedoc/classes/Plugin.html +0 -6
  182. package/typedoc/classes/PluginContext.html +0 -38
  183. package/typedoc/classes/PluginManager.html +0 -43
  184. package/typedoc/classes/PluginModule.html +0 -18
  185. package/typedoc/classes/SettingsAction.Open.html +0 -226
  186. package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
  187. package/typedoc/functions/Events.createStateEvent.html +0 -2
  188. package/typedoc/functions/IntentPlugin.html +0 -1
  189. package/typedoc/functions/SettingsPlugin.html +0 -1
  190. package/typedoc/functions/allOf.html +0 -2
  191. package/typedoc/functions/chain.html +0 -3
  192. package/typedoc/functions/contributes.html +0 -2
  193. package/typedoc/functions/createApp.html +0 -6
  194. package/typedoc/functions/createDispatcher.html +0 -3
  195. package/typedoc/functions/createIntent.html +0 -6
  196. package/typedoc/functions/createResolver.html +0 -2
  197. package/typedoc/functions/createSurface.html +0 -2
  198. package/typedoc/functions/defineCapability.html +0 -2
  199. package/typedoc/functions/defineEvent.html +0 -2
  200. package/typedoc/functions/defineModule.html +0 -2
  201. package/typedoc/functions/definePlugin.html +0 -2
  202. package/typedoc/functions/eventKey.html +0 -2
  203. package/typedoc/functions/getEvents.html +0 -2
  204. package/typedoc/functions/isAllOf.html +0 -2
  205. package/typedoc/functions/isOneOf.html +0 -2
  206. package/typedoc/functions/isSurfaceAvailable.html +0 -2
  207. package/typedoc/functions/lazy.html +0 -2
  208. package/typedoc/functions/oneOf.html +0 -2
  209. package/typedoc/functions/useAppGraph.html +0 -1
  210. package/typedoc/functions/useCapabilities.html +0 -3
  211. package/typedoc/functions/useCapability.html +0 -4
  212. package/typedoc/functions/useIntentDispatcher.html +0 -1
  213. package/typedoc/functions/useIntentResolver.html +0 -1
  214. package/typedoc/functions/useLayout.html +0 -1
  215. package/typedoc/functions/usePluginManager.html +0 -2
  216. package/typedoc/hierarchy.html +0 -1
  217. package/typedoc/index.html +0 -16
  218. package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
  219. package/typedoc/media/LICENSE +0 -8
  220. package/typedoc/modules/Capabilities.html +0 -1
  221. package/typedoc/modules/CollaborationActions.html +0 -1
  222. package/typedoc/modules/Events.html +0 -1
  223. package/typedoc/modules/IntentAction.html +0 -1
  224. package/typedoc/modules/LayoutAction.html +0 -2
  225. package/typedoc/modules/SettingsAction.html +0 -1
  226. package/typedoc/modules.html +0 -1
  227. package/typedoc/types/ActivationEvent.html +0 -8
  228. package/typedoc/types/ActivationEvents.html +0 -2
  229. package/typedoc/types/AnyCapability.html +0 -1
  230. package/typedoc/types/AnyIntent.html +0 -1
  231. package/typedoc/types/AnyIntentChain.html +0 -1
  232. package/typedoc/types/AnyIntentEffectResult.html +0 -1
  233. package/typedoc/types/AnyIntentResolver.html +0 -1
  234. package/typedoc/types/AnyIntentResult.html +0 -1
  235. package/typedoc/types/Capabilities.FileUploader.html +0 -1
  236. package/typedoc/types/Capabilities.IntentResolver.html +0 -1
  237. package/typedoc/types/Capabilities.Layout.html +0 -1
  238. package/typedoc/types/Capabilities.Metadata.html +0 -1
  239. package/typedoc/types/Capabilities.ReactContext.html +0 -1
  240. package/typedoc/types/Capabilities.ReactRoot.html +0 -1
  241. package/typedoc/types/Capabilities.ReactSurface.html +0 -1
  242. package/typedoc/types/Capabilities.Settings.html +0 -4
  243. package/typedoc/types/Capability.html +0 -9
  244. package/typedoc/types/CreateAppOptions.html +0 -10
  245. package/typedoc/types/FileInfo.html +0 -1
  246. package/typedoc/types/Intent.html +0 -10
  247. package/typedoc/types/IntentChain.html +0 -6
  248. package/typedoc/types/IntentContext.html +0 -5
  249. package/typedoc/types/IntentData.html +0 -1
  250. package/typedoc/types/IntentDispatcher.html +0 -2
  251. package/typedoc/types/IntentDispatcherResult.html +0 -2
  252. package/typedoc/types/IntentEffectDefinition.html +0 -2
  253. package/typedoc/types/IntentEffectResult.html +0 -15
  254. package/typedoc/types/IntentParams.html +0 -3
  255. package/typedoc/types/IntentResolver.html +0 -2
  256. package/typedoc/types/IntentResultData.html +0 -1
  257. package/typedoc/types/IntentSchema.html +0 -1
  258. package/typedoc/types/IntentUndo.html +0 -2
  259. package/typedoc/types/InterfaceDef.html +0 -4
  260. package/typedoc/types/Label.html +0 -1
  261. package/typedoc/types/NodeSerializer.html +0 -8
  262. package/typedoc/types/PluginManagerOptions.html +0 -6
  263. package/typedoc/types/PluginMeta.html +0 -21
  264. package/typedoc/types/PromiseIntentDispatcher.html +0 -2
  265. package/typedoc/types/PromiseIntentUndo.html +0 -2
  266. package/typedoc/types/Resource.html +0 -1
  267. package/typedoc/types/ResourceKey.html +0 -1
  268. package/typedoc/types/ResourceLanguage.html +0 -1
  269. package/typedoc/types/SerializedNode.html +0 -4
  270. package/typedoc/types/SurfaceComponent.html +0 -2
  271. package/typedoc/types/SurfaceDefinition.html +0 -2
  272. package/typedoc/types/SurfaceProps.html +0 -4
  273. package/typedoc/variables/Capabilities.AppGraph.html +0 -1
  274. package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
  275. package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
  276. package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
  277. package/typedoc/variables/Capabilities.FileUploader.html +0 -1
  278. package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
  279. package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
  280. package/typedoc/variables/Capabilities.Layout.html +0 -1
  281. package/typedoc/variables/Capabilities.Metadata.html +0 -1
  282. package/typedoc/variables/Capabilities.Null.html +0 -1
  283. package/typedoc/variables/Capabilities.PluginManager.html +0 -1
  284. package/typedoc/variables/Capabilities.ReactContext.html +0 -1
  285. package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
  286. package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
  287. package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
  288. package/typedoc/variables/Capabilities.Settings.html +0 -1
  289. package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
  290. package/typedoc/variables/Capabilities.Tools.html +0 -1
  291. package/typedoc/variables/Capabilities.Translations.html +0 -1
  292. package/typedoc/variables/Events.AppGraphReady.html +0 -2
  293. package/typedoc/variables/Events.DispatcherReady.html +0 -2
  294. package/typedoc/variables/Events.LayoutReady.html +0 -1
  295. package/typedoc/variables/Events.SettingsReady.html +0 -2
  296. package/typedoc/variables/Events.SetupAppGraph.html +0 -2
  297. package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
  298. package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
  299. package/typedoc/variables/Events.SetupMetadata.html +0 -2
  300. package/typedoc/variables/Events.SetupReactSurface.html +0 -2
  301. package/typedoc/variables/Events.SetupSettings.html +0 -2
  302. package/typedoc/variables/Events.SetupTranslations.html +0 -2
  303. package/typedoc/variables/Events.Startup.html +0 -2
  304. package/typedoc/variables/FileInfoSchema.html +0 -1
  305. package/typedoc/variables/INTENT_ACTION.html +0 -1
  306. package/typedoc/variables/INTENT_PLUGIN.html +0 -1
  307. package/typedoc/variables/LAYOUT_ACTION.html +0 -1
  308. package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
  309. package/typedoc/variables/Label.html +0 -1
  310. package/typedoc/variables/LayoutAction.Toast.html +0 -1
  311. package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
  312. package/typedoc/variables/PluginManagerProvider.html +0 -2
  313. package/typedoc/variables/Resource.html +0 -2
  314. package/typedoc/variables/ResourceKey.html +0 -1
  315. package/typedoc/variables/ResourceLanguage.html +0 -1
  316. package/typedoc/variables/SETTINGS_ACTION.html +0 -1
  317. package/typedoc/variables/SETTINGS_ID.html +0 -1
  318. package/typedoc/variables/SETTINGS_KEY.html +0 -1
  319. package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
  320. package/typedoc/variables/Surface.html +0 -2
  321. package/typedoc/variables/defaultFileTypes.html +0 -1
  322. /package/dist/lib/browser/{intent-dispatcher-VGUJBPPN.mjs.map → intent-dispatcher-3Q67MHZZ.mjs.map} +0 -0
  323. /package/dist/lib/browser/{intent-resolver-QLFZY5R5.mjs.map → intent-resolver-O763LCLG.mjs.map} +0 -0
  324. /package/dist/lib/node/{intent-resolver-5CG5NIJY.cjs.map → intent-resolver-3F4POWAM.cjs.map} +0 -0
  325. /package/dist/lib/node-esm/{intent-dispatcher-ZUSNX2OY.mjs.map → intent-dispatcher-YDE2ONZA.mjs.map} +0 -0
  326. /package/dist/lib/node-esm/{intent-resolver-NGDHUKDD.mjs.map → intent-resolver-LAGJ7LXM.mjs.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/plugin-intent/intent-dispatcher.ts", "../../../src/plugin-intent/actions.ts", "../../../src/plugin-intent/intent.ts", "../../../src/plugin-intent/errors.ts", "../../../src/core/capabilities.ts", "../../../src/core/events.ts", "../../../src/core/manager.ts", "../../../src/core/plugin.ts", "../../../src/common/capabilities.ts", "../../../src/common/events.ts", "../../../src/common/file.ts", "../../../src/common/layout.ts", "../../../src/plugin-intent/IntentPlugin.tsx", "../../../src/common/surface.ts", "../../../src/common/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Effect, Option, pipe, Ref } from 'effect';\nimport { type Simplify } from 'effect/Types';\n\nimport { create } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { byPosition, type MaybePromise, type Position, type GuardedType } from '@dxos/util';\n\nimport { IntentAction } from './actions';\nimport { CycleDetectedError, NoResolversError } from './errors';\nimport {\n createIntent,\n type AnyIntent,\n type AnyIntentChain,\n type Intent,\n type IntentChain,\n type IntentData,\n type IntentParams,\n type IntentResultData,\n type IntentSchema,\n type Label,\n} from './intent';\nimport { Events, Capabilities } from '../common';\nimport { contributes, type PluginsContext } from '../core';\n\nconst EXECUTION_LIMIT = 100;\nconst HISTORY_LIMIT = 100;\n\n/**\n * The return value of an intent effect.\n */\nexport type IntentEffectResult<Input, Output> = {\n /**\n * The output of the action that was performed.\n *\n * If the intent is apart of a chain of intents, the data will be passed to the next intent.\n */\n data?: Output;\n\n /**\n * If provided, the action will be undoable.\n */\n undoable?: {\n /**\n * Message to display to the user when indicating that the action can be undone.\n */\n message: Label;\n\n /**\n * Will be merged with the original intent data when firing the undo intent.\n */\n data?: Partial<Input>;\n };\n\n /**\n * An error that occurred while performing the action.\n *\n * If the intent is apart of a chain of intents and an error occurs, the chain will be aborted.\n *\n * Return caught error instead of throwing to trigger other intent to be triggered prior to returning the error.\n */\n error?: Error;\n\n /**\n * Other intent chains to be triggered.\n */\n intents?: AnyIntentChain[];\n};\n\nexport type AnyIntentEffectResult = IntentEffectResult<any, any>;\n\n/**\n * The result of an intent dispatcher.\n */\nexport type IntentDispatcherResult<Input, Output> = Pick<IntentEffectResult<Input, Output>, 'data' | 'error'>;\n\n/**\n * The implementation of an intent effect.\n */\nexport type IntentEffectDefinition<Input, Output> = (\n data: Input,\n undo: boolean,\n) =>\n | MaybePromise<IntentEffectResult<Input, Output> | void>\n | Effect.Effect<IntentEffectResult<Input, Output> | void, Error>;\n\n/**\n * Intent resolver to match intents to their effects.\n */\nexport type IntentResolver<Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>> = Readonly<{\n intent: IntentSchema<Tag, Fields>;\n position?: Position;\n filter?: (data: IntentData<Fields>) => data is Data;\n resolve: IntentEffectDefinition<GuardedType<IntentResolver<Tag, Fields, Data>['filter']>, IntentResultData<Fields>>;\n}>;\n\nexport type AnyIntentResolver = IntentResolver<any, any, any>;\n\n/**\n * Creates an intent resolver to match intents to their effects.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param effect Effect to be performed when the intent is resolved.\n * @param params.disposition Determines the priority of the resolver when multiple are resolved.\n * @param params.filter Optional filter to determine if the resolver should be used.\n */\nexport const createResolver = <Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>>(\n resolver: IntentResolver<Tag, Fields, Data>,\n) => resolver;\n\n/**\n * Invokes intents and returns the result.\n */\nexport type PromiseIntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n) => Promise<Simplify<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>>;\n\n/**\n * Creates an effect for intents.\n */\nexport type IntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n depth?: number,\n) => Effect.Effect<\n Simplify<Required<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>['data']>,\n Error\n>;\n\ntype IntentResult<Tag extends string, Fields extends IntentParams> = IntentEffectResult<\n IntentData<Fields>,\n IntentResultData<Fields>\n> & {\n _intent: Intent<Tag, Fields>;\n};\n\nexport type AnyIntentResult = IntentResult<any, any>;\n\n/**\n * Invokes the most recent undoable intent with undo flags.\n */\nexport type PromiseIntentUndo = () => Promise<IntentDispatcherResult<any, any>>;\n\n/**\n * Creates an effect which undoes the last intent.\n */\nexport type IntentUndo = () => Effect.Effect<any, Error>;\n\n/**\n * Check if a chain of results is undoable.\n */\nconst isUndoable = (historyEntry: AnyIntentResult[]): boolean =>\n historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);\n\nexport type IntentContext = {\n dispatch: IntentDispatcher;\n dispatchPromise: PromiseIntentDispatcher;\n undo: IntentUndo;\n undoPromise: PromiseIntentUndo;\n};\n\n/**\n * Sets of an intent dispatcher.\n *\n * @param getResolvers A function that returns an array of available intent resolvers.\n * @param params.historyLimit The maximum number of intent results to keep in history.\n * @param params.executionLimit The maximum recursion depth of intent chains.\n */\nexport const createDispatcher = (\n getResolvers: (module?: string) => AnyIntentResolver[],\n { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {},\n): IntentContext => {\n const historyRef = Effect.runSync(Ref.make<AnyIntentResult[][]>([]));\n\n const handleIntent = (intent: AnyIntent) =>\n Effect.gen(function* () {\n const candidates = getResolvers(intent.module)\n .filter((resolver) => resolver.intent._tag === intent.id)\n .filter((resolver) => !resolver.filter || resolver.filter(intent.data))\n .toSorted(byPosition);\n if (candidates.length === 0) {\n yield* Effect.fail(new NoResolversError(intent.id));\n }\n\n const effect = candidates[0].resolve(intent.data, intent.undo ?? false);\n const result = Effect.isEffect(effect) ? yield* effect : yield* Effect.promise(async () => effect);\n return { _intent: intent, ...result } as AnyIntentResult;\n });\n\n const dispatch: IntentDispatcher = (intentChain, depth = 0) => {\n return Effect.gen(function* () {\n if (depth > executionLimit) {\n yield* Effect.fail(new CycleDetectedError());\n }\n\n const resultsRef = yield* Ref.make<AnyIntentResult[]>([]);\n for (const intent of intentChain.all) {\n const { data: prev } = (yield* resultsRef.get)[0] ?? {};\n const result = yield* handleIntent({ ...intent, data: { ...intent.data, ...prev } });\n yield* Ref.update(resultsRef, (results) => [result, ...results]);\n if (result.intents) {\n for (const intent of result.intents) {\n // Returned intents are dispatched but not yielded into results, as such they cannot be undone.\n // TODO(wittjosiah): Use higher execution concurrency?\n yield* dispatch(intent, depth + 1);\n }\n }\n\n if (result.error) {\n // yield* dispatch(\n // createIntent(IntentAction.Track, {\n // intents: intentChain.all.map((i) => i.id),\n // error: result.error.message,\n // }),\n // );\n yield* Effect.fail(result.error);\n }\n }\n\n // Track the intent chain.\n // if (intentChain.all.some((intent) => intent.id !== IntentAction.Track._tag)) {\n // yield* dispatch(createIntent(IntentAction.Track, { intents: intentChain.all.map((i) => i.id) }));\n // }\n\n const results = yield* resultsRef.get;\n const result = results[0];\n yield* Ref.update(historyRef, (history) => {\n const next = [...history, results];\n if (next.length > historyLimit) {\n next.splice(0, next.length - historyLimit);\n }\n return next;\n });\n\n if (result.undoable && isUndoable(results)) {\n // TODO(wittjosiah): Is there a better way to handle showing undo for chains?\n yield* pipe(\n dispatch(createIntent(IntentAction.ShowUndo, { message: result.undoable.message })),\n Effect.catchSome((err) =>\n err instanceof NoResolversError ? Option.some(Effect.succeed(undefined)) : Option.none(),\n ),\n );\n }\n\n return result.data;\n });\n };\n\n const dispatchPromise: PromiseIntentDispatcher = (intentChain) => {\n return Effect.runPromise(dispatch(intentChain))\n .then((data) => ({ data }))\n .catch((error) => {\n log.catch(error);\n return { error };\n });\n };\n\n const undo: IntentUndo = () => {\n return Effect.gen(function* () {\n const history = yield* historyRef.get;\n const last = history.findLastIndex(isUndoable);\n const result = last !== -1 ? history[last] : undefined;\n if (result) {\n const all = result.map(({ _intent, undoable }): AnyIntent => {\n const data = _intent.data;\n const undoData = undoable?.data ?? {};\n return { ..._intent, data: { ...data, ...undoData }, undo: true } satisfies AnyIntent;\n });\n const intent = { first: all[0], last: all.at(-1)!, all } satisfies AnyIntentChain;\n yield* Ref.update(historyRef, (h) => h.filter((_, index) => index !== last));\n return yield* dispatch(intent);\n }\n });\n };\n\n const undoPromise: PromiseIntentUndo = () => {\n return Effect.runPromise(undo())\n .then((data) => ({ data }))\n .catch((error) => ({ error }));\n };\n\n return { dispatch, dispatchPromise, undo, undoPromise };\n};\n\nconst defaultEffect = () => Effect.fail(new Error('Intent runtime not ready'));\nconst defaultPromise = () => Effect.runPromise(defaultEffect());\n\nexport default (context: PluginsContext) => {\n const state = create<IntentContext>({\n dispatch: defaultEffect,\n dispatchPromise: defaultPromise,\n undo: defaultEffect,\n undoPromise: defaultPromise,\n });\n\n // TODO(wittjosiah): Make getResolver callback async and allow resolvers to be requested on demand.\n const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher((module) =>\n context\n .requestCapabilities(Capabilities.IntentResolver, (c, moduleId): c is AnyIntentResolver => {\n return module ? moduleId === module : true;\n })\n .flat(),\n );\n\n const manager = context.requestCapability(Capabilities.PluginManager);\n state.dispatch = (intentChain, depth) => {\n return Effect.gen(function* () {\n yield* manager._activate(Events.SetupIntentResolver);\n return yield* dispatch(intentChain, depth);\n });\n };\n state.dispatchPromise = async (intentChain) => {\n await manager.activate(Events.SetupIntentResolver);\n return await dispatchPromise(intentChain);\n };\n state.undo = undo;\n state.undoPromise = undoPromise;\n\n return contributes(Capabilities.IntentDispatcher, state);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Schema as S } from 'effect';\n\nimport { Label } from './intent';\n\nexport const INTENT_PLUGIN = 'dxos.org/plugin/intent';\nexport const INTENT_ACTION = `${INTENT_PLUGIN}/action`;\n\nexport namespace IntentAction {\n /**\n * Log an intent.\n */\n export class Track extends S.TaggedClass<Track>()(`${INTENT_ACTION}/track`, {\n input: S.Struct({\n intents: S.Array(S.String),\n error: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n /**\n * Fired after an intent is dispatched if the intent is undoable.\n */\n export class ShowUndo extends S.TaggedClass<ShowUndo>()(`${INTENT_ACTION}/show-undo`, {\n input: S.Struct({\n message: Label,\n }),\n output: S.Void,\n }) {}\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema as S } from 'effect';\n\nexport type IntentParams = {\n readonly input: S.Schema.All;\n readonly output: S.Schema.All;\n};\n\nexport type IntentData<Fields extends IntentParams> =\n S.Schema.Type<S.Struct<Fields>> extends { readonly input: any } ? S.Schema.Type<S.Struct<Fields>>['input'] : any;\n\nexport type IntentResultData<Fields extends IntentParams> =\n S.Schema.Type<S.Struct<Fields>> extends { readonly output: any } ? S.Schema.Type<S.Struct<Fields>>['output'] : any;\n\nexport type IntentSchema<Tag extends string, Fields extends IntentParams> = S.TaggedClass<any, Tag, Fields>;\n\n/**\n * An intent is an abstract description of an operation to be performed.\n * Intents allow actions to be performed across plugins.\n */\nexport type Intent<Tag extends string, Fields extends IntentParams> = {\n _schema: IntentSchema<Tag, Fields>;\n\n /**\n * The id of the intent.\n */\n id: Tag;\n\n /**\n * Any data needed to perform the desired action.\n */\n data: IntentData<Fields>;\n\n /**\n * Module ID.\n * If specified, the intent will be sent explicitly to the plugin module.\n * Otherwise, the intent will be sent to all plugins, in order and the first to resolve a non-null value will be used.\n */\n module?: string;\n\n /**\n * Whether or not the intent is being undone.\n */\n undo?: boolean;\n};\n\nexport type AnyIntent = Intent<any, any>;\n\n/**\n * Chain of intents to be executed together.\n * The result of each intent is merged into the next intent's input data.\n */\nexport type IntentChain<\n FirstTag extends string,\n LastTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n> = {\n first: Intent<FirstTag, FirstFields>;\n last: Intent<LastTag, LastFields>;\n all: AnyIntent[];\n};\n\nexport type AnyIntentChain = IntentChain<any, any, any, any>;\n\n/**\n * Creates a typed intent.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param data Data fulfilling the input schema of the intent.\n * @param params.plugin Optional plugin ID to send the intent to.\n * @param params.undo Optional flag to indicate that the intent is being undone. Generally not set manually.\n */\nexport const createIntent = <Tag extends string, Fields extends IntentParams>(\n schema: IntentSchema<Tag, Fields>,\n data: IntentData<Fields> = {},\n params: Pick<AnyIntent, 'module' | 'undo'> = {},\n): IntentChain<Tag, Tag, Fields, Fields> => {\n // The output of validateSync breaks proxy objects so this is just used for validation.\n // TODO(wittjosiah): Is there a better way to make theses types align?\n const _ = S.validateSync(schema.fields.input as S.Schema<any, any, unknown>)(data);\n const intent = {\n ...params,\n _schema: schema,\n id: schema._tag,\n data,\n } satisfies Intent<Tag, Fields>;\n\n return {\n first: intent,\n last: intent,\n all: [intent],\n };\n};\n\n// TODO(wittjosiah): Add a function for mapping the output of one intent to the input of another.\n\n/**\n * Chain two intents together.\n *\n * NOTE: Chaining of intents depends on the data inputs and outputs being structs.\n */\nexport const chain =\n <\n FirstTag extends string,\n NextTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n NextFields extends IntentParams,\n >(\n schema: IntentSchema<NextTag, NextFields>,\n data: Omit<IntentData<NextFields>, keyof IntentResultData<LastFields>> = {},\n params: Pick<AnyIntent, 'module' | 'undo'> = {},\n ) =>\n (\n intent: IntentChain<FirstTag, any, FirstFields, LastFields>,\n ): IntentChain<FirstTag, NextTag, FirstFields, NextFields> => {\n const intents = 'all' in intent ? intent.all : [intent];\n const first = intents[0];\n const last = {\n ...params,\n _schema: schema,\n id: schema._tag,\n data,\n } satisfies Intent<NextTag, NextFields>;\n\n return {\n first,\n last,\n all: [...intents, last],\n };\n };\n\n//\n// Intents\n//\n\n// NOTE: Should maintain compatibility with `i18next` (and @dxos/react-ui).\n// TODO(wittjosiah): Making this immutable breaks type compatibility.\nexport const Label = S.Union(\n S.String,\n S.mutable(S.Tuple(S.String, S.mutable(S.Struct({ ns: S.String, count: S.optional(S.Number) })))),\n);\nexport type Label = S.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(wittjosiah): Reconcile with @dxos/protocols. Factor out errors.\n\n/**\n * NOTE: Messages should be sentences (Start with a capital letter and end with a period).\n * Errors can optionally include a JSON context object.\n */\nexport class BaseError extends Error {\n constructor(\n readonly code: string,\n message?: string,\n readonly context?: Record<string, any>,\n ) {\n // TODO(dmaretskyi): Error.cause.\n super(message ?? code, { cause: context });\n this.name = code;\n // NOTE: Restores prototype chain (https://stackoverflow.com/a/48342359).\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class NoResolversError extends BaseError {\n constructor(action: string) {\n super('NO_RESOLVERS', 'No resolvers were found for the action', { action });\n }\n}\n\nexport class CycleDetectedError extends BaseError {\n constructor(context?: Record<string, any>) {\n super(\n 'CYCLE_DETECTED',\n 'Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.',\n context,\n );\n }\n}\n", "/**\n * Interface definition for a capability.\n */\n//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect, untracked } from '@preact/signals-core';\nimport { Effect } from 'effect';\n\nimport { Trigger } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { create } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type ActivationEvent } from './events';\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const defineCapability = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * Functionality contributed to the application by a plugin module.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n deactivate?: () => MaybePromise<void> | Effect.Effect<void, Error>;\n};\n\nexport type AnyCapability = Capability<any>;\n\ntype PluginsContextOptions = {\n activate: (event: ActivationEvent) => Effect.Effect<boolean, Error>;\n reset: (event: ActivationEvent) => Effect.Effect<boolean, Error>;\n};\n\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nclass CapabilityImpl<T> {\n constructor(\n readonly moduleId: string,\n readonly implementation: T,\n ) {}\n}\n\n/**\n * Helper to define the implementation of a capability.\n */\nexport const contributes = <T>(\n interfaceDef: Capability<T>['interface'],\n implementation: Capability<T>['implementation'],\n deactivate?: Capability<T>['deactivate'],\n): Capability<T> => {\n return { interface: interfaceDef, implementation, deactivate } satisfies Capability<T>;\n};\n\ntype LoadCapability<T, U> = () => Promise<{ default: (props: T) => MaybePromise<Capability<U>> }>;\ntype LoadCapabilities<T> = () => Promise<{ default: (props: T) => MaybePromise<AnyCapability[]> }>;\n// TODO(wittjosiah): Not having the array be `any` causes type errors when using the lazy capability.\ntype LazyCapability<T, U> = (props?: T) => Promise<() => Promise<Capability<U> | AnyCapability[]>>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n */\nexport const lazy =\n <T, U>(c: LoadCapability<T, U> | LoadCapabilities<T>): LazyCapability<T, U> =>\n async (props?: T) => {\n const { default: getCapability } = await c();\n return async () => getCapability(props as T);\n };\n\n/**\n * Context which is passed to plugins, allowing them to interact with each other.\n */\nexport class PluginsContext {\n private readonly _definedCapabilities = new Map<string, CapabilityImpl<unknown>[]>();\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n readonly activate: PluginsContextOptions['activate'];\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n readonly reset: PluginsContextOptions['reset'];\n\n constructor({ activate, reset }: PluginsContextOptions) {\n this.activate = activate;\n this.reset = reset;\n }\n\n /**\n * @internal\n */\n contributeCapability<T>({\n module: moduleId,\n interface: interfaceDef,\n implementation,\n }: {\n module: string;\n interface: InterfaceDef<T>;\n implementation: T;\n }) {\n let current = this._definedCapabilities.get(interfaceDef.identifier);\n if (!current) {\n const object = create<{ value: CapabilityImpl<unknown>[] }>({ value: [] });\n current = untracked(() => object.value);\n this._definedCapabilities.set(interfaceDef.identifier, current);\n }\n\n current.push(new CapabilityImpl(moduleId, implementation));\n log('capability contributed', {\n id: interfaceDef.identifier,\n moduleId,\n count: untracked(() => current.length),\n });\n }\n\n /**\n * @internal\n */\n removeCapability<T>(interfaceDef: InterfaceDef<T>, implementation: T) {\n const current = this._definedCapabilities.get(interfaceDef.identifier);\n if (!current) {\n return;\n }\n\n const index = current.findIndex((i) => i.implementation === implementation);\n if (index !== -1) {\n current.splice(index, 1);\n log('capability removed', { id: interfaceDef.identifier, count: untracked(() => current.length) });\n } else {\n log.warn('capability not removed', { id: interfaceDef.identifier });\n }\n }\n\n /**\n * Requests capabilities from the plugin context.\n * @returns An array of capabilities.\n * @reactive\n */\n requestCapabilities<T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T, moduleId: string) => capability is U,\n ): U[] {\n let current = this._definedCapabilities.get(interfaceDef.identifier);\n if (!current) {\n const object = create<{ value: CapabilityImpl<unknown>[] }>({ value: [] });\n current = untracked(() => object.value);\n this._definedCapabilities.set(interfaceDef.identifier, current);\n }\n\n // NOTE: This the type-checking for capabilities is done at the time of contribution.\n const capabilities = filter ? current.filter((c) => filter(c.implementation as T, c.moduleId)) : current;\n return capabilities.map((c) => c.implementation) as U[];\n }\n\n /**\n * Requests a single capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n * @reactive\n */\n requestCapability<T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T, moduleId: string) => capability is U,\n ): U {\n const capability = this.requestCapabilities(interfaceDef, filter)[0];\n invariant(capability, `No capability found for ${interfaceDef.identifier}`);\n return capability;\n }\n\n /**\n * Waits for a capability to be contributed.\n * @returns The capability.\n */\n async waitForCapability<T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T) => capability is U,\n ): Promise<U> {\n const trigger = new Trigger<U>();\n const unsubscribe = effect(() => {\n const capabilities = this.requestCapabilities(interfaceDef, filter);\n if (capabilities[0]) {\n trigger.wake(capabilities[0]);\n }\n });\n const capability = await trigger.wait();\n unsubscribe();\n return capability;\n }\n\n async activatePromise(event: ActivationEvent): Promise<boolean> {\n return this.activate(event).pipe(Effect.runPromise);\n }\n\n async resetPromise(event: ActivationEvent): Promise<boolean> {\n return this.reset(event).pipe(Effect.runPromise);\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * An event which activates a plugin module.\n */\nexport type ActivationEvent = {\n id: string;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type ActivationEvents =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event.\n */\nexport const defineEvent = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\n};\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) => (event.specifier ? `${event.id}:${event.specifier}` : event.id);\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: ActivationEvents): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: ActivationEvents): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: ActivationEvents) => ('type' in events ? events.events : [events]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\nimport { Array as A, Effect, Either, Match, pipe } from 'effect';\n\nimport { Event } from '@dxos/async';\nimport { create, type ReactiveObject } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, PluginsContext } from './capabilities';\nimport { type ActivationEvent, eventKey, getEvents, isAllOf } from './events';\nimport { type PluginModule, type Plugin } from './plugin';\n\n// TODO(wittjosiah): Factor out?\nconst isPromise = (value: unknown): value is Promise<unknown> => {\n return value !== null && typeof value === 'object' && 'then' in value;\n};\n\nexport type PluginManagerOptions = {\n pluginLoader: (id: string) => MaybePromise<Plugin>;\n plugins?: Plugin[];\n core?: string[];\n enabled?: string[];\n};\n\ntype PluginManagerState = {\n // Plugins\n plugins: Plugin[];\n core: string[];\n enabled: string[];\n\n // Modules\n modules: PluginModule[];\n active: string[];\n\n // Events\n eventsFired: string[];\n pendingReset: string[];\n};\n\nexport class PluginManager {\n readonly activation = new Event<{ event: string; state: 'activating' | 'activated' | 'error'; error?: any }>();\n\n readonly context = new PluginsContext({\n activate: (event) => this._activate(event),\n reset: (id) => this._reset(id),\n });\n\n private readonly _state: ReactiveObject<PluginManagerState>;\n private readonly _pluginLoader: PluginManagerOptions['pluginLoader'];\n private readonly _capabilities = new Map<string, AnyCapability[]>();\n\n constructor({\n pluginLoader,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n enabled = [],\n }: PluginManagerOptions) {\n this._pluginLoader = pluginLoader;\n this._state = create({\n plugins,\n core,\n enabled,\n modules: [],\n active: [],\n pendingReset: [],\n eventsFired: [],\n });\n plugins.forEach((plugin) => this._addPlugin(plugin));\n core.forEach((id) => this.enable(id));\n enabled.forEach((id) => this.enable(id));\n }\n\n /**\n * Plugins that are currently registered.\n *\n * @reactive\n */\n get plugins(): ReactiveObject<readonly Plugin[]> {\n return this._state.plugins;\n }\n\n /**\n * Ids of plugins that are core and cannot be removed.\n *\n * @reactive\n */\n get core(): ReactiveObject<readonly string[]> {\n return this._state.core;\n }\n\n /**\n * Ids of plugins that are currently enabled.\n *\n * @reactive\n */\n get enabled(): ReactiveObject<readonly string[]> {\n return this._state.enabled;\n }\n\n /**\n * Modules of plugins which are currently enabled.\n *\n * @reactive\n */\n get modules(): ReactiveObject<readonly PluginModule[]> {\n return this._state.modules;\n }\n\n /**\n * Ids of modules which are currently active.\n *\n * @reactive\n */\n get active(): ReactiveObject<readonly string[]> {\n return this._state.active;\n }\n\n /**\n * Ids of events which have been fired.\n *\n * @reactive\n */\n get eventsFired(): ReactiveObject<readonly string[]> {\n return this._state.eventsFired;\n }\n\n /**\n * Ids of modules which are pending reset.\n *\n * @reactive\n */\n get pendingReset(): ReactiveObject<readonly string[]> {\n return this._state.pendingReset;\n }\n\n /**\n * Adds a plugin to the manager via the plugin loader.\n * @param id The id of the plugin.\n */\n async add(id: string): Promise<boolean> {\n return untracked(async () => {\n log('add plugin', { id });\n const plugin = await this._pluginLoader(id);\n this._addPlugin(plugin);\n return this.enable(id);\n });\n }\n\n /**\n * Enables a plugin.\n * @param id The id of the plugin.\n */\n enable(id: string): Promise<boolean> {\n return untracked(async () => {\n log('enable plugin', { id });\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n if (!this._state.enabled.includes(id)) {\n this._state.enabled.push(id);\n }\n\n plugin.modules.forEach((module) => {\n this._addModule(module);\n this._setPendingResetByModule(module);\n });\n\n log('pending reset', { events: [...this.pendingReset] });\n await Effect.runPromise(\n Effect.all(\n this.pendingReset.map((event) => this._activate(event)),\n { concurrency: 'unbounded' },\n ),\n );\n\n return true;\n });\n }\n\n /**\n * Removes a plugin from the manager.\n * @param id The id of the plugin.\n */\n remove(id: string): boolean {\n return untracked(() => {\n log('remove plugin', { id });\n const result = this.disable(id);\n if (!result) {\n return false;\n }\n\n this._removePlugin(id);\n return true;\n });\n }\n\n /**\n * Disables a plugin.\n * @param id The id of the plugin.\n */\n disable(id: string): Promise<boolean> {\n return untracked(async () => {\n log('disable plugin', { id });\n if (this._state.core.includes(id)) {\n return false;\n }\n\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const enabledIndex = this._state.enabled.findIndex((enabled) => enabled === id);\n if (enabledIndex !== -1) {\n this._state.enabled.splice(enabledIndex, 1);\n await Effect.runPromise(this._deactivate(id));\n\n plugin.modules.forEach((module) => {\n this._removeModule(module.id);\n });\n }\n\n return true;\n });\n }\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n activate(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._activate(event)));\n }\n\n /**\n * Deactivates all of the modules for a plugin.\n * @param id The id of the plugin.\n * @returns Whether the deactivation was successful.\n */\n deactivate(id: string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._deactivate(id)));\n }\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n reset(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._reset(event)));\n }\n\n private _addPlugin(plugin: Plugin) {\n untracked(() => {\n log('add plugin', { id: plugin.meta.id });\n if (!this._state.plugins.includes(plugin)) {\n this._state.plugins.push(plugin);\n }\n });\n }\n\n private _removePlugin(id: string) {\n untracked(() => {\n log('remove plugin', { id });\n const pluginIndex = this._state.plugins.findIndex((plugin) => plugin.meta.id === id);\n if (pluginIndex !== -1) {\n this._state.plugins.splice(pluginIndex, 1);\n }\n });\n }\n\n private _addModule(module: PluginModule) {\n untracked(() => {\n log('add module', { id: module.id });\n if (!this._state.modules.includes(module)) {\n this._state.modules.push(module);\n }\n });\n }\n\n private _removeModule(id: string) {\n untracked(() => {\n log('remove module', { id });\n const moduleIndex = this._state.modules.findIndex((module) => module.id === id);\n if (moduleIndex !== -1) {\n this._state.modules.splice(moduleIndex, 1);\n }\n });\n }\n\n private _getPlugin(id: string) {\n return this._state.plugins.find((plugin) => plugin.meta.id === id);\n }\n\n private _getActiveModules() {\n return this._state.modules.filter((module) => this._state.active.includes(module.id));\n }\n\n private _getInactiveModules() {\n return this._state.modules.filter((module) => !this._state.active.includes(module.id));\n }\n\n private _getActiveModulesByEvent(key: string) {\n return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _getInactiveModulesByEvent(key: string) {\n return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _setPendingResetByModule(module: PluginModule) {\n return untracked(() => {\n const activationEvents = getEvents(module.activatesOn)\n .map(eventKey)\n .filter((key) => this._state.eventsFired.includes(key));\n\n const pendingReset = Array.from(new Set(activationEvents)).filter(\n (event) => !this._state.pendingReset.includes(event),\n );\n if (pendingReset.length > 0) {\n log('pending reset', { events: pendingReset });\n this._state.pendingReset.push(...pendingReset);\n }\n });\n }\n\n /**\n * @internal\n */\n // TODO(wittjosiah): Improve error typing.\n _activate(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('activating', { key });\n const pendingIndex = this._state.pendingReset.findIndex((event) => event === key);\n if (pendingIndex !== -1) {\n this._state.pendingReset.splice(pendingIndex, 1);\n }\n\n const modules = this._getInactiveModulesByEvent(key).filter((module) => {\n const allOf = isAllOf(module.activatesOn);\n if (!allOf) {\n return true;\n }\n\n const events = module.activatesOn.events.filter((event) => eventKey(event) !== key);\n return events.every((event) => this._state.eventsFired.includes(eventKey(event)));\n });\n if (modules.length === 0) {\n log('no modules to activate', { key });\n if (!this._state.eventsFired.includes(key)) {\n this._state.eventsFired.push(key);\n }\n return false;\n }\n\n log('activating modules', { key, modules: modules.map((module) => module.id) });\n this.activation.emit({ event: key, state: 'activating' });\n\n // Concurrently triggers loading of lazy capabilities.\n const getCapabilities = yield* Effect.all(\n modules.map(({ activate }) =>\n Effect.tryPromise({\n try: async () => activate(this.context),\n catch: (error) => error as Error,\n }),\n ),\n { concurrency: 'unbounded' },\n );\n\n const result = yield* pipe(\n modules,\n A.zip(getCapabilities),\n A.map(([module, getCapabilities]) => this._activateModule(module, getCapabilities)),\n // TODO(wittjosiah): This currently can't be run in parallel.\n // Running this with concurrency causes races with `allOf` activation events.\n Effect.all,\n Effect.either,\n );\n\n if (Either.isLeft(result)) {\n this.activation.emit({ event: key, state: 'error', error: result.left });\n yield* Effect.fail(result.left);\n }\n\n if (!this._state.eventsFired.includes(key)) {\n this._state.eventsFired.push(key);\n }\n\n this.activation.emit({ event: key, state: 'activated' });\n log('activated', { key });\n\n return true;\n });\n }\n\n private _activateModule(\n module: PluginModule,\n getCapabilities: AnyCapability | AnyCapability[] | (() => Promise<AnyCapability | AnyCapability[]>),\n ): Effect.Effect<void, Error> {\n return Effect.gen(this, function* () {\n yield* Effect.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {\n concurrency: 'unbounded',\n });\n\n log('activating module...', { module: module.id });\n // TODO(wittjosiah): This is not handling errors thrown if this is synchronous.\n const maybeCapabilities = typeof getCapabilities === 'function' ? getCapabilities() : getCapabilities;\n const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(\n // TODO(wittjosiah): Activate with an effect?\n // Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n const capabilities = Match.value(resolvedCapabilities).pipe(\n Match.when(Array.isArray, (array) => array),\n Match.orElse((value) => [value]),\n );\n capabilities.forEach((capability) => {\n this.context.contributeCapability({ module: module.id, ...capability });\n });\n this._state.active.push(module.id);\n this._capabilities.set(module.id, capabilities);\n log('activated module', { module: module.id });\n\n yield* Effect.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {\n concurrency: 'unbounded',\n });\n });\n }\n\n private _deactivate(id: string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const modules = plugin.modules;\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n return results.every((result) => result);\n });\n }\n\n private _deactivateModule(module: PluginModule): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const id = module.id;\n log('deactivating', { id });\n\n const capabilities = this._capabilities.get(id);\n if (capabilities) {\n for (const capability of capabilities) {\n this.context.removeCapability(capability.interface, capability.implementation);\n const program = capability.deactivate?.();\n yield* Match.value(program).pipe(\n Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n }\n this._capabilities.delete(id);\n }\n\n const activeIndex = this._state.active.findIndex((event) => event === id);\n if (activeIndex !== -1) {\n this._state.active.splice(activeIndex, 1);\n }\n\n log('deactivated', { id });\n return true;\n });\n }\n\n private _reset(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('reset', { key });\n const modules = this._getActiveModulesByEvent(key);\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n\n if (results.every((result) => result)) {\n return yield* this._activate(key);\n } else {\n return false;\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, type PluginsContext } from './capabilities';\nimport { type ActivationEvent, type ActivationEvents } from './events';\n\ninterface PluginModuleInterface {\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: ActivationEvents;\n\n /**\n * Events which the plugin depends on being activated.\n * Plugin is marked as needing reset a plugin activated by a dependent event is removed.\n * Events are automatically activated before activation of the plugin.\n */\n activatesBefore?: ActivationEvent[];\n\n /**\n * Events which this plugin triggers upon activation.\n */\n activatesAfter?: ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * @param context The plugin context.\n * @returns The capabilities of the module.\n */\n activate: (\n context: PluginsContext,\n ) => MaybePromise<AnyCapability | AnyCapability[]> | Promise<() => Promise<AnyCapability | AnyCapability[]>>;\n}\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class PluginModule implements PluginModuleInterface {\n readonly id: PluginModuleInterface['id'];\n readonly activatesOn: PluginModuleInterface['activatesOn'];\n readonly activatesBefore?: PluginModuleInterface['activatesBefore'];\n readonly activatesAfter?: PluginModuleInterface['activatesAfter'];\n readonly activate: PluginModuleInterface['activate'];\n\n constructor(options: PluginModuleInterface) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.activatesBefore = options.activatesBefore;\n this.activatesAfter = options.activatesAfter;\n this.activate = options.activate;\n }\n}\n\n/**\n * Helper to define a module.\n */\nexport const defineModule = (options: PluginModuleInterface) => new PluginModule(options);\n\nexport type PluginMeta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class Plugin {\n constructor(\n readonly meta: PluginMeta,\n readonly modules: PluginModule[],\n ) {}\n}\n\n/**\n * Helper to define a plugin.\n */\nexport const definePlugin = (meta: PluginMeta, modules: PluginModule[]) => {\n return new Plugin(meta, modules);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Schema as S } from 'effect';\nimport { type FC, type PropsWithChildren } from 'react';\n\nimport { type GraphBuilder } from '@dxos/app-graph';\nimport { type ArtifactDefinition, type Tool } from '@dxos/artifact';\nimport { type Space } from '@dxos/client-protocol';\nimport { type RootSettingsStore } from '@dxos/local-storage';\n\nimport { type FileInfo } from './file';\nimport { type NodeSerializer } from './graph';\nimport { type SurfaceDefinition } from './surface';\nimport { type Resource } from './translations';\nimport { defineCapability, type PluginManager } from '../core';\nimport { type AnyIntentResolver, type IntentContext } from '../plugin-intent';\n\nexport namespace Capabilities {\n export const PluginManager = defineCapability<PluginManager>('dxos.org/app-framework/capability/plugin-manager');\n\n export const Null = defineCapability<null>('dxos.org/app-framework/capability/null');\n\n export type ReactContext = Readonly<{ id: string; dependsOn?: string[]; context: FC<PropsWithChildren> }>;\n export const ReactContext = defineCapability<ReactContext>('dxos.org/app-framework/capability/react-context');\n\n export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n export const ReactRoot = defineCapability<ReactRoot>('dxos.org/app-framework/capability/react-root');\n\n export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];\n export const ReactSurface = defineCapability<ReactSurface>('dxos.org/app-framework/common/react-surface');\n\n export type IntentResolver = AnyIntentResolver | readonly AnyIntentResolver[];\n export const IntentResolver = defineCapability<IntentResolver>('dxos.org/app-framework/capability/intent-resolver');\n\n export const IntentDispatcher = defineCapability<IntentContext>(\n 'dxos.org/app-framework/capability/intent-dispatcher',\n );\n\n export type Layout = Readonly<{\n mode: string;\n dialogOpen: boolean;\n sidebarOpen: boolean;\n complementarySidebarOpen: boolean;\n /**\n * The id of the active workspace, where a workspace is a set of active items.\n */\n workspace: string;\n /**\n * Identifiers of items which are currently active in the application.\n */\n active: string[];\n /**\n * Identifiers of items which were previously active in the application.\n */\n inactive: string[];\n /**\n * Identifier of the item which should be scrolled into view.\n */\n scrollIntoView: string | undefined;\n }>;\n export const Layout = defineCapability<Layout>('dxos.org/app-framework/capability/layout');\n\n export const Translations = defineCapability<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');\n\n export const AppGraph = defineCapability<Readonly<Pick<GraphBuilder, 'graph' | 'explore'>>>(\n 'dxos.org/app-framework/capability/app-graph',\n );\n\n export const AppGraphBuilder = defineCapability<Parameters<GraphBuilder['addExtension']>[0]>(\n 'dxos.org/app-framework/capability/app-graph-builder',\n );\n\n export const AppGraphSerializer = defineCapability<NodeSerializer[]>(\n 'dxos.org/app-framework/capability/app-graph-serializer',\n );\n\n export const SettingsStore = defineCapability<RootSettingsStore>('dxos.org/app-framework/capability/settings-store');\n\n // TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.\n // export type Settings = Parameters<RootSettingsStore['createStore']>[0];\n // export type Settings<T extends SettingsValue = SettingsValue> = SettingsProps<T>;\n export type Settings = {\n schema: S.Schema.All;\n prefix: string;\n value?: Record<string, any>;\n };\n export const Settings = defineCapability<Settings>('dxos.org/app-framework/capability/settings');\n\n export type Metadata = Readonly<{ id: string; metadata: Record<string, any> }>;\n export const Metadata = defineCapability<Metadata>('dxos.org/app-framework/capability/metadata');\n\n export const Tools = defineCapability<Tool[]>('dxos.org/app-framework/capability/tools');\n export const ArtifactDefinition = defineCapability<ArtifactDefinition>(\n 'dxos.org/app-framework/capability/artifact-definition',\n );\n\n export type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;\n export const FileUploader = defineCapability<FileUploader>('dxos.org/app-framework/capability/file-uploader');\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities } from './capabilities';\nimport { defineEvent } from '../core';\n\nexport namespace Events {\n /**\n * Fired when the app is started.\n */\n export const Startup = defineEvent('dxos.org/app-framework/event/startup');\n\n //\n // Dependent Events\n //\n\n /**\n * Fired to load any newly available surfaces.\n */\n export const SetupReactSurface = defineEvent('dxos.org/app-framework/event/setup-react-surface');\n\n /**\n * Fired to load any newly available metadata.\n */\n export const SetupMetadata = defineEvent('dxos.org/app-framework/event/setup-metadata');\n\n /**\n * Fired before the intent dispatcher is activated.\n */\n export const SetupIntentResolver = defineEvent('dxos.org/app-framework/event/setup-intent-resolver');\n\n /**\n * Fired before the settings store is activated.\n */\n export const SetupSettings = defineEvent('dxos.org/app-framework/event/setup-settings');\n\n /**\n * Fired before the graph is created.\n */\n export const SetupAppGraph = defineEvent('dxos.org/app-framework/event/setup-graph');\n\n /**\n * Fired before the translations provider is created.\n */\n export const SetupTranslations = defineEvent('dxos.org/app-framework/event/setup-translations');\n\n /**\n * Fired to load any newly available artifacts definitions.\n */\n export const SetupArtifactDefinition = defineEvent('dxos.org/app-framework/event/setup-artifact-definition');\n\n //\n // Triggered Events\n //\n\n /**\n * Fired after the intent dispatcher is ready.\n */\n export const DispatcherReady = defineEvent('dxos.org/app-framework/event/dispatcher-ready');\n\n /**\n * Fired after the settings store is ready.\n */\n export const SettingsReady = defineEvent('dxos.org/app-framework/event/settings-ready');\n\n /**\n * Fired when the graph is ready.\n */\n export const AppGraphReady = defineEvent('dxos.org/app-framework/event/graph-ready');\n\n /**\n * Fired when plugin state is ready.\n */\n export const createStateEvent = (specifier: string) => defineEvent('dxos.org/app-framework/event/state', specifier);\n export const LayoutReady = createStateEvent(Capabilities.Layout.identifier);\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema as S } from 'effect';\n\n// TODO(burdon): See Accept attribute (uses MIME types).\n// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg', 'gif'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport const FileInfoSchema = S.Struct({\n name: S.String,\n type: S.String,\n url: S.optional(S.String),\n cid: S.optional(S.String), // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).\n});\n\nexport type FileInfo = S.Schema.Type<typeof FileInfoSchema>;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema as S } from 'effect';\n\nimport { Label } from '../plugin-intent';\n\nexport const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';\nexport const LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export const UPDATE_LAYOUT = `${LAYOUT_ACTION}/update-layout`;\n\n /**\n * Generic layout action.\n */\n export class UpdateLayout extends S.TaggedClass<UpdateLayout>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.String.annotations({ description: 'The part of the layout to mutate.' }),\n subject: S.optional(S.Any.annotations({ description: 'The subject of the layout update.' })),\n options: S.optional(\n S.Record({ key: S.String, value: S.Any }).annotations({\n description: 'Additional options for the layout action.',\n }),\n ),\n }),\n output: S.Void,\n }) {}\n\n //\n // Common layout actions.\n //\n\n // NOTE: These are layout actions which are currently in common use.\n // They constrain the generic layout action types to provide additional type safety.\n // However, they all follow the same generic structure and intent id.\n // This allows for plugins to update the layout without depending on a specific layout plugin.\n // The expectation is that other norms other than these will emerge over time.\n\n export class SetLayoutMode extends S.TaggedClass<SetLayoutMode>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('mode').annotations({ description: 'Setting the layout mode.' }),\n subject: S.optional(S.String.annotations({ description: 'Item which is the subject of the new layout mode.' })),\n options: S.Union(\n S.Struct({ mode: S.String.annotations({ description: 'The new layout mode.' }) }),\n S.Struct({ revert: S.Boolean.annotations({ description: 'Revert to the previous layout mode.' }) }),\n ),\n }),\n output: S.Void,\n }) {}\n\n export class UpdateSidebar extends S.TaggedClass<UpdateSidebar>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('sidebar').annotations({ description: 'Updating the sidebar.' }),\n subject: S.optional(S.String.annotations({ description: 'URI of the component to display in the sidebar.' })),\n options: S.optional(\n S.Struct({\n state: S.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the sidebar is closed, collapsed, or expanded.',\n }),\n }),\n ),\n }),\n output: S.Void,\n }) {}\n\n export class UpdateComplementary extends S.TaggedClass<UpdateComplementary>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('complementary').annotations({ description: 'Updating the complementary sidebar.' }),\n subject: S.optional(\n S.String.annotations({ description: 'URI of the component to display in the complementary area.' }),\n ),\n options: S.optional(\n S.Struct({\n state: S.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the complementary sidebar is closed, collapsed, or expanded.',\n }),\n }),\n ),\n }),\n output: S.Void,\n }) {}\n\n export class UpdateDialog extends S.TaggedClass<UpdateDialog>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('dialog').annotations({ description: 'Updating the dialog.' }),\n subject: S.optional(S.String.annotations({ description: 'URI of the component to display in the dialog.' })),\n options: S.Struct({\n state: S.optional(S.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),\n blockAlign: S.optional(\n S.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),\n ),\n type: S.optional(S.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),\n props: S.optional(\n S.Record({ key: S.String, value: S.Any }).annotations({\n description: 'Additional props for the dialog.',\n }),\n ),\n }),\n }),\n output: S.Void,\n }) {}\n\n export class UpdatePopover extends S.TaggedClass<UpdatePopover>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('popover').annotations({ description: 'Updating the popover.' }),\n subject: S.optional(S.String.annotations({ description: 'URI of the component to display in the popover.' })),\n options: S.Struct({\n anchorId: S.String.annotations({ description: 'The id of the element to anchor the popover to.' }),\n side: S.optional(\n S.Literal('top', 'right', 'bottom', 'left').annotations({ description: 'The side of the anchor.' }),\n ),\n state: S.optional(S.Boolean.annotations({ description: 'Whether the popover is open or closed.' })),\n props: S.optional(\n S.Record({ key: S.String, value: S.Any }).annotations({\n description: 'Additional props for the popover.',\n }),\n ),\n }),\n }),\n output: S.Void,\n }) {}\n\n export const Toast = S.Struct({\n id: S.String.annotations({ description: 'The id of the toast.' }),\n title: S.optional(Label.annotations({ description: 'The title of the toast.' })),\n description: S.optional(Label.annotations({ description: 'The description of the toast.' })),\n icon: S.optional(S.String.annotations({ description: 'The icon of the toast.' })),\n duration: S.optional(S.Number.annotations({ description: 'The duration of the toast.' })),\n closeLabel: S.optional(Label.annotations({ description: 'The label of the close button.' })),\n actionLabel: S.optional(Label.annotations({ description: 'The label of the action button.' })),\n actionAlt: S.optional(Label.annotations({ description: 'The alt text of the action button.' })),\n onAction: S.optional(\n S.Any.annotations({ description: 'The action to perform when the action button is clicked.' }),\n ),\n });\n\n export interface Toast extends Omit<S.Schema.Type<typeof Toast>, 'onAction'> {\n onAction?: () => void;\n }\n\n export class AddToast extends S.TaggedClass<AddToast>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('toast').annotations({ description: 'Adding a toast.' }),\n subject: Toast.annotations({ description: 'The toast to add.' }),\n }),\n output: S.Void,\n }) {}\n\n export class SwitchWorkspace extends S.TaggedClass<SwitchWorkspace>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('workspace').annotations({ description: 'Switching the workspace.' }),\n subject: S.String.annotations({ description: 'The id of the workspace to switch to.' }),\n }),\n output: S.Void,\n }) {}\n\n export class RevertWorkspace extends S.TaggedClass<RevertWorkspace>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('workspace').annotations({ description: 'Switching the workspace.' }),\n options: S.Struct({\n revert: S.Literal(true).annotations({ description: 'Revert to the previous workspace.' }),\n }),\n }),\n output: S.Void,\n }) {}\n\n export class Open extends S.TaggedClass<Open>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('main').annotations({ description: 'Opening an item in the main content area.' }),\n subject: S.Array(S.String.annotations({ description: 'Ids of the items to open.' })),\n options: S.optional(\n S.Struct({\n state: S.optional(S.Literal(true).annotations({ description: 'The items are being added.' })),\n variant: S.optional(S.String.annotations({ description: 'The variant of the item to open.' })),\n key: S.optional(\n S.String.annotations({ description: 'If provided, will replace item with a matching key (id prefix).' }),\n ),\n scrollIntoView: S.optional(S.Boolean.annotations({ description: 'Scroll the items into view.' })),\n pivotId: S.optional(S.String.annotations({ description: 'The id of the item to place new items next to.' })),\n positioning: S.optional(\n S.Union(\n S.Literal('start').annotations({ description: 'The items are being added before the pivot item.' }),\n S.Literal('end').annotations({ description: 'The items are being added after the pivot item.' }),\n ),\n ),\n }),\n ),\n }),\n output: S.Void,\n }) {}\n\n export class Set extends S.TaggedClass<Set>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('main').annotations({ description: 'Setting items in the main content area.' }),\n subject: S.Array(S.String.annotations({ description: 'Ids of the items to set.' })),\n options: S.Struct({\n override: S.Literal(true).annotations({ description: 'Override the current items in the main content area.' }),\n }),\n }),\n output: S.Void,\n }) {}\n\n export class Close extends S.TaggedClass<Close>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('main').annotations({ description: 'Closing items in the main content area.' }),\n subject: S.Array(S.String.annotations({ description: 'Ids of the items to close.' })),\n options: S.Struct({\n state: S.Literal(false).annotations({ description: 'The items are being removed.' }),\n }),\n }),\n output: S.Void,\n }) {}\n\n export class ScrollIntoView extends S.TaggedClass<ScrollIntoView>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('current').annotations({ description: 'Setting the current item' }),\n subject: S.optional(S.String.annotations({ description: 'The id of the item to set as current.' })),\n options: S.optional(\n S.Record({ key: S.String, value: S.Any }).annotations({\n description: 'Additional options for the scroll into view.',\n }),\n ),\n }),\n output: S.Void,\n }) {}\n\n export class Expose extends S.TaggedClass<Expose>()(UPDATE_LAYOUT, {\n input: S.Struct({\n part: S.Literal('navigation').annotations({ description: 'Exposing an item in the navigation area.' }),\n subject: S.String.annotations({ description: 'The id of the item to expose.' }),\n }),\n output: S.Void,\n }) {}\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { INTENT_PLUGIN } from './actions';\nimport { Events } from '../common';\nimport { defineModule, definePlugin, lazy } from '../core';\n\nexport const IntentPlugin = () =>\n definePlugin({ id: INTENT_PLUGIN, name: 'Intent' }, [\n defineModule({\n id: `${INTENT_PLUGIN}/module/dispatcher`,\n // TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.\n // This is fine for now because it's how it worked prior to capabilities api anyways.\n // In the future, the intent dispatcher should be able to be reset without resetting the entire app.\n activatesOn: Events.Startup,\n activatesAfter: [Events.DispatcherReady],\n activate: lazy(() => import('./intent-dispatcher')),\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type JSX, type ForwardedRef, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { type GuardedType, type MakeOptional, type Position } from '@dxos/util';\n\nimport { type ErrorBoundary } from '../react';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n}> &\n MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> & {\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n };\n\n// NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\ntype CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n};\n\ntype SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<\n CoreSurfaceProps<T> & { [key: string]: unknown }\n>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = (\n props: SurfaceComponentProps<T>,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | null;\n\n/**\n * Definition of when a SurfaceComponent should be rendered.\n */\nexport type SurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n id: string;\n role: string | string[];\n position?: Position;\n filter?: (data: Record<string, unknown>) => data is T;\n component: SurfaceComponent<GuardedType<SurfaceDefinition<T>['filter']>>;\n}>;\n\n/**\n * Creates a surface definition.\n */\nexport const createSurface = <T extends Record<string, any> = any>(\n definition: SurfaceDefinition<T>,\n): SurfaceDefinition<T> => definition;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema as S } from 'effect';\n\nexport const ResourceKey = S.Union(S.String, S.Record({ key: S.String, value: S.Any }));\nexport type ResourceKey = S.Schema.Type<typeof ResourceKey>;\n\nexport const ResourceLanguage = S.Record({ key: S.String, value: ResourceKey });\nexport type ResourceLanguage = S.Schema.Type<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = S.Record({ key: S.String, value: ResourceLanguage });\nexport type Resource = S.Schema.Type<typeof Resource>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAA0C;AAG1C,yBAAuB;AACvB,iBAAoB;AACpB,kBAA+E;ACL/E,IAAAA,iBAA4B;ACA5B,IAAAA,iBAA4B;AEG5B,0BAAkC;AAClC,IAAAA,iBAAuB;AAEvB,mB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H,aAAarF,aAAa;AACpEkD,QAAMiJ,WAAW,CAACC,aAAaC,UAAAA;AAC7B,WAAOnN,cAAAA,OAAO4D,IAAI,aAAA;AAChB,aAAO6K,QAAQnN,UAAU+F,OAAOI,mBAAmB;AACnD,aAAO,OAAOwF,SAASC,aAAaC,KAAAA;IACtC,CAAA;EACF;AACAnJ,QAAM+J,kBAAkB,OAAOb,gBAAAA;AAC7B,UAAMuB,QAAQhR,SAAS4J,OAAOI,mBAAmB;AACjD,WAAO,MAAMsG,gBAAgBb,WAAAA;EAC/B;AACAlJ,QAAM+I,OAAOA;AACb/I,QAAMqK,cAAcA;AAEpB,SAAOtR,YAAYoJ,aAAaM,kBAAkBzC,KAAAA;AACpD;",
6
+ "names": ["import_effect", "import_live_object", "import_log", "import_signals_core", "import_async", "createIntent", "schema", "data", "params", "_", "S", "validateSync", "fields", "input", "intent", "_schema", "id", "_tag", "first", "last", "all", "chain", "intents", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "INTENT_PLUGIN", "INTENT_ACTION", "IntentAction", "Track", "TaggedClass", "Array", "error", "output", "Void", "ShowUndo", "message", "BaseError", "Error", "constructor", "code", "context", "cause", "name", "Object", "setPrototypeOf", "prototype", "NoResolversError", "action", "CycleDetectedError", "InterfaceDefTypeId", "Symbol", "for", "defineCapability", "identifier", "CapabilityImpl", "moduleId", "implementation", "contributes", "interfaceDef", "deactivate", "interface", "lazy", "c", "props", "default", "getCapability", "PluginsContext", "activate", "reset", "_definedCapabilities", "Map", "contributeCapability", "module", "current", "get", "object", "create", "value", "untracked", "set", "push", "log", "length", "removeCapability", "index", "findIndex", "i", "splice", "warn", "requestCapabilities", "filter", "capabilities", "map", "requestCapability", "capability", "invariant", "waitForCapability", "trigger", "Trigger", "unsubscribe", "effect", "wake", "wait", "activatePromise", "event", "pipe", "Effect", "runPromise", "resetPromise", "defineEvent", "specifier", "eventKey", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents", "isPromise", "PluginManager", "pluginLoader", "plugins", "core", "meta", "enabled", "activation", "Event", "_activate", "_reset", "_capabilities", "_pluginLoader", "_state", "modules", "active", "pendingReset", "eventsFired", "forEach", "plugin", "_addPlugin", "enable", "add", "_getPlugin", "includes", "_addModule", "_setPendingResetByModule", "concurrency", "remove", "result", "disable", "_removePlugin", "enabledIndex", "_deactivate", "_removeModule", "pluginIndex", "moduleIndex", "find", "_getActiveModules", "_getInactiveModules", "_getActiveModulesByEvent", "key", "activatesOn", "_getInactiveModulesByEvent", "activationEvents", "from", "Set", "gen", "pendingIndex", "every", "emit", "state", "getCapabilities", "tryPromise", "try", "catch", "A", "zip", "_activateModule", "either", "Either", "isLeft", "left", "fail", "activatesBefore", "maybeCapabilities", "resolvedCapabilities", "Match", "when", "promise", "orElse", "program", "succeed", "isArray", "array", "activatesAfter", "results", "_deactivateModule", "isEffect", "delete", "activeIndex", "PluginModule", "options", "defineModule", "Plugin", "definePlugin", "Capabilities", "Null", "ReactContext", "ReactRoot", "ReactSurface", "IntentResolver", "IntentDispatcher", "Layout", "Translations", "AppGraph", "AppGraphBuilder", "AppGraphSerializer", "SettingsStore", "Settings", "Metadata", "Tools", "ArtifactDefinition", "FileUploader", "Events", "Startup", "SetupReactSurface", "SetupMetadata", "SetupIntentResolver", "SetupSettings", "SetupAppGraph", "SetupTranslations", "SetupArtifactDefinition", "DispatcherReady", "SettingsReady", "AppGraphReady", "createStateEvent", "LayoutReady", "defaultFileTypes", "images", "media", "text", "FileInfoSchema", "url", "cid", "IntentPlugin", "LAYOUT_PLUGIN", "LAYOUT_ACTION", "LayoutAction", "UPDATE_LAYOUT", "UpdateLayout", "part", "annotations", "description", "subject", "Any", "Record", "SetLayoutMode", "Literal", "mode", "revert", "Boolean", "UpdateSidebar", "UpdateComplementary", "UpdateDialog", "blockAlign", "UpdatePopover", "anchorId", "side", "Toast", "title", "icon", "duration", "closeLabel", "actionLabel", "actionAlt", "onAction", "AddToast", "SwitchWorkspace", "RevertWorkspace", "Open", "variant", "scrollIntoView", "pivotId", "positioning", "override", "Close", "ScrollIntoView", "Expose", "createSurface", "definition", "ResourceKey", "ResourceLanguage", "Resource", "EXECUTION_LIMIT", "HISTORY_LIMIT", "createResolver", "resolver", "isUndoable", "historyEntry", "undoable", "createDispatcher", "getResolvers", "executionLimit", "historyLimit", "historyRef", "runSync", "Ref", "make", "handleIntent", "candidates", "toSorted", "byPosition", "resolve", "undo", "_intent", "dispatch", "intentChain", "depth", "resultsRef", "prev", "update", "history", "next", "catchSome", "err", "Option", "some", "undefined", "none", "dispatchPromise", "then", "findLastIndex", "undoData", "at", "h", "undoPromise", "defaultEffect", "defaultPromise", "flat", "manager"]
7
+ }
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_7J66KH2T_exports = {};
30
- __export(chunk_7J66KH2T_exports, {
29
+ var chunk_YNTKVTVX_exports = {};
30
+ __export(chunk_YNTKVTVX_exports, {
31
31
  ErrorBoundary: () => ErrorBoundary,
32
32
  PluginManagerProvider: () => PluginManagerProvider,
33
33
  Surface: () => Surface,
@@ -42,47 +42,42 @@ __export(chunk_7J66KH2T_exports, {
42
42
  usePluginManager: () => usePluginManager,
43
43
  useSurfaces: () => useSurfaces
44
44
  });
45
- module.exports = __toCommonJS(chunk_7J66KH2T_exports);
46
- var import_chunk_2EBZ2ICH = require("./chunk-2EBZ2ICH.cjs");
45
+ module.exports = __toCommonJS(chunk_YNTKVTVX_exports);
46
+ var import_chunk_YIFTVCOR = require("./chunk-YIFTVCOR.cjs");
47
47
  var import_react = require("react");
48
48
  var import_debug = require("@dxos/debug");
49
- var import_rx_react = require("@effect-rx/rx-react");
50
- var import_invariant = require("@dxos/invariant");
51
- var import_react2 = __toESM(require("react"));
49
+ var import_signals_core = require("@preact/signals-core");
50
+ var import_react2 = require("react");
52
51
  var import_react3 = __toESM(require("react"));
52
+ var import_react4 = __toESM(require("react"));
53
53
  var import_react_hooks = require("@dxos/react-hooks");
54
54
  var import_util = require("@dxos/util");
55
- var import_react4 = require("react");
56
- var import_rx_react2 = require("@effect-rx/rx-react");
57
- var import_signals_core = require("@preact/signals-core");
58
- var import_react5 = __toESM(require("react"));
59
- var import_invariant2 = require("@dxos/invariant");
55
+ var import_react5 = require("react");
56
+ var import_signals_core2 = require("@preact/signals-core");
57
+ var import_react6 = __toESM(require("react"));
58
+ var import_invariant = require("@dxos/invariant");
60
59
  var import_live_object = require("@dxos/live-object");
61
60
  var PluginManagerContext = (0, import_react.createContext)(void 0);
62
61
  var usePluginManager = () => (0, import_react.useContext)(PluginManagerContext) ?? (0, import_debug.raise)(new Error("Missing PluginManagerContext"));
63
62
  var PluginManagerProvider = PluginManagerContext.Provider;
64
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/react/useCapabilities.ts";
65
- var useCapabilities = (interfaceDef) => {
63
+ var useCapabilities = (interfaceDef, filter) => {
66
64
  const manager = usePluginManager();
67
- return (0, import_rx_react.useRxValue)(manager.context.capabilities(interfaceDef));
65
+ const signal = (0, import_react2.useMemo)(() => (0, import_signals_core.computed)(() => manager.context.requestCapabilities(interfaceDef, filter)), [
66
+ interfaceDef
67
+ ]);
68
+ return signal.value;
68
69
  };
69
- var useCapability = (interfaceDef) => {
70
- const capabilities = useCapabilities(interfaceDef);
71
- (0, import_invariant.invariant)(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
72
- F: __dxlog_file,
73
- L: 28,
74
- S: void 0,
75
- A: [
76
- "capabilities.length > 0",
77
- "`No capability found for ${interfaceDef.identifier}`"
78
- ]
79
- });
80
- return capabilities[0];
70
+ var useCapability = (interfaceDef, filter) => {
71
+ const manager = usePluginManager();
72
+ const signal = (0, import_react2.useMemo)(() => (0, import_signals_core.computed)(() => manager.context.requestCapability(interfaceDef, filter)), [
73
+ interfaceDef
74
+ ]);
75
+ return signal.value;
81
76
  };
82
- var useIntentDispatcher = () => useCapability(import_chunk_2EBZ2ICH.Capabilities.IntentDispatcher);
83
- var useAppGraph = () => useCapability(import_chunk_2EBZ2ICH.Capabilities.AppGraph);
84
- var useLayout = () => useCapability(import_chunk_2EBZ2ICH.Capabilities.Layout);
85
- var ErrorBoundary = class extends import_react2.Component {
77
+ var useIntentDispatcher = () => useCapability(import_chunk_YIFTVCOR.Capabilities.IntentDispatcher);
78
+ var useAppGraph = () => useCapability(import_chunk_YIFTVCOR.Capabilities.AppGraph);
79
+ var useLayout = () => useCapability(import_chunk_YIFTVCOR.Capabilities.Layout);
80
+ var ErrorBoundary = class extends import_react3.Component {
86
81
  constructor(props) {
87
82
  super(props);
88
83
  this.state = {
@@ -101,7 +96,7 @@ var ErrorBoundary = class extends import_react2.Component {
101
96
  }
102
97
  render() {
103
98
  if (this.state.error) {
104
- return /* @__PURE__ */ import_react2.default.createElement(this.props.fallback, {
99
+ return /* @__PURE__ */ import_react3.default.createElement(this.props.fallback, {
105
100
  data: this.props.data,
106
101
  error: this.state.error,
107
102
  reset: this.resetError
@@ -115,10 +110,10 @@ var ErrorBoundary = class extends import_react2.Component {
115
110
  });
116
111
  }
117
112
  };
118
- var DEFAULT_PLACEHOLDER = /* @__PURE__ */ import_react3.default.createElement(import_react3.Fragment, null);
113
+ var DEFAULT_PLACEHOLDER = /* @__PURE__ */ import_react4.default.createElement(import_react4.Fragment, null);
119
114
  var useSurfaces = () => {
120
- const surfaces = useCapabilities(import_chunk_2EBZ2ICH.Capabilities.ReactSurface);
121
- return (0, import_react3.useMemo)(() => surfaces.flat(), [
115
+ const surfaces = useCapabilities(import_chunk_YIFTVCOR.Capabilities.ReactSurface);
116
+ return (0, import_react4.useMemo)(() => surfaces.flat(), [
122
117
  surfaces
123
118
  ]);
124
119
  };
@@ -126,14 +121,14 @@ var findCandidates = (surfaces, { role, data }) => {
126
121
  return Object.values(surfaces).filter((definition) => Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role).filter(({ filter }) => filter ? filter(data ?? {}) : true).toSorted(import_util.byPosition);
127
122
  };
128
123
  var isSurfaceAvailable = (context, { role, data }) => {
129
- const surfaces = context.getCapabilities(import_chunk_2EBZ2ICH.Capabilities.ReactSurface);
124
+ const surfaces = context.requestCapabilities(import_chunk_YIFTVCOR.Capabilities.ReactSurface);
130
125
  const candidates = findCandidates(surfaces.flat(), {
131
126
  role,
132
127
  data
133
128
  });
134
129
  return candidates.length > 0;
135
130
  };
136
- var Surface = /* @__PURE__ */ (0, import_react3.memo)(/* @__PURE__ */ (0, import_react3.forwardRef)(({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
131
+ var Surface = /* @__PURE__ */ (0, import_react4.memo)(/* @__PURE__ */ (0, import_react4.forwardRef)(({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
137
132
  const surfaces = useSurfaces();
138
133
  const data = (0, import_react_hooks.useDefaultValue)(_data, () => ({}));
139
134
  const definitions = findCandidates(surfaces, {
@@ -141,7 +136,7 @@ var Surface = /* @__PURE__ */ (0, import_react3.memo)(/* @__PURE__ */ (0, import
141
136
  data
142
137
  });
143
138
  const candidates = limit ? definitions.slice(0, limit) : definitions;
144
- const nodes = candidates.map(({ component: Component2, id }) => /* @__PURE__ */ import_react3.default.createElement(Component2, {
139
+ const nodes = candidates.map(({ component: Component2, id }) => /* @__PURE__ */ import_react4.default.createElement(Component2, {
145
140
  ref: forwardedRef,
146
141
  key: id,
147
142
  id,
@@ -150,10 +145,10 @@ var Surface = /* @__PURE__ */ (0, import_react3.memo)(/* @__PURE__ */ (0, import
150
145
  limit,
151
146
  ...rest
152
147
  }));
153
- const suspense = /* @__PURE__ */ import_react3.default.createElement(import_react3.Suspense, {
148
+ const suspense = /* @__PURE__ */ import_react4.default.createElement(import_react4.Suspense, {
154
149
  fallback: placeholder
155
150
  }, nodes);
156
- return fallback ? /* @__PURE__ */ import_react3.default.createElement(ErrorBoundary, {
151
+ return fallback ? /* @__PURE__ */ import_react4.default.createElement(ErrorBoundary, {
157
152
  data,
158
153
  fallback
159
154
  }, suspense) : suspense;
@@ -161,13 +156,13 @@ var Surface = /* @__PURE__ */ (0, import_react3.memo)(/* @__PURE__ */ (0, import
161
156
  Surface.displayName = "Surface";
162
157
  var useIntentResolver = (module2, resolver) => {
163
158
  const manager = usePluginManager();
164
- (0, import_react4.useEffect)(() => {
159
+ (0, import_react5.useEffect)(() => {
165
160
  manager.context.contributeCapability({
166
161
  module: module2,
167
- interface: import_chunk_2EBZ2ICH.Capabilities.IntentResolver,
162
+ interface: import_chunk_YIFTVCOR.Capabilities.IntentResolver,
168
163
  implementation: resolver
169
164
  });
170
- return () => manager.context.removeCapability(import_chunk_2EBZ2ICH.Capabilities.IntentResolver, resolver);
165
+ return () => manager.context.removeCapability(import_chunk_YIFTVCOR.Capabilities.IntentResolver, resolver);
171
166
  }, [
172
167
  module2,
173
168
  resolver
@@ -202,14 +197,14 @@ var topologicalSort = (nodes) => {
202
197
  const allDependencies = nodes.map((node) => node.id).flatMap((id) => getDependencies(id)).filter((id, index, self) => self.indexOf(id) === index);
203
198
  return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
204
199
  };
205
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
200
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
206
201
  var ENABLED_KEY = "dxos.org/app-framework/enabled";
207
- var createApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), defaults = [], placeholder, fallback = DefaultFallback, cacheEnabled = false, safeMode = false }) => {
202
+ var createApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), defaults = [], placeholder, fallback = DefaultFallback, cacheEnabled = false }) => {
208
203
  const pluginLoader = _pluginLoader ?? ((id) => {
209
204
  const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
210
- (0, import_invariant2.invariant)(plugin, `Plugin not found: ${id}`, {
211
- F: __dxlog_file2,
212
- L: 72,
205
+ (0, import_invariant.invariant)(plugin, `Plugin not found: ${id}`, {
206
+ F: __dxlog_file,
207
+ L: 68,
213
208
  S: void 0,
214
209
  A: [
215
210
  "plugin",
@@ -218,52 +213,45 @@ var createApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins = [], cor
218
213
  });
219
214
  return plugin;
220
215
  });
221
- const state = (0, import_live_object.live)({
216
+ const state = (0, import_live_object.create)({
222
217
  ready: false,
223
218
  error: null
224
219
  });
225
220
  const cached = JSON.parse(localStorage.getItem(ENABLED_KEY) ?? "[]");
226
- const enabled = safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults;
227
- const manager = pluginManager ?? new import_chunk_2EBZ2ICH.PluginManager({
221
+ const enabled = cacheEnabled && cached.length > 0 ? cached : defaults;
222
+ const manager = pluginManager ?? new import_chunk_YIFTVCOR.PluginManager({
228
223
  pluginLoader,
229
224
  plugins,
230
225
  core,
231
226
  enabled
232
227
  });
233
228
  manager.activation.on(({ event, state: _state, error }) => {
234
- if (!state.ready && event === import_chunk_2EBZ2ICH.Events.Startup.id) {
229
+ if (!state.ready && event === import_chunk_YIFTVCOR.Events.Startup.id) {
235
230
  state.ready = _state === "activated";
236
231
  }
237
232
  if (error && !state.ready && !state.error) {
238
233
  state.error = error;
239
234
  }
240
235
  });
241
- (0, import_signals_core.effect)(() => {
236
+ (0, import_signals_core2.effect)(() => {
242
237
  cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));
243
238
  });
244
239
  manager.context.contributeCapability({
245
- interface: import_chunk_2EBZ2ICH.Capabilities.PluginManager,
240
+ interface: import_chunk_YIFTVCOR.Capabilities.PluginManager,
246
241
  implementation: manager,
247
242
  module: "dxos.org/app-framework/plugin-manager"
248
243
  });
249
- manager.context.contributeCapability({
250
- interface: import_chunk_2EBZ2ICH.Capabilities.RxRegistry,
251
- implementation: manager.registry,
252
- module: "dxos.org/app-framework/rx-registry"
253
- });
254
244
  setupDevtools(manager);
255
- void manager.activate(import_chunk_2EBZ2ICH.Events.SetupReactSurface);
256
- void manager.activate(import_chunk_2EBZ2ICH.Events.Startup);
257
- return () => /* @__PURE__ */ import_react5.default.createElement(ErrorBoundary, {
245
+ void manager.activate(import_chunk_YIFTVCOR.Events.SetupReactSurface);
246
+ void manager.activate(import_chunk_YIFTVCOR.Events.Startup);
247
+ return () => /* @__PURE__ */ import_react6.default.createElement(ErrorBoundary, {
258
248
  fallback
259
- }, /* @__PURE__ */ import_react5.default.createElement(PluginManagerProvider, {
249
+ }, /* @__PURE__ */ import_react6.default.createElement(PluginManagerProvider, {
260
250
  value: manager
261
- }, /* @__PURE__ */ import_react5.default.createElement(import_rx_react2.RegistryContext.Provider, {
262
- value: manager.registry
263
- }, /* @__PURE__ */ import_react5.default.createElement(App, {
251
+ }, /* @__PURE__ */ import_react6.default.createElement(App, {
264
252
  placeholder,
265
253
  state
266
- }))));
254
+ })));
267
255
  };
268
256
  var DELAY_PLACEHOLDER = 2e3;
269
257
  var LoadingState;
@@ -274,8 +262,8 @@ var LoadingState;
274
262
  LoadingState2[LoadingState2["Done"] = 3] = "Done";
275
263
  })(LoadingState || (LoadingState = {}));
276
264
  var useLoading = (state) => {
277
- const [stage, setStage] = (0, import_react5.useState)(0);
278
- (0, import_react5.useEffect)(() => {
265
+ const [stage, setStage] = (0, import_react6.useState)(0);
266
+ (0, import_react6.useEffect)(() => {
279
267
  const i = setInterval(() => {
280
268
  setStage((tick) => {
281
269
  switch (tick) {
@@ -303,8 +291,8 @@ var useLoading = (state) => {
303
291
  return stage;
304
292
  };
305
293
  var App = ({ placeholder: Placeholder, state }) => {
306
- const reactContexts = useCapabilities(import_chunk_2EBZ2ICH.Capabilities.ReactContext);
307
- const reactRoots = useCapabilities(import_chunk_2EBZ2ICH.Capabilities.ReactRoot);
294
+ const reactContexts = useCapabilities(import_chunk_YIFTVCOR.Capabilities.ReactContext);
295
+ const reactRoots = useCapabilities(import_chunk_YIFTVCOR.Capabilities.ReactRoot);
308
296
  const stage = useLoading(state);
309
297
  if (state.error) {
310
298
  throw state.error;
@@ -313,33 +301,33 @@ var App = ({ placeholder: Placeholder, state }) => {
313
301
  if (!Placeholder) {
314
302
  return null;
315
303
  }
316
- return /* @__PURE__ */ import_react5.default.createElement(Placeholder, {
304
+ return /* @__PURE__ */ import_react6.default.createElement(Placeholder, {
317
305
  stage
318
306
  });
319
307
  }
320
308
  const ComposedContext = composeContexts(reactContexts);
321
- return /* @__PURE__ */ import_react5.default.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ import_react5.default.createElement(Component2, {
309
+ return /* @__PURE__ */ import_react6.default.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ import_react6.default.createElement(Component2, {
322
310
  key: id
323
311
  })));
324
312
  };
325
313
  var DefaultFallback = ({ error }) => {
326
- return /* @__PURE__ */ import_react5.default.createElement("div", {
314
+ return /* @__PURE__ */ import_react6.default.createElement("div", {
327
315
  style: {
328
316
  padding: "1rem"
329
317
  }
330
- }, /* @__PURE__ */ import_react5.default.createElement("h1", {
318
+ }, /* @__PURE__ */ import_react6.default.createElement("h1", {
331
319
  style: {
332
320
  fontSize: "1.2rem",
333
321
  fontWeight: 700,
334
322
  margin: "0.5rem 0"
335
323
  }
336
- }, error.message), /* @__PURE__ */ import_react5.default.createElement("pre", null, error.stack));
324
+ }, error.message), /* @__PURE__ */ import_react6.default.createElement("pre", null, error.stack));
337
325
  };
338
326
  var composeContexts = (contexts) => {
339
327
  if (contexts.length === 0) {
340
- return ({ children }) => /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, children);
328
+ return ({ children }) => /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, children);
341
329
  }
342
- return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react5.default.createElement(Acc, null, /* @__PURE__ */ import_react5.default.createElement(Next, null, children)));
330
+ return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ import_react6.default.createElement(Acc, null, /* @__PURE__ */ import_react6.default.createElement(Next, null, children)));
343
331
  };
344
332
  var setupDevtools = (manager) => {
345
333
  globalThis.composer ??= {};
@@ -361,4 +349,4 @@ var setupDevtools = (manager) => {
361
349
  usePluginManager,
362
350
  useSurfaces
363
351
  });
364
- //# sourceMappingURL=chunk-7J66KH2T.cjs.map
352
+ //# sourceMappingURL=chunk-YNTKVTVX.cjs.map