@dxos/app-framework 0.8.4-main.84f28bd → 0.8.4-main.a4bbb77

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 (366) hide show
  1. package/.storybook/main.mts +11 -0
  2. package/.storybook/preview.mts +8 -0
  3. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  4. package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
  5. package/dist/lib/browser/{app-graph-builder-BGGXLD6T.mjs → app-graph-builder-XH4OYQLC.mjs} +25 -25
  6. package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-2636QSIK.mjs → chunk-6V54SRFL.mjs} +390 -270
  8. package/dist/lib/browser/chunk-6V54SRFL.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-RGKMLI6U.mjs} +10 -7
  10. package/dist/lib/browser/chunk-RGKMLI6U.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-ZZVFNUHZ.mjs} +189 -135
  12. package/dist/lib/browser/chunk-ZZVFNUHZ.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +20 -28
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs → intent-dispatcher-VFMJVO2M.mjs} +2 -2
  16. package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-ICAPD4JL.mjs} +5 -5
  17. package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs.map +7 -0
  18. package/dist/lib/browser/meta.json +1 -1
  19. package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-7ZGMHOGB.mjs} +4 -4
  20. package/dist/lib/browser/{store-LFKDWHUQ.mjs.map → store-7ZGMHOGB.mjs.map} +2 -2
  21. package/dist/lib/browser/testing/index.mjs +14 -19
  22. package/dist/lib/browser/testing/index.mjs.map +3 -3
  23. package/dist/lib/browser/worker.mjs +7 -9
  24. package/dist/lib/node-esm/{app-graph-builder-QHIJUYYW.mjs → app-graph-builder-C7H22SOL.mjs} +25 -25
  25. package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-AXSZKZFD.mjs} +189 -135
  27. package/dist/lib/node-esm/chunk-AXSZKZFD.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-LKPMRTRR.mjs} +10 -7
  29. package/dist/lib/node-esm/chunk-LKPMRTRR.mjs.map +7 -0
  30. package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-SOVTUUAY.mjs} +390 -270
  31. package/dist/lib/node-esm/chunk-SOVTUUAY.mjs.map +7 -0
  32. package/dist/lib/node-esm/index.mjs +20 -28
  33. package/dist/lib/node-esm/index.mjs.map +3 -3
  34. package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs → intent-dispatcher-SAPOKSLZ.mjs} +2 -2
  35. package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-CRNJ6BMD.mjs} +5 -5
  36. package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs.map +7 -0
  37. package/dist/lib/node-esm/meta.json +1 -1
  38. package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-H4F4RMYD.mjs} +4 -4
  39. package/dist/lib/node-esm/{store-53XDUBMD.mjs.map → store-H4F4RMYD.mjs.map} +2 -2
  40. package/dist/lib/node-esm/testing/index.mjs +14 -19
  41. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  42. package/dist/lib/node-esm/worker.mjs +7 -9
  43. package/dist/types/src/common/capabilities.d.ts +85 -9
  44. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  45. package/dist/types/src/common/collaboration.d.ts +9 -8
  46. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  47. package/dist/types/src/common/events.d.ts.map +1 -1
  48. package/dist/types/src/common/layout.d.ts +0 -2
  49. package/dist/types/src/common/layout.d.ts.map +1 -1
  50. package/dist/types/src/common/surface.d.ts +7 -13
  51. package/dist/types/src/common/surface.d.ts.map +1 -1
  52. package/dist/types/src/components/App.d.ts +10 -0
  53. package/dist/types/src/components/App.d.ts.map +1 -0
  54. package/dist/types/src/components/App.stories.d.ts +14 -0
  55. package/dist/types/src/components/App.stories.d.ts.map +1 -0
  56. package/dist/types/src/components/DefaultFallback.d.ts +8 -0
  57. package/dist/types/src/components/DefaultFallback.d.ts.map +1 -0
  58. package/dist/types/src/components/index.d.ts +2 -0
  59. package/dist/types/src/components/index.d.ts.map +1 -0
  60. package/dist/types/src/{App.d.ts → components/useApp.d.ts} +7 -6
  61. package/dist/types/src/components/useApp.d.ts.map +1 -0
  62. package/dist/types/src/components/useLoading.d.ts +19 -0
  63. package/dist/types/src/components/useLoading.d.ts.map +1 -0
  64. package/dist/types/src/core/capabilities.d.ts +4 -1
  65. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  66. package/dist/types/src/core/manager.d.ts +6 -2
  67. package/dist/types/src/core/manager.d.ts.map +1 -1
  68. package/dist/types/src/core/plugin.d.ts +4 -1
  69. package/dist/types/src/core/plugin.d.ts.map +1 -1
  70. package/dist/types/src/index.d.ts +1 -1
  71. package/dist/types/src/index.d.ts.map +1 -1
  72. package/dist/types/src/playground/debug/Debug.d.ts +1 -1
  73. package/dist/types/src/playground/debug/plugin.d.ts +1 -1
  74. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
  75. package/dist/types/src/playground/generator/Main.d.ts +1 -1
  76. package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
  77. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  78. package/dist/types/src/playground/generator/generator.d.ts +1 -1
  79. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  80. package/dist/types/src/playground/generator/plugin.d.ts +1 -1
  81. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
  82. package/dist/types/src/playground/layout/Layout.d.ts +2 -2
  83. package/dist/types/src/playground/layout/plugin.d.ts +1 -1
  84. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
  85. package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
  86. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  87. package/dist/types/src/playground/logger/plugin.d.ts +1 -1
  88. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  89. package/dist/types/src/playground/playground.stories.d.ts +5 -4
  90. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  91. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
  92. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  93. package/dist/types/src/plugin-intent/actions.d.ts +4 -6
  94. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  95. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
  96. package/dist/types/src/plugin-intent/index.d.ts +1 -0
  97. package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
  98. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +3 -3
  99. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  100. package/dist/types/src/plugin-intent/meta.d.ts +3 -0
  101. package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
  102. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
  103. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  104. package/dist/types/src/plugin-settings/actions.d.ts +4 -6
  105. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  106. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
  107. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  108. package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
  109. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
  110. package/dist/types/src/plugin-settings/meta.d.ts +3 -0
  111. package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
  112. package/dist/types/src/plugin-settings/store.d.ts +1 -1
  113. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  114. package/dist/types/src/plugin-settings/translations.d.ts +2 -1
  115. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
  116. package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
  117. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  118. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  119. package/dist/types/src/react/Surface.d.ts +2 -2
  120. package/dist/types/src/react/Surface.d.ts.map +1 -1
  121. package/dist/types/src/react/Surface.stories.d.ts +6 -5
  122. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  123. package/dist/types/src/react/common.d.ts.map +1 -1
  124. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  125. package/dist/types/src/testing/withPluginManager.d.ts +6 -6
  126. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  127. package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
  128. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  129. package/dist/types/tsconfig.tsbuildinfo +1 -1
  130. package/moon.yml +4 -0
  131. package/package.json +34 -29
  132. package/src/common/capabilities.ts +113 -12
  133. package/src/common/collaboration.ts +5 -8
  134. package/src/common/events.ts +3 -1
  135. package/src/common/layout.ts +2 -3
  136. package/src/common/surface.ts +15 -18
  137. package/src/components/App.stories.tsx +33 -0
  138. package/src/components/App.tsx +59 -0
  139. package/src/components/DefaultFallback.tsx +26 -0
  140. package/src/components/index.ts +5 -0
  141. package/src/{App.tsx → components/useApp.tsx} +24 -136
  142. package/src/components/useLoading.tsx +70 -0
  143. package/src/core/capabilities.test.ts +1 -1
  144. package/src/core/capabilities.ts +11 -6
  145. package/src/core/manager.test.ts +21 -20
  146. package/src/core/manager.ts +132 -54
  147. package/src/core/plugin.ts +8 -2
  148. package/src/helpers.test.ts +1 -1
  149. package/src/index.ts +1 -1
  150. package/src/playground/debug/Debug.tsx +1 -1
  151. package/src/playground/debug/plugin.ts +7 -8
  152. package/src/playground/generator/Toolbar.tsx +2 -1
  153. package/src/playground/generator/generator.ts +3 -3
  154. package/src/playground/generator/plugin.ts +12 -13
  155. package/src/playground/layout/plugin.ts +10 -9
  156. package/src/playground/logger/Toolbar.tsx +2 -1
  157. package/src/playground/logger/plugin.ts +30 -25
  158. package/src/playground/playground.stories.tsx +20 -16
  159. package/src/plugin-intent/IntentPlugin.ts +13 -13
  160. package/src/plugin-intent/actions.ts +3 -5
  161. package/src/plugin-intent/errors.ts +1 -0
  162. package/src/plugin-intent/index.ts +1 -0
  163. package/src/plugin-intent/intent-dispatcher.test.ts +1 -1
  164. package/src/plugin-intent/intent-dispatcher.ts +9 -8
  165. package/src/plugin-intent/meta.ts +10 -0
  166. package/src/plugin-settings/SettingsPlugin.ts +27 -28
  167. package/src/plugin-settings/actions.ts +8 -12
  168. package/src/plugin-settings/app-graph-builder.ts +14 -12
  169. package/src/plugin-settings/intent-resolver.ts +3 -2
  170. package/src/plugin-settings/meta.ts +10 -0
  171. package/src/plugin-settings/store.ts +1 -1
  172. package/src/plugin-settings/translations.ts +3 -3
  173. package/src/react/ErrorBoundary.tsx +24 -15
  174. package/src/react/IntentContext.tsx +3 -2
  175. package/src/react/Surface.stories.tsx +23 -18
  176. package/src/react/Surface.tsx +14 -5
  177. package/src/react/common.ts +2 -1
  178. package/src/react/useCapabilities.ts +2 -1
  179. package/src/testing/withPluginManager.stories.tsx +9 -5
  180. package/src/testing/withPluginManager.tsx +25 -29
  181. package/tsconfig.json +5 -9
  182. package/vitest.config.ts +8 -6
  183. package/.eslintrc.cjs +0 -9
  184. package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
  185. package/dist/lib/browser/app-graph-builder-BGGXLD6T.mjs.map +0 -7
  186. package/dist/lib/browser/chunk-2636QSIK.mjs.map +0 -7
  187. package/dist/lib/browser/chunk-DHZB7HG7.mjs.map +0 -7
  188. package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
  189. package/dist/lib/browser/intent-resolver-O67UANYP.mjs.map +0 -7
  190. package/dist/lib/node-esm/app-graph-builder-QHIJUYYW.mjs.map +0 -7
  191. package/dist/lib/node-esm/chunk-NJAFK626.mjs.map +0 -7
  192. package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
  193. package/dist/lib/node-esm/chunk-VSKRV3NW.mjs.map +0 -7
  194. package/dist/lib/node-esm/intent-resolver-K3D4BXQQ.mjs.map +0 -7
  195. package/dist/types/src/App.d.ts.map +0 -1
  196. package/typedoc/.nojekyll +0 -1
  197. package/typedoc/assets/hierarchy.js +0 -1
  198. package/typedoc/assets/highlight.css +0 -106
  199. package/typedoc/assets/icons.js +0 -18
  200. package/typedoc/assets/icons.svg +0 -1
  201. package/typedoc/assets/main.js +0 -60
  202. package/typedoc/assets/navigation.js +0 -1
  203. package/typedoc/assets/search.js +0 -1
  204. package/typedoc/assets/style.css +0 -1640
  205. package/typedoc/classes/CollaborationActions.InsertContent.html +0 -421
  206. package/typedoc/classes/ErrorBoundary.html +0 -125
  207. package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
  208. package/typedoc/classes/IntentAction.Track.html +0 -266
  209. package/typedoc/classes/LayoutAction.AddToast.html +0 -265
  210. package/typedoc/classes/LayoutAction.Close.html +0 -382
  211. package/typedoc/classes/LayoutAction.Expose.html +0 -265
  212. package/typedoc/classes/LayoutAction.Open.html +0 -1123
  213. package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
  214. package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
  215. package/typedoc/classes/LayoutAction.Set.html +0 -460
  216. package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
  217. package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
  218. package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
  219. package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -1123
  220. package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
  221. package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
  222. package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
  223. package/typedoc/classes/Plugin.html +0 -6
  224. package/typedoc/classes/PluginContext.html +0 -38
  225. package/typedoc/classes/PluginManager.html +0 -43
  226. package/typedoc/classes/PluginModule.html +0 -18
  227. package/typedoc/classes/SettingsAction.Open.html +0 -226
  228. package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
  229. package/typedoc/functions/Events.createStateEvent.html +0 -2
  230. package/typedoc/functions/IntentPlugin.html +0 -1
  231. package/typedoc/functions/SettingsPlugin.html +0 -1
  232. package/typedoc/functions/allOf.html +0 -2
  233. package/typedoc/functions/chain.html +0 -3
  234. package/typedoc/functions/contributes.html +0 -2
  235. package/typedoc/functions/createDispatcher.html +0 -3
  236. package/typedoc/functions/createIntent.html +0 -6
  237. package/typedoc/functions/createResolver.html +0 -2
  238. package/typedoc/functions/createSurface.html +0 -2
  239. package/typedoc/functions/defineCapability.html +0 -2
  240. package/typedoc/functions/defineEvent.html +0 -2
  241. package/typedoc/functions/defineModule.html +0 -2
  242. package/typedoc/functions/definePlugin.html +0 -2
  243. package/typedoc/functions/eventKey.html +0 -2
  244. package/typedoc/functions/getEvents.html +0 -2
  245. package/typedoc/functions/isAllOf.html +0 -2
  246. package/typedoc/functions/isOneOf.html +0 -2
  247. package/typedoc/functions/isSurfaceAvailable.html +0 -2
  248. package/typedoc/functions/lazy.html +0 -2
  249. package/typedoc/functions/oneOf.html +0 -2
  250. package/typedoc/functions/useApp.html +0 -6
  251. package/typedoc/functions/useAppGraph.html +0 -1
  252. package/typedoc/functions/useCapabilities.html +0 -3
  253. package/typedoc/functions/useCapability.html +0 -4
  254. package/typedoc/functions/useIntentDispatcher.html +0 -1
  255. package/typedoc/functions/useIntentResolver.html +0 -1
  256. package/typedoc/functions/useLayout.html +0 -1
  257. package/typedoc/functions/usePluginManager.html +0 -2
  258. package/typedoc/hierarchy.html +0 -1
  259. package/typedoc/index.html +0 -12
  260. package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
  261. package/typedoc/media/LICENSE +0 -8
  262. package/typedoc/modules/Capabilities.html +0 -1
  263. package/typedoc/modules/CollaborationActions.html +0 -1
  264. package/typedoc/modules/Events.html +0 -1
  265. package/typedoc/modules/IntentAction.html +0 -1
  266. package/typedoc/modules/LayoutAction.html +0 -2
  267. package/typedoc/modules/SettingsAction.html +0 -1
  268. package/typedoc/modules.html +0 -1
  269. package/typedoc/types/ActivationEvent.html +0 -8
  270. package/typedoc/types/ActivationEvents.html +0 -2
  271. package/typedoc/types/AnyCapability.html +0 -1
  272. package/typedoc/types/AnyIntent.html +0 -1
  273. package/typedoc/types/AnyIntentChain.html +0 -1
  274. package/typedoc/types/AnyIntentEffectResult.html +0 -1
  275. package/typedoc/types/AnyIntentResolver.html +0 -1
  276. package/typedoc/types/AnyIntentResult.html +0 -1
  277. package/typedoc/types/Capabilities.FileUploader.html +0 -1
  278. package/typedoc/types/Capabilities.IntentResolver.html +0 -1
  279. package/typedoc/types/Capabilities.Layout.html +0 -1
  280. package/typedoc/types/Capabilities.Metadata.html +0 -1
  281. package/typedoc/types/Capabilities.ReactContext.html +0 -1
  282. package/typedoc/types/Capabilities.ReactRoot.html +0 -1
  283. package/typedoc/types/Capabilities.ReactSurface.html +0 -1
  284. package/typedoc/types/Capabilities.Settings.html +0 -4
  285. package/typedoc/types/Capability.html +0 -9
  286. package/typedoc/types/CreateAppOptions.html +0 -10
  287. package/typedoc/types/FileInfo.html +0 -1
  288. package/typedoc/types/Intent.html +0 -10
  289. package/typedoc/types/IntentChain.html +0 -6
  290. package/typedoc/types/IntentContext.html +0 -5
  291. package/typedoc/types/IntentData.html +0 -1
  292. package/typedoc/types/IntentDispatcher.html +0 -2
  293. package/typedoc/types/IntentDispatcherResult.html +0 -2
  294. package/typedoc/types/IntentEffectDefinition.html +0 -2
  295. package/typedoc/types/IntentEffectResult.html +0 -15
  296. package/typedoc/types/IntentParams.html +0 -3
  297. package/typedoc/types/IntentResolver.html +0 -2
  298. package/typedoc/types/IntentResultData.html +0 -1
  299. package/typedoc/types/IntentSchema.html +0 -1
  300. package/typedoc/types/IntentUndo.html +0 -2
  301. package/typedoc/types/InterfaceDef.html +0 -4
  302. package/typedoc/types/Label.html +0 -1
  303. package/typedoc/types/NodeSerializer.html +0 -8
  304. package/typedoc/types/PluginManagerOptions.html +0 -6
  305. package/typedoc/types/PluginMeta.html +0 -21
  306. package/typedoc/types/PromiseIntentDispatcher.html +0 -2
  307. package/typedoc/types/PromiseIntentUndo.html +0 -2
  308. package/typedoc/types/Resource.html +0 -1
  309. package/typedoc/types/ResourceKey.html +0 -1
  310. package/typedoc/types/ResourceLanguage.html +0 -1
  311. package/typedoc/types/SerializedNode.html +0 -4
  312. package/typedoc/types/SurfaceComponent.html +0 -2
  313. package/typedoc/types/SurfaceDefinition.html +0 -2
  314. package/typedoc/types/SurfaceProps.html +0 -4
  315. package/typedoc/variables/Capabilities.AnchorSort.html +0 -1
  316. package/typedoc/variables/Capabilities.AppGraph.html +0 -1
  317. package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
  318. package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
  319. package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
  320. package/typedoc/variables/Capabilities.FileUploader.html +0 -1
  321. package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
  322. package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
  323. package/typedoc/variables/Capabilities.Layout.html +0 -1
  324. package/typedoc/variables/Capabilities.Metadata.html +0 -1
  325. package/typedoc/variables/Capabilities.Null.html +0 -1
  326. package/typedoc/variables/Capabilities.PluginManager.html +0 -1
  327. package/typedoc/variables/Capabilities.ReactContext.html +0 -1
  328. package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
  329. package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
  330. package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
  331. package/typedoc/variables/Capabilities.Settings.html +0 -1
  332. package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
  333. package/typedoc/variables/Capabilities.Tools.html +0 -1
  334. package/typedoc/variables/Capabilities.Translations.html +0 -1
  335. package/typedoc/variables/Events.AppGraphReady.html +0 -2
  336. package/typedoc/variables/Events.DispatcherReady.html +0 -2
  337. package/typedoc/variables/Events.LayoutReady.html +0 -1
  338. package/typedoc/variables/Events.SettingsReady.html +0 -2
  339. package/typedoc/variables/Events.SetupAppGraph.html +0 -2
  340. package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
  341. package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
  342. package/typedoc/variables/Events.SetupMetadata.html +0 -2
  343. package/typedoc/variables/Events.SetupReactSurface.html +0 -2
  344. package/typedoc/variables/Events.SetupSettings.html +0 -2
  345. package/typedoc/variables/Events.SetupTranslations.html +0 -2
  346. package/typedoc/variables/Events.Startup.html +0 -2
  347. package/typedoc/variables/FileInfoSchema.html +0 -1
  348. package/typedoc/variables/INTENT_ACTION.html +0 -1
  349. package/typedoc/variables/INTENT_PLUGIN.html +0 -1
  350. package/typedoc/variables/LAYOUT_ACTION.html +0 -1
  351. package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
  352. package/typedoc/variables/Label.html +0 -1
  353. package/typedoc/variables/LayoutAction.Toast.html +0 -1
  354. package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
  355. package/typedoc/variables/PluginManagerProvider.html +0 -2
  356. package/typedoc/variables/Resource.html +0 -2
  357. package/typedoc/variables/ResourceKey.html +0 -1
  358. package/typedoc/variables/ResourceLanguage.html +0 -1
  359. package/typedoc/variables/SETTINGS_ACTION.html +0 -1
  360. package/typedoc/variables/SETTINGS_ID.html +0 -1
  361. package/typedoc/variables/SETTINGS_KEY.html +0 -1
  362. package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
  363. package/typedoc/variables/Surface.html +0 -2
  364. package/typedoc/variables/defaultFileTypes.html +0 -1
  365. /package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs.map → intent-dispatcher-VFMJVO2M.mjs.map} +0 -0
  366. /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-SAPOKSLZ.mjs.map} +0 -0
