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

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