@@ -1,109 +1,28 @@
1
1
  // src/plugin-intent/intent-dispatcher.ts
2
- import { Effect as Effect3, Option, pipe as pipe2, Ref as Ref2 } from "effect";
2
+ import { Effect as Effect3, Option, Ref as Ref2, pipe as pipe2 } from "effect";
3
3
  import { live as live2 } from "@dxos/live-object";
4
4
  import { log as log3 } from "@dxos/log";
5
5
  import { byPosition } from "@dxos/util";
6
6
 
7
- // src/plugin-intent/actions.ts
8
- import { Schema as Schema2 } from "effect";
9
-
10
- // src/plugin-intent/intent.ts
11
- import { Schema } from "effect";
12
- var createIntent = (schema, data = {}, params = {}) => {
13
- const _ = Schema.validateSync(schema.fields.input)(data);
14
- const intent = {
15
- ...params,
16
- _schema: schema,
17
- id: schema._tag,
18
- data
19
- };
20
- return {
21
- first: intent,
22
- last: intent,
23
- all: [
24
- intent
25
- ]
26
- };
27
- };
28
- var chain = (schema, data = {}, params = {}) => (intent) => {
29
- const intents = "all" in intent ? intent.all : [
30
- intent
31
- ];
32
- const first = intents[0];
33
- const last = {
34
- ...params,
35
- _schema: schema,
36
- id: schema._tag,
37
- data
38
- };
39
- return {
40
- first,
41
- last,
42
- all: [
43
- ...intents,
44
- last
45
- ]
46
- };
47
- };
48
- var Label = Schema.Union(Schema.String, Schema.mutable(Schema.Tuple(Schema.String, Schema.mutable(Schema.Struct({
49
- ns: Schema.String,
50
- count: Schema.optional(Schema.Number),
51
- defaultValue: Schema.optional(Schema.String)
52
- })))));
53
-
54
- // src/plugin-intent/actions.ts
55
- var INTENT_PLUGIN = "dxos.org/plugin/intent";
56
- var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
57
- (function(IntentAction2) {
58
- class Track extends Schema2.TaggedClass()(`${INTENT_ACTION}/track`, {
59
- input: Schema2.Struct({
60
- intents: Schema2.Array(Schema2.String),
61
- error: Schema2.optional(Schema2.String)
62
- }),
63
- output: Schema2.Void
64
- }) {
65
- }
66
- IntentAction2.Track = Track;
67
- class ShowUndo extends Schema2.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
68
- input: Schema2.Struct({
69
- message: Label
70
- }),
71
- output: Schema2.Void
72
- }) {
73
- }
74
- IntentAction2.ShowUndo = ShowUndo;
75
- })(IntentAction || (IntentAction = {}));
76
- var IntentAction;
77
-
78
- // src/plugin-intent/errors.ts
79
- var BaseError = class extends Error {
80
- constructor(code, message, context) {
81
- super(message ?? code, {
82
- cause: context
83
- }), this.code = code, this.context = context;
84
- this.name = code;
85
- Object.setPrototypeOf(this, new.target.prototype);
86
- }
87
- };
88
- var NoResolversError = class extends BaseError {
89
- constructor(action) {
90
- super("NO_RESOLVERS", "No resolvers were found for the action", {
91
- action
92
- });
93
- }
94
- };
95
- var CycleDetectedError = class extends BaseError {
96
- constructor(context) {
97
- super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
98
- }
99
- };
100
-
101
7
  // src/core/capabilities.ts
102
8
  import { Rx } from "@effect-rx/rx-react";
103
9
  import { Effect } from "effect";
104
10
  import { Trigger } from "@dxos/async";
105
11
  import { invariant } from "@dxos/invariant";
106
12
  import { log } from "@dxos/log";
13
+ function _define_property(obj, key, value) {
14
+ if (key in obj) {
15
+ Object.defineProperty(obj, key, {
16
+ value,
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true
20
+ });
21
+ } else {
22
+ obj[key] = value;
23
+ }
24
+ return obj;
25
+ }
107
26
  var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
108
27
  var InterfaceDefTypeId = Symbol.for("InterfaceDefTypeId");
109
28
  var defineCapability = (identifier) => {
@@ -113,6 +32,8 @@ var defineCapability = (identifier) => {
113
32
  };
114
33
  var CapabilityImpl = class {
115
34
  constructor(moduleId, implementation) {
35
+ _define_property(this, "moduleId", void 0);
36
+ _define_property(this, "implementation", void 0);
116
37
  this.moduleId = moduleId;
117
38
  this.implementation = implementation;
118
39
  }
@@ -129,35 +50,6 @@ var lazy = (c) => async (props) => {
129
50
  return async () => getCapability(props);
130
51
  };
131
52
  var PluginContext = class {
132
- constructor({ registry, activate, reset }) {
133
- this._capabilityImpls = Rx.family(() => {
134
- return Rx.make([]).pipe(Rx.keepAlive);
135
- });
136
- this._capabilities = Rx.family((id) => {
137
- return Rx.make((get) => {
138
- const current = get(this._capabilityImpls(id));
139
- return current.map((c) => c.implementation);
140
- });
141
- });
142
- this._capability = Rx.family((id) => {
143
- return Rx.make((get) => {
144
- const current = get(this._capabilities(id));
145
- invariant(current.length > 0, `No capability found for ${id}`, {
146
- F: __dxlog_file,
147
- L: 117,
148
- S: this,
149
- A: [
150
- "current.length > 0",
151
- "`No capability found for ${id}`"
152
- ]
153
- });
154
- return current[0];
155
- });
156
- });
157
- this._registry = registry;
158
- this.activate = activate;
159
- this.reset = reset;
160
- }
161
53
  /**
162
54
  * @internal
163
55
  */
@@ -177,7 +69,7 @@ var PluginContext = class {
177
69
  count: current.length
178
70
  }, {
179
71
  F: __dxlog_file,
180
- L: 161,
72
+ L: 166,
181
73
  S: this,
182
74
  C: (f, a) => f(...a)
183
75
  });
@@ -198,7 +90,7 @@ var PluginContext = class {
198
90
  count: current.length
199
91
  }, {
200
92
  F: __dxlog_file,
201
- L: 180,
93
+ L: 185,
202
94
  S: this,
203
95
  C: (f, a) => f(...a)
204
96
  });
@@ -207,7 +99,7 @@ var PluginContext = class {
207
99
  id: interfaceDef.identifier
208
100
  }, {
209
101
  F: __dxlog_file,
210
- L: 182,
102
+ L: 187,
211
103
  S: this,
212
104
  C: (f, a) => f(...a)
213
105
  });
@@ -272,6 +164,38 @@ var PluginContext = class {
272
164
  async resetPromise(event) {
273
165
  return this.reset(event).pipe(Effect.runPromise);
274
166
  }
167
+ constructor({ registry, activate, reset }) {
168
+ _define_property(this, "_registry", void 0);
169
+ _define_property(this, "_capabilityImpls", Rx.family(() => {
170
+ return Rx.make([]).pipe(Rx.keepAlive);
171
+ }));
172
+ _define_property(this, "_capabilities", Rx.family((id) => {
173
+ return Rx.make((get) => {
174
+ const current = get(this._capabilityImpls(id));
175
+ return current.map((c) => c.implementation);
176
+ });
177
+ }));
178
+ _define_property(this, "_capability", Rx.family((id) => {
179
+ return Rx.make((get) => {
180
+ const current = get(this._capabilities(id));
181
+ invariant(current.length > 0, `No capability found for ${id}`, {
182
+ F: __dxlog_file,
183
+ L: 122,
184
+ S: this,
185
+ A: [
186
+ "current.length > 0",
187
+ "`No capability found for ${id}`"
188
+ ]
189
+ });
190
+ return current[0];
191
+ });
192
+ }));
193
+ _define_property(this, "activate", void 0);
194
+ _define_property(this, "reset", void 0);
195
+ this._registry = registry;
196
+ this.activate = activate;
197
+ this.reset = reset;
198
+ }
275
199
  };
276
200
 
277
201
  // src/core/events.ts
@@ -299,38 +223,28 @@ var getEvents = (events) => "type" in events ? events.events : [
299
223
  // src/core/manager.ts
300
224
  import { Registry } from "@effect-rx/rx-react";
301
225
  import { untracked } from "@preact/signals-core";
302
- import { Array as A, Effect as Effect2, Either, Match, pipe } from "effect";
226
+ import { Array, Duration, Effect as Effect2, Fiber, HashSet, Match, Ref, pipe } from "effect";
303
227
  import { Event } from "@dxos/async";
304
228
  import { live } from "@dxos/live-object";
305
229
  import { log as log2 } from "@dxos/log";
230
+ function _define_property2(obj, key, value) {
231
+ if (key in obj) {
232
+ Object.defineProperty(obj, key, {
233
+ value,
234
+ enumerable: true,
235
+ configurable: true,
236
+ writable: true
237
+ });
238
+ } else {
239
+ obj[key] = value;
240
+ }
241
+ return obj;
242
+ }
306
243
  var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
307
244
  var isPromise = (value) => {
308
245
  return value !== null && typeof value === "object" && "then" in value;
309
246
  };
310
247
  var PluginManager = class {
311
- constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), enabled = [], registry }) {
312
- this.activation = new Event();
313
- this._capabilities = /* @__PURE__ */ new Map();
314
- this.registry = registry ?? Registry.make();
315
- this.context = new PluginContext({
316
- registry: this.registry,
317
- activate: (event) => this._activate(event),
318
- reset: (id) => this._reset(id)
319
- });
320
- this._pluginLoader = pluginLoader;
321
- this._state = live({
322
- plugins,
323
- core,
324
- enabled,
325
- modules: [],
326
- active: [],
327
- pendingReset: [],
328
- eventsFired: []
329
- });
330
- plugins.forEach((plugin) => this._addPlugin(plugin));
331
- core.forEach((id) => this.enable(id));
332
- enabled.forEach((id) => this.enable(id));
333
- }
334
248
  /**
335
249
  * Plugins that are currently registered.
336
250
  *
@@ -397,7 +311,7 @@ var PluginManager = class {
397
311
  id
398
312
  }, {
399
313
  F: __dxlog_file2,
400
- L: 154,
314
+ L: 157,
401
315
  S: this,
402
316
  C: (f, a) => f(...a)
403
317
  });
@@ -416,7 +330,7 @@ var PluginManager = class {
416
330
  id
417
331
  }, {
418
332
  F: __dxlog_file2,
419
- L: 167,
333
+ L: 170,
420
334
  S: this,
421
335
  C: (f, a) => f(...a)
422
336
  });
@@ -437,7 +351,7 @@ var PluginManager = class {
437
351
  ]
438
352
  }, {
439
353
  F: __dxlog_file2,
440
- L: 182,
354
+ L: 185,
441
355
  S: this,
442
356
  C: (f, a) => f(...a)
443
357
  });
@@ -457,7 +371,7 @@ var PluginManager = class {
457
371
  id
458
372
  }, {
459
373
  F: __dxlog_file2,
460
- L: 200,
374
+ L: 203,
461
375
  S: this,
462
376
  C: (f, a) => f(...a)
463
377
  });
@@ -479,7 +393,7 @@ var PluginManager = class {
479
393
  id
480
394
  }, {
481
395
  F: __dxlog_file2,
482
- L: 217,
396
+ L: 220,
483
397
  S: this,
484
398
  C: (f, a) => f(...a)
485
399
  });
@@ -531,7 +445,7 @@ var PluginManager = class {
531
445
  id: plugin.meta.id
532
446
  }, {
533
447
  F: __dxlog_file2,
534
- L: 270,
448
+ L: 273,
535
449
  S: this,
536
450
  C: (f, a) => f(...a)
537
451
  });
@@ -546,7 +460,7 @@ var PluginManager = class {
546
460
  id
547
461
  }, {
548
462
  F: __dxlog_file2,
549
- L: 279,
463
+ L: 283,
550
464
  S: this,
551
465
  C: (f, a) => f(...a)
552
466
  });
@@ -562,7 +476,7 @@ var PluginManager = class {
562
476
  id: module.id
563
477
  }, {
564
478
  F: __dxlog_file2,
565
- L: 289,
479
+ L: 293,
566
480
  S: this,
567
481
  C: (f, a) => f(...a)
568
482
  });
@@ -577,7 +491,7 @@ var PluginManager = class {
577
491
  id
578
492
  }, {
579
493
  F: __dxlog_file2,
580
- L: 298,
494
+ L: 303,
581
495
  S: this,
582
496
  C: (f, a) => f(...a)
583
497
  });
@@ -605,13 +519,13 @@ var PluginManager = class {
605
519
  _setPendingResetByModule(module) {
606
520
  return untracked(() => {
607
521
  const activationEvents = getEvents(module.activatesOn).map(eventKey).filter((key) => this._state.eventsFired.includes(key));
608
- const pendingReset = Array.from(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
522
+ const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => !this._state.pendingReset.includes(event));
609
523
  if (pendingReset.length > 0) {
610
524
  log2("pending reset", {
611
525
  events: pendingReset
612
526
  }, {
613
527
  F: __dxlog_file2,
614
- L: 336,
528
+ L: 341,
615
529
  S: this,
616
530
  C: (f, a) => f(...a)
617
531
  });
@@ -623,35 +537,40 @@ var PluginManager = class {
623
537
  * @internal
624
538
  */
625
539
  // TODO(wittjosiah): Improve error typing.
626
- _activate(event) {
540
+ _activate(event, params) {
627
541
  return Effect2.gen(this, function* () {
628
542
  const key = typeof event === "string" ? event : eventKey(event);
629
543
  log2("activating", {
630
- key
544
+ key,
545
+ ...params
631
546
  }, {
632
547
  F: __dxlog_file2,
633
- L: 349,
548
+ L: 357,
634
549
  S: this,
635
550
  C: (f, a) => f(...a)
636
551
  });
552
+ yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));
637
553
  const pendingIndex = this._state.pendingReset.findIndex((event2) => event2 === key);
638
554
  if (pendingIndex !== -1) {
639
555
  this._state.pendingReset.splice(pendingIndex, 1);
640
556
  }
557
+ const activatingEvents = yield* this._activatingEvents;
558
+ const activatingModules = yield* this._activatingModules;
641
559
  const modules = this._getInactiveModulesByEvent(key).filter((module) => {
642
560
  const allOf2 = isAllOf(module.activatesOn);
643
561
  if (!allOf2) {
644
562
  return true;
645
563
  }
646
564
  const events = module.activatesOn.events.filter((event2) => eventKey(event2) !== key);
647
- return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)));
565
+ return events.every((event2) => this._state.eventsFired.includes(eventKey(event2)) || activatingEvents.includes(eventKey(event2))) && !activatingModules.includes(module.id);
648
566
  });
567
+ yield* Ref.update(this._activatingModules, (activating) => Array.appendAll(activating, modules.map((module) => module.id)));
649
568
  if (modules.length === 0) {
650
569
  log2("no modules to activate", {
651
570
  key
652
571
  }, {
653
572
  F: __dxlog_file2,
654
- L: 365,
573
+ L: 388,
655
574
  S: this,
656
575
  C: (f, a) => f(...a)
657
576
  });
@@ -665,7 +584,7 @@ var PluginManager = class {
665
584
  modules: modules.map((module) => module.id)
666
585
  }, {
667
586
  F: __dxlog_file2,
668
- L: 372,
587
+ L: 395,
669
588
  S: this,
670
589
  C: (f, a) => f(...a)
671
590
  });
@@ -673,29 +592,36 @@ var PluginManager = class {
673
592
  event: key,
674
593
  state: "activating"
675
594
  });
676
- const getCapabilities = yield* Effect2.all(modules.map(({ activate }) => Effect2.tryPromise({
677
- try: async () => activate(this.context),
678
- catch: (error) => error
679
- })), {
595
+ yield* pipe(modules, Array.flatMap((module) => module.activatesBefore ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
596
+ before: key
597
+ })), Effect2.allWith({
680
598
  concurrency: "unbounded"
681
- });
682
- const result = yield* pipe(
683
- modules,
684
- A.zip(getCapabilities),
685
- A.map(([module, getCapabilities2]) => this._activateModule(module, getCapabilities2)),
686
- // TODO(wittjosiah): This currently can't be run in parallel.
687
- // Running this with concurrency causes races with `allOf` activation events.
688
- Effect2.all,
689
- Effect2.either
690
- );
691
- if (Either.isLeft(result)) {
599
+ }));
600
+ const getCapabilities = yield* pipe(modules, Array.map((mod) => this._loadModule(mod)), Effect2.allWith({
601
+ concurrency: "unbounded"
602
+ }), Effect2.catchAll((error) => {
692
603
  this.activation.emit({
693
604
  event: key,
694
605
  state: "error",
695
- error: result.left
606
+ error
696
607
  });
697
- yield* Effect2.fail(result.left);
698
- }
608
+ return Effect2.fail(error);
609
+ }));
610
+ yield* pipe(
611
+ modules,
612
+ Array.zip(getCapabilities),
613
+ Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),
614
+ // TODO(wittjosiah): This currently can't be run in parallel.
615
+ // Running this with concurrency causes races with `allOf` activation events.
616
+ Effect2.all
617
+ );
618
+ yield* pipe(modules, Array.flatMap((module) => module.activatesAfter ?? []), HashSet.fromIterable, HashSet.toValues, Array.filter((event2) => !activatingEvents.includes(eventKey(event2))), Array.map((event2) => this._activate(event2, {
619
+ after: key
620
+ })), Effect2.allWith({
621
+ concurrency: "unbounded"
622
+ }));
623
+ yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event2) => event2 !== key));
624
+ yield* Ref.update(this._activatingModules, (activating) => Array.filter(activating, (module) => !modules.map((module2) => module2.id).includes(module)));
699
625
  if (!this._state.eventsFired.includes(key)) {
700
626
  this._state.eventsFired.push(key);
701
627
  }
@@ -707,39 +633,15 @@ var PluginManager = class {
707
633
  key
708
634
  }, {
709
635
  F: __dxlog_file2,
710
- L: 406,
636
+ L: 451,
711
637
  S: this,
712
638
  C: (f, a) => f(...a)
713
639
  });
714
640
  return true;
715
641
  });
716
642
  }
717
- _activateModule(module, getCapabilities) {
643
+ _contributeCapabilities(module, capabilities) {
718
644
  return Effect2.gen(this, function* () {
719
- yield* Effect2.all(module.activatesBefore?.map((event) => this._activate(event)) ?? [], {
720
- concurrency: "unbounded"
721
- });
722
- log2("activating module...", {
723
- module: module.id
724
- }, {
725
- F: __dxlog_file2,
726
- L: 421,
727
- S: this,
728
- C: (f, a) => f(...a)
729
- });
730
- const maybeCapabilities = typeof getCapabilities === "function" ? getCapabilities() : getCapabilities;
731
- const resolvedCapabilities = yield* Match.value(maybeCapabilities).pipe(
732
- // TODO(wittjosiah): Activate with an effect?
733
- // Match.when(Effect.isEffect, (effect) => effect),
734
- Match.when(isPromise, (promise) => Effect2.tryPromise({
735
- try: () => promise,
736
- catch: (error) => error
737
- })),
738
- Match.orElse((program) => Effect2.succeed(program))
739
- );
740
- const capabilities = Match.value(resolvedCapabilities).pipe(Match.when(Array.isArray, (array) => array), Match.orElse((value) => [
741
- value
742
- ]));
743
645
  capabilities.forEach((capability) => {
744
646
  this.context.contributeCapability({
745
647
  module: module.id,
@@ -748,17 +650,6 @@ var PluginManager = class {
748
650
  });
749
651
  this._state.active.push(module.id);
750
652
  this._capabilities.set(module.id, capabilities);
751
- log2("activated module", {
752
- module: module.id
753
- }, {
754
- F: __dxlog_file2,
755
- L: 444,
756
- S: this,
757
- C: (f, a) => f(...a)
758
- });
759
- yield* Effect2.all(module.activatesAfter?.map((event) => this._activate(event)) ?? [], {
760
- concurrency: "unbounded"
761
- });
762
653
  });
763
654
  }
764
655
  _deactivate(id) {
@@ -781,10 +672,11 @@ var PluginManager = class {
781
672
  id
782
673
  }, {
783
674
  F: __dxlog_file2,
784
- L: 471,
675
+ L: 533,
785
676
  S: this,
786
677
  C: (f, a) => f(...a)
787
678
  });
679
+ this._moduleMemoMap.delete(id);
788
680
  const capabilities = this._capabilities.get(id);
789
681
  if (capabilities) {
790
682
  for (const capability of capabilities) {
@@ -805,7 +697,7 @@ var PluginManager = class {
805
697
  id
806
698
  }, {
807
699
  F: __dxlog_file2,
808
- L: 497,
700
+ L: 560,
809
701
  S: this,
810
702
  C: (f, a) => f(...a)
811
703
  });
@@ -819,7 +711,7 @@ var PluginManager = class {
819
711
  key
820
712
  }, {
821
713
  F: __dxlog_file2,
822
- L: 505,
714
+ L: 568,
823
715
  S: this,
824
716
  C: (f, a) => f(...a)
825
717
  });
@@ -834,11 +726,125 @@ var PluginManager = class {
834
726
  }
835
727
  });
836
728
  }
729
+ constructor({ pluginLoader, plugins = [], core = plugins.map(({ meta: meta2 }) => meta2.id), enabled = [], registry }) {
730
+ _define_property2(this, "activation", new Event());
731
+ _define_property2(this, "context", void 0);
732
+ _define_property2(this, "registry", void 0);
733
+ _define_property2(this, "_state", void 0);
734
+ _define_property2(this, "_pluginLoader", void 0);
735
+ _define_property2(this, "_capabilities", /* @__PURE__ */ new Map());
736
+ _define_property2(this, "_moduleMemoMap", /* @__PURE__ */ new Map());
737
+ _define_property2(this, "_activatingEvents", Effect2.runSync(Ref.make([])));
738
+ _define_property2(this, "_activatingModules", Effect2.runSync(Ref.make([])));
739
+ _define_property2(this, "_loadModule", (mod) => Effect2.tryPromise({
740
+ try: async () => {
741
+ const entry = this._moduleMemoMap.get(mod.id);
742
+ if (entry) {
743
+ return entry;
744
+ }
745
+ const promise = (async () => {
746
+ const start = performance.now();
747
+ let failed = false;
748
+ try {
749
+ log2("loading module", {
750
+ module: mod.id
751
+ }, {
752
+ F: __dxlog_file2,
753
+ L: 470,
754
+ S: this,
755
+ C: (f, a) => f(...a)
756
+ });
757
+ let activationResult = await mod.activate(this.context);
758
+ if (typeof activationResult === "function") {
759
+ activationResult = await activationResult();
760
+ }
761
+ return Array.isArray(activationResult) ? activationResult : [
762
+ activationResult
763
+ ];
764
+ } catch (error) {
765
+ failed = true;
766
+ throw error;
767
+ } finally {
768
+ performance.measure("activate-module", {
769
+ start,
770
+ end: performance.now(),
771
+ detail: {
772
+ module: mod.id
773
+ }
774
+ });
775
+ log2("loaded module", {
776
+ module: mod.id,
777
+ elapsed: performance.now() - start,
778
+ failed
779
+ }, {
780
+ F: __dxlog_file2,
781
+ L: 488,
782
+ S: this,
783
+ C: (f, a) => f(...a)
784
+ });
785
+ }
786
+ })();
787
+ this._moduleMemoMap.set(mod.id, promise);
788
+ return promise;
789
+ },
790
+ catch: (error) => error
791
+ }).pipe(Effect2.withSpan("PluginManager._loadModule"), together(Effect2.sleep(Duration.seconds(10)).pipe(Effect2.andThen(Effect2.sync(() => log2.warn(`module is taking a long time to activate`, {
792
+ module: mod.id
793
+ }, {
794
+ F: __dxlog_file2,
795
+ L: 499,
796
+ S: this,
797
+ C: (f, a) => f(...a)
798
+ })))))));
799
+ this.registry = registry ?? Registry.make();
800
+ this.context = new PluginContext({
801
+ registry: this.registry,
802
+ activate: (event) => this._activate(event),
803
+ reset: (id) => this._reset(id)
804
+ });
805
+ this._pluginLoader = pluginLoader;
806
+ this._state = live({
807
+ plugins,
808
+ core,
809
+ enabled,
810
+ modules: [],
811
+ active: [],
812
+ eventsFired: [],
813
+ pendingReset: []
814
+ });
815
+ plugins.forEach((plugin) => this._addPlugin(plugin));
816
+ core.forEach((id) => this.enable(id));
817
+ enabled.forEach((id) => this.enable(id));
818
+ }
837
819
  };
820
+ var together = (togetherEffect) => (effect) => Effect2.gen(function* () {
821
+ const togetherFiber = yield* Effect2.fork(togetherEffect);
822
+ const result = yield* effect;
823
+ yield* Fiber.interrupt(togetherFiber);
824
+ return result;
825
+ });
838
826
 
839
827
  // src/core/plugin.ts
828
+ function _define_property3(obj, key, value) {
829
+ if (key in obj) {
830
+ Object.defineProperty(obj, key, {
831
+ value,
832
+ enumerable: true,
833
+ configurable: true,
834
+ writable: true
835
+ });
836
+ } else {
837
+ obj[key] = value;
838
+ }
839
+ return obj;
840
+ }
840
841
  var PluginModule = class {
841
842
  constructor(options) {
843
+ _define_property3(this, "id", void 0);
844
+ _define_property3(this, "activatesOn", void 0);
845
+ _define_property3(this, "activatesBefore", void 0);
846
+ _define_property3(this, "activatesAfter", void 0);
847
+ _define_property3(this, "activate", void 0);
842
848
  this.id = options.id;
843
849
  this.activatesOn = options.activatesOn;
844
850
  this.activatesBefore = options.activatesBefore;
@@ -848,19 +854,26 @@ var PluginModule = class {
848
854
  };
849
855
  var defineModule = (options) => new PluginModule(options);
850
856
  var Plugin = class {
851
- constructor(meta, modules) {
852
- this.meta = meta;
857
+ constructor(meta2, modules) {
858
+ _define_property3(this, "meta", void 0);
859
+ _define_property3(this, "modules", void 0);
860
+ this.meta = meta2;
853
861
  this.modules = modules;
854
862
  }
855
863
  };
856
- var definePlugin = (meta, modules) => {
857
- return new Plugin(meta, modules);
864
+ var definePlugin = (meta2, provider) => {
865
+ const factory = (args) => {
866
+ return new Plugin(meta2, provider(args));
867
+ };
868
+ return Object.assign(factory, {
869
+ meta: meta2
870
+ });
858
871
  };
859
872
 
860
873
  // src/common/capabilities.ts
861
874
  (function(Capabilities2) {
862
- Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
863
875
  Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
876
+ Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
864
877
  Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
865
878
  Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
866
879
  Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
@@ -875,30 +888,31 @@ var definePlugin = (meta, modules) => {
875
888
  Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
876
889
  Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
877
890
  Capabilities2.Metadata = defineCapability("dxos.org/app-framework/capability/metadata");
878
- Capabilities2.Tools = defineCapability("dxos.org/app-framework/capability/tools");
879
- Capabilities2.ArtifactDefinition = defineCapability("dxos.org/app-framework/capability/artifact-definition");
891
+ Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
892
+ Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
893
+ Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
894
+ Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
895
+ Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
896
+ Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
880
897
  Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
881
898
  Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
882
899
  })(Capabilities || (Capabilities = {}));
883
900
  var Capabilities;
884
901
 
885
902
  // src/common/collaboration.ts
886
- import { Schema as Schema3 } from "effect";
887
- import { Expando, Ref } from "@dxos/echo-schema";
903
+ import { Schema } from "effect";
904
+ import { DataType } from "@dxos/schema";
888
905
  (function(CollaborationActions2) {
889
- class InsertContent extends Schema3.TaggedClass()("assistant/intent-content", {
890
- input: Schema3.Struct({
891
- target: Expando,
892
- object: Ref(Expando),
893
- at: Schema3.optional(Schema3.String),
894
- label: Schema3.String.pipe(Schema3.optional)
895
- }).annotations({
896
- description: "Enables plugins to inject content blocks or references into a related entity."
906
+ class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
907
+ input: Schema.Struct({
908
+ subject: Schema.Any,
909
+ anchor: Schema.String,
910
+ proposal: DataType.MessageBlock.Proposal
897
911
  }),
898
- output: Schema3.Void
912
+ output: Schema.Void
899
913
  }) {
900
914
  }
901
- CollaborationActions2.InsertContent = InsertContent;
915
+ CollaborationActions2.AcceptProposal = AcceptProposal;
902
916
  })(CollaborationActions || (CollaborationActions = {}));
903
917
  var CollaborationActions;
904
918
 
@@ -921,7 +935,7 @@ var CollaborationActions;
921
935
  var Events;
922
936
 
923
937
  // src/common/file.ts
924
- import { Schema as Schema4 } from "effect";
938
+ import { Schema as Schema2 } from "effect";
925
939
  var defaultFileTypes = {
926
940
  images: [
927
941
  "png",
@@ -941,23 +955,131 @@ var defaultFileTypes = {
941
955
  "md"
942
956
  ]
943
957
  };
944
- var FileInfoSchema = Schema4.Struct({
945
- name: Schema4.String,
946
- type: Schema4.String,
947
- url: Schema4.optional(Schema4.String),
948
- cid: Schema4.optional(Schema4.String)
958
+ var FileInfoSchema = Schema2.Struct({
959
+ name: Schema2.String,
960
+ type: Schema2.String,
961
+ url: Schema2.optional(Schema2.String),
962
+ cid: Schema2.optional(Schema2.String)
949
963
  });
950
964
 
951
965
  // src/common/layout.ts
952
966
  import { Schema as Schema5 } from "effect";
953
967
 
954
- // src/plugin-intent/IntentPlugin.ts
955
- var IntentPlugin = () => definePlugin({
956
- id: INTENT_PLUGIN,
968
+ // src/plugin-intent/actions.ts
969
+ import { Schema as Schema4 } from "effect";
970
+
971
+ // src/plugin-intent/intent.ts
972
+ import { Schema as Schema3 } from "effect";
973
+ var createIntent = (schema, data = {}, params = {}) => {
974
+ const _ = Schema3.validateSync(schema.fields.input)(data);
975
+ const intent = {
976
+ ...params,
977
+ _schema: schema,
978
+ id: schema._tag,
979
+ data
980
+ };
981
+ return {
982
+ first: intent,
983
+ last: intent,
984
+ all: [
985
+ intent
986
+ ]
987
+ };
988
+ };
989
+ var chain = (schema, data = {}, params = {}) => (intent) => {
990
+ const intents = "all" in intent ? intent.all : [
991
+ intent
992
+ ];
993
+ const first = intents[0];
994
+ const last = {
995
+ ...params,
996
+ _schema: schema,
997
+ id: schema._tag,
998
+ data
999
+ };
1000
+ return {
1001
+ first,
1002
+ last,
1003
+ all: [
1004
+ ...intents,
1005
+ last
1006
+ ]
1007
+ };
1008
+ };
1009
+ var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
1010
+ ns: Schema3.String,
1011
+ count: Schema3.optional(Schema3.Number),
1012
+ defaultValue: Schema3.optional(Schema3.String)
1013
+ })))));
1014
+
1015
+ // src/plugin-intent/meta.ts
1016
+ var meta = {
1017
+ id: "dxos.org/plugin/intent",
957
1018
  name: "Intent"
958
- }, [
1019
+ };
1020
+
1021
+ // src/plugin-intent/actions.ts
1022
+ (function(IntentAction2) {
1023
+ class Track extends Schema4.TaggedClass()(`${meta.id}/action/track`, {
1024
+ input: Schema4.Struct({
1025
+ intents: Schema4.Array(Schema4.String),
1026
+ error: Schema4.optional(Schema4.String)
1027
+ }),
1028
+ output: Schema4.Void
1029
+ }) {
1030
+ }
1031
+ IntentAction2.Track = Track;
1032
+ class ShowUndo extends Schema4.TaggedClass()(`${meta.id}/action/show-undo`, {
1033
+ input: Schema4.Struct({
1034
+ message: Label
1035
+ }),
1036
+ output: Schema4.Void
1037
+ }) {
1038
+ }
1039
+ IntentAction2.ShowUndo = ShowUndo;
1040
+ })(IntentAction || (IntentAction = {}));
1041
+ var IntentAction;
1042
+
1043
+ // src/plugin-intent/errors.ts
1044
+ function _define_property4(obj, key, value) {
1045
+ if (key in obj) {
1046
+ Object.defineProperty(obj, key, {
1047
+ value,
1048
+ enumerable: true,
1049
+ configurable: true,
1050
+ writable: true
1051
+ });
1052
+ } else {
1053
+ obj[key] = value;
1054
+ }
1055
+ return obj;
1056
+ }
1057
+ var BaseError = class extends Error {
1058
+ constructor(code, message, context) {
1059
+ super(message ?? code, {
1060
+ cause: context
1061
+ }), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
1062
+ this.name = code;
1063
+ Object.setPrototypeOf(this, new.target.prototype);
1064
+ }
1065
+ };
1066
+ var NoResolversError = class extends BaseError {
1067
+ constructor(action) {
1068
+ super("NO_RESOLVERS", "No resolvers were found for the action", {
1069
+ action
1070
+ });
1071
+ }
1072
+ };
1073
+ var CycleDetectedError = class extends BaseError {
1074
+ constructor(context) {
1075
+ super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
1076
+ }
1077
+ };
1078
+
1079
+ // src/plugin-intent/IntentPlugin.ts
1080
+ var IntentPlugin = definePlugin(meta, () => [
959
1081
  defineModule({
960
- id: `${INTENT_PLUGIN}/module/dispatcher`,
1082
+ id: `${meta.id}/module/dispatcher`,
961
1083
  // TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.
962
1084
  // This is fine for now because it's how it worked prior to capabilities api anyways.
963
1085
  // In the future, the intent dispatcher should be able to be reset without resetting the entire app.
@@ -965,15 +1087,14 @@ var IntentPlugin = () => definePlugin({
965
1087
  activatesAfter: [
966
1088
  Events.DispatcherReady
967
1089
  ],
968
- activate: lazy(() => import("./intent-dispatcher-TWKB22NI.mjs"))
1090
+ activate: lazy(() => import("./intent-dispatcher-VFMJVO2M.mjs"))
969
1091
  })
970
1092
  ]);
971
1093
 
972
1094
  // src/common/layout.ts
973
1095
  var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
974
- var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
975
1096
  (function(LayoutAction2) {
976
- LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_ACTION}/update-layout`;
1097
+ LayoutAction2.UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
977
1098
  class UpdateLayout extends Schema5.TaggedClass()(LayoutAction2.UPDATE_LAYOUT, {
978
1099
  input: Schema5.Struct({
979
1100
  part: Schema5.String.annotations({
@@ -1335,7 +1456,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1335
1456
  const handleIntent = (intent) => Effect3.gen(function* () {
1336
1457
  const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
1337
1458
  if (candidates.length === 0) {
1338
- yield* Effect3.fail(new NoResolversError(intent.id));
1459
+ return yield* Effect3.fail(new NoResolversError(intent.id));
1339
1460
  }
1340
1461
  const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
1341
1462
  const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
@@ -1347,7 +1468,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1347
1468
  const dispatch = (intentChain, depth = 0) => {
1348
1469
  return Effect3.gen(function* () {
1349
1470
  if (depth > executionLimit) {
1350
- yield* Effect3.fail(new CycleDetectedError());
1471
+ return yield* Effect3.fail(new CycleDetectedError());
1351
1472
  }
1352
1473
  const resultsRef = yield* Ref2.make([]);
1353
1474
  for (const intent of intentChain.all) {
@@ -1369,7 +1490,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1369
1490
  }
1370
1491
  }
1371
1492
  if (result2.error) {
1372
- yield* Effect3.fail(result2.error);
1493
+ return yield* Effect3.fail(result2.error);
1373
1494
  }
1374
1495
  }
1375
1496
  const results = yield* resultsRef.get;
@@ -1398,7 +1519,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1398
1519
  })).catch((error) => {
1399
1520
  log3.catch(error, void 0, {
1400
1521
  F: __dxlog_file3,
1401
- L: 270,
1522
+ L: 271,
1402
1523
  S: void 0,
1403
1524
  C: (f, a) => f(...a)
1404
1525
  });
@@ -1451,7 +1572,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1451
1572
  };
1452
1573
  var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
1453
1574
  var defaultPromise = () => Effect3.runPromise(defaultEffect());
1454
- var intent_dispatcher_default = (context) => {
1575
+ var intent_dispatcher_default = ((context) => {
1455
1576
  const state = live2({
1456
1577
  dispatch: defaultEffect,
1457
1578
  dispatchPromise: defaultPromise,
@@ -1473,7 +1594,7 @@ var intent_dispatcher_default = (context) => {
1473
1594
  state.undo = undo;
1474
1595
  state.undoPromise = undoPromise;
1475
1596
  return contributes(Capabilities.IntentDispatcher, state);
1476
- };
1597
+ });
1477
1598
 
1478
1599
  export {
1479
1600
  defineCapability,
@@ -1500,19 +1621,18 @@ export {
1500
1621
  createIntent,
1501
1622
  chain,
1502
1623
  Label,
1503
- INTENT_PLUGIN,
1504
- INTENT_ACTION,
1505
1624
  IntentAction,
1625
+ BaseError,
1626
+ NoResolversError,
1627
+ CycleDetectedError,
1506
1628
  createResolver,
1507
1629
  createDispatcher,
1508
1630
  intent_dispatcher_default,
1509
1631
  IntentPlugin,
1510
- LAYOUT_PLUGIN,
1511
- LAYOUT_ACTION,
1512
1632
  LayoutAction,
1513
1633
  createSurface,
1514
1634
  ResourceKey,
1515
1635
  ResourceLanguage,
1516
1636
  Resource
1517
1637
  };
1518
- //# sourceMappingURL=chunk-2636QSIK.mjs.map
1638
+ //# sourceMappingURL=chunk-6V54SRFL.mjs.map