@dxos/app-framework 0.8.3 → 0.8.4-main.1da679c

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 (352) hide show
  1. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  2. package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
  3. package/README.md +0 -8
  4. package/dist/lib/browser/{app-graph-builder-BI4VVKSW.mjs → app-graph-builder-NJPA2G5W.mjs} +7 -7
  5. package/dist/lib/browser/app-graph-builder-NJPA2G5W.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-DIBVO47Z.mjs → chunk-5PEC66SO.mjs} +194 -129
  7. package/dist/lib/browser/chunk-5PEC66SO.mjs.map +7 -0
  8. package/dist/lib/browser/{chunk-WWEJRWFX.mjs → chunk-ORWHM7CO.mjs} +2 -2
  9. package/dist/lib/browser/{chunk-EHM4UI3V.mjs → chunk-RAYLWQ5Q.mjs} +400 -273
  10. package/dist/lib/browser/chunk-RAYLWQ5Q.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +16 -10
  12. package/dist/lib/browser/index.mjs.map +3 -3
  13. package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs → intent-dispatcher-MDRGYJIB.mjs} +2 -2
  14. package/dist/lib/browser/{intent-resolver-3QMBXLIY.mjs → intent-resolver-M6FKP6GN.mjs} +6 -6
  15. package/dist/lib/browser/intent-resolver-M6FKP6GN.mjs.map +7 -0
  16. package/dist/lib/browser/meta.json +1 -1
  17. package/dist/lib/browser/{store-5H7XPJGA.mjs → store-3APFOQKK.mjs} +5 -5
  18. package/dist/lib/browser/{store-5H7XPJGA.mjs.map → store-3APFOQKK.mjs.map} +2 -2
  19. package/dist/lib/browser/testing/index.mjs +6 -8
  20. package/dist/lib/browser/testing/index.mjs.map +3 -3
  21. package/dist/lib/browser/worker.mjs +7 -1
  22. package/dist/lib/node-esm/{app-graph-builder-NROP6RPQ.mjs → app-graph-builder-QSVQIJL5.mjs} +7 -7
  23. package/dist/lib/node-esm/app-graph-builder-QSVQIJL5.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-2J6FVECI.mjs → chunk-NL3BJGAH.mjs} +400 -273
  25. package/dist/lib/node-esm/chunk-NL3BJGAH.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-FHNZZWP4.mjs → chunk-TIGGOZBR.mjs} +194 -129
  27. package/dist/lib/node-esm/chunk-TIGGOZBR.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs → chunk-UMZQERLE.mjs} +2 -2
  29. package/dist/lib/node-esm/index.mjs +16 -10
  30. package/dist/lib/node-esm/index.mjs.map +3 -3
  31. package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs → intent-dispatcher-YFOVJIJP.mjs} +2 -2
  32. package/dist/lib/node-esm/{intent-resolver-VY4X5UHN.mjs → intent-resolver-KERU62QF.mjs} +6 -6
  33. package/dist/lib/node-esm/intent-resolver-KERU62QF.mjs.map +7 -0
  34. package/dist/lib/node-esm/meta.json +1 -1
  35. package/dist/lib/node-esm/{store-UKD2R2KA.mjs → store-EZER6ON2.mjs} +5 -5
  36. package/dist/lib/node-esm/{store-UKD2R2KA.mjs.map → store-EZER6ON2.mjs.map} +2 -2
  37. package/dist/lib/node-esm/testing/index.mjs +6 -8
  38. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  39. package/dist/lib/node-esm/worker.mjs +7 -1
  40. package/dist/types/src/common/capabilities.d.ts +85 -9
  41. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  42. package/dist/types/src/common/collaboration.d.ts +9 -8
  43. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  44. package/dist/types/src/common/events.d.ts.map +1 -1
  45. package/dist/types/src/common/surface.d.ts +1 -1
  46. package/dist/types/src/common/surface.d.ts.map +1 -1
  47. package/dist/types/src/components/App.d.ts +10 -0
  48. package/dist/types/src/components/App.d.ts.map +1 -0
  49. package/dist/types/src/components/App.stories.d.ts +15 -0
  50. package/dist/types/src/components/App.stories.d.ts.map +1 -0
  51. package/dist/types/src/components/DefaultFallback.d.ts +8 -0
  52. package/dist/types/src/components/DefaultFallback.d.ts.map +1 -0
  53. package/dist/types/src/components/index.d.ts +2 -0
  54. package/dist/types/src/components/index.d.ts.map +1 -0
  55. package/dist/types/src/{App.d.ts → components/useApp.d.ts} +7 -6
  56. package/dist/types/src/components/useApp.d.ts.map +1 -0
  57. package/dist/types/src/components/useLoading.d.ts +19 -0
  58. package/dist/types/src/components/useLoading.d.ts.map +1 -0
  59. package/dist/types/src/core/capabilities.d.ts +4 -1
  60. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  61. package/dist/types/src/core/manager.d.ts +6 -2
  62. package/dist/types/src/core/manager.d.ts.map +1 -1
  63. package/dist/types/src/index.d.ts +1 -1
  64. package/dist/types/src/index.d.ts.map +1 -1
  65. package/dist/types/src/playground/debug/Debug.d.ts +1 -1
  66. package/dist/types/src/playground/generator/Main.d.ts +1 -1
  67. package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
  68. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  69. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  70. package/dist/types/src/playground/layout/Layout.d.ts +2 -2
  71. package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
  72. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  73. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  74. package/dist/types/src/playground/playground.stories.d.ts +5 -3
  75. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  76. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  77. package/dist/types/src/plugin-intent/index.d.ts +1 -0
  78. package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
  79. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +3 -3
  80. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  81. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  82. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
  83. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  84. package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
  85. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
  86. package/dist/types/src/plugin-settings/store.d.ts +1 -1
  87. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  88. package/dist/types/src/plugin-settings/translations.d.ts +7 -8
  89. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
  90. package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
  91. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  92. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  93. package/dist/types/src/react/Surface.d.ts.map +1 -1
  94. package/dist/types/src/react/Surface.stories.d.ts +6 -4
  95. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  96. package/dist/types/src/react/common.d.ts.map +1 -1
  97. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  98. package/dist/types/src/testing/withPluginManager.d.ts +4 -2
  99. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  100. package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
  101. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  102. package/dist/types/tsconfig.tsbuildinfo +1 -1
  103. package/moon.yml +14 -0
  104. package/package.json +32 -28
  105. package/src/common/capabilities.ts +111 -11
  106. package/src/common/collaboration.ts +5 -8
  107. package/src/common/events.ts +3 -1
  108. package/src/common/surface.ts +1 -1
  109. package/src/components/App.stories.tsx +35 -0
  110. package/src/components/App.tsx +59 -0
  111. package/src/components/DefaultFallback.tsx +26 -0
  112. package/src/components/index.ts +5 -0
  113. package/src/{App.tsx → components/useApp.tsx} +20 -130
  114. package/src/components/useLoading.tsx +70 -0
  115. package/src/core/capabilities.test.ts +1 -1
  116. package/src/core/capabilities.ts +11 -6
  117. package/src/core/manager.test.ts +5 -5
  118. package/src/core/manager.ts +132 -54
  119. package/src/helpers.test.ts +1 -1
  120. package/src/index.ts +1 -1
  121. package/src/playground/debug/Debug.tsx +1 -1
  122. package/src/playground/generator/Toolbar.tsx +2 -1
  123. package/src/playground/generator/generator.ts +2 -2
  124. package/src/playground/layout/plugin.ts +1 -1
  125. package/src/playground/logger/Toolbar.tsx +2 -1
  126. package/src/playground/logger/plugin.ts +3 -2
  127. package/src/playground/playground.stories.tsx +15 -10
  128. package/src/plugin-intent/IntentPlugin.ts +2 -1
  129. package/src/plugin-intent/index.ts +1 -0
  130. package/src/plugin-intent/intent-dispatcher.test.ts +1 -1
  131. package/src/plugin-intent/intent-dispatcher.ts +10 -8
  132. package/src/plugin-settings/SettingsPlugin.ts +3 -2
  133. package/src/plugin-settings/app-graph-builder.ts +4 -3
  134. package/src/plugin-settings/intent-resolver.ts +3 -2
  135. package/src/plugin-settings/store.ts +1 -1
  136. package/src/plugin-settings/translations.ts +4 -2
  137. package/src/react/ErrorBoundary.tsx +24 -15
  138. package/src/react/IntentContext.tsx +3 -2
  139. package/src/react/Surface.stories.tsx +21 -13
  140. package/src/react/Surface.tsx +4 -3
  141. package/src/react/common.ts +2 -1
  142. package/src/react/useCapabilities.ts +2 -1
  143. package/src/testing/withPluginManager.stories.tsx +9 -5
  144. package/src/testing/withPluginManager.tsx +13 -13
  145. package/tsconfig.json +5 -9
  146. package/vitest.config.ts +5 -2
  147. package/.eslintrc.cjs +0 -9
  148. package/README.yml +0 -5
  149. package/dist/lib/browser/app-graph-builder-BI4VVKSW.mjs.map +0 -7
  150. package/dist/lib/browser/chunk-DIBVO47Z.mjs.map +0 -7
  151. package/dist/lib/browser/chunk-EHM4UI3V.mjs.map +0 -7
  152. package/dist/lib/browser/intent-resolver-3QMBXLIY.mjs.map +0 -7
  153. package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs +0 -146
  154. package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs.map +0 -7
  155. package/dist/lib/node/chunk-G774ASXO.cjs +0 -58
  156. package/dist/lib/node/chunk-G774ASXO.cjs.map +0 -7
  157. package/dist/lib/node/chunk-VSOSVDQ3.cjs +0 -1551
  158. package/dist/lib/node/chunk-VSOSVDQ3.cjs.map +0 -7
  159. package/dist/lib/node/chunk-YGAY3H34.cjs +0 -429
  160. package/dist/lib/node/chunk-YGAY3H34.cjs.map +0 -7
  161. package/dist/lib/node/index.cjs +0 -193
  162. package/dist/lib/node/index.cjs.map +0 -7
  163. package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs +0 -32
  164. package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs.map +0 -7
  165. package/dist/lib/node/intent-resolver-IOJDYO34.cjs +0 -46
  166. package/dist/lib/node/intent-resolver-IOJDYO34.cjs.map +0 -7
  167. package/dist/lib/node/meta.json +0 -1
  168. package/dist/lib/node/store-ESF5VR57.cjs +0 -45
  169. package/dist/lib/node/store-ESF5VR57.cjs.map +0 -7
  170. package/dist/lib/node/testing/index.cjs +0 -119
  171. package/dist/lib/node/testing/index.cjs.map +0 -7
  172. package/dist/lib/node/worker.cjs +0 -101
  173. package/dist/lib/node/worker.cjs.map +0 -7
  174. package/dist/lib/node-esm/app-graph-builder-NROP6RPQ.mjs.map +0 -7
  175. package/dist/lib/node-esm/chunk-2J6FVECI.mjs.map +0 -7
  176. package/dist/lib/node-esm/chunk-FHNZZWP4.mjs.map +0 -7
  177. package/dist/lib/node-esm/intent-resolver-VY4X5UHN.mjs.map +0 -7
  178. package/dist/types/src/App.d.ts.map +0 -1
  179. package/project.json +0 -29
  180. package/typedoc/.nojekyll +0 -1
  181. package/typedoc/assets/hierarchy.js +0 -1
  182. package/typedoc/assets/highlight.css +0 -106
  183. package/typedoc/assets/icons.js +0 -18
  184. package/typedoc/assets/icons.svg +0 -1
  185. package/typedoc/assets/main.js +0 -60
  186. package/typedoc/assets/navigation.js +0 -1
  187. package/typedoc/assets/search.js +0 -1
  188. package/typedoc/assets/style.css +0 -1640
  189. package/typedoc/classes/CollaborationActions.InsertContent.html +0 -421
  190. package/typedoc/classes/ErrorBoundary.html +0 -125
  191. package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
  192. package/typedoc/classes/IntentAction.Track.html +0 -266
  193. package/typedoc/classes/LayoutAction.AddToast.html +0 -265
  194. package/typedoc/classes/LayoutAction.Close.html +0 -382
  195. package/typedoc/classes/LayoutAction.Expose.html +0 -265
  196. package/typedoc/classes/LayoutAction.Open.html +0 -1123
  197. package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
  198. package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
  199. package/typedoc/classes/LayoutAction.Set.html +0 -460
  200. package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
  201. package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
  202. package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
  203. package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -1123
  204. package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
  205. package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
  206. package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
  207. package/typedoc/classes/Plugin.html +0 -6
  208. package/typedoc/classes/PluginContext.html +0 -38
  209. package/typedoc/classes/PluginManager.html +0 -43
  210. package/typedoc/classes/PluginModule.html +0 -18
  211. package/typedoc/classes/SettingsAction.Open.html +0 -226
  212. package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
  213. package/typedoc/functions/Events.createStateEvent.html +0 -2
  214. package/typedoc/functions/IntentPlugin.html +0 -1
  215. package/typedoc/functions/SettingsPlugin.html +0 -1
  216. package/typedoc/functions/allOf.html +0 -2
  217. package/typedoc/functions/chain.html +0 -3
  218. package/typedoc/functions/contributes.html +0 -2
  219. package/typedoc/functions/createDispatcher.html +0 -3
  220. package/typedoc/functions/createIntent.html +0 -6
  221. package/typedoc/functions/createResolver.html +0 -2
  222. package/typedoc/functions/createSurface.html +0 -2
  223. package/typedoc/functions/defineCapability.html +0 -2
  224. package/typedoc/functions/defineEvent.html +0 -2
  225. package/typedoc/functions/defineModule.html +0 -2
  226. package/typedoc/functions/definePlugin.html +0 -2
  227. package/typedoc/functions/eventKey.html +0 -2
  228. package/typedoc/functions/getEvents.html +0 -2
  229. package/typedoc/functions/isAllOf.html +0 -2
  230. package/typedoc/functions/isOneOf.html +0 -2
  231. package/typedoc/functions/isSurfaceAvailable.html +0 -2
  232. package/typedoc/functions/lazy.html +0 -2
  233. package/typedoc/functions/oneOf.html +0 -2
  234. package/typedoc/functions/useApp.html +0 -6
  235. package/typedoc/functions/useAppGraph.html +0 -1
  236. package/typedoc/functions/useCapabilities.html +0 -3
  237. package/typedoc/functions/useCapability.html +0 -4
  238. package/typedoc/functions/useIntentDispatcher.html +0 -1
  239. package/typedoc/functions/useIntentResolver.html +0 -1
  240. package/typedoc/functions/useLayout.html +0 -1
  241. package/typedoc/functions/usePluginManager.html +0 -2
  242. package/typedoc/hierarchy.html +0 -1
  243. package/typedoc/index.html +0 -16
  244. package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
  245. package/typedoc/media/LICENSE +0 -8
  246. package/typedoc/modules/Capabilities.html +0 -1
  247. package/typedoc/modules/CollaborationActions.html +0 -1
  248. package/typedoc/modules/Events.html +0 -1
  249. package/typedoc/modules/IntentAction.html +0 -1
  250. package/typedoc/modules/LayoutAction.html +0 -2
  251. package/typedoc/modules/SettingsAction.html +0 -1
  252. package/typedoc/modules.html +0 -1
  253. package/typedoc/types/ActivationEvent.html +0 -8
  254. package/typedoc/types/ActivationEvents.html +0 -2
  255. package/typedoc/types/AnyCapability.html +0 -1
  256. package/typedoc/types/AnyIntent.html +0 -1
  257. package/typedoc/types/AnyIntentChain.html +0 -1
  258. package/typedoc/types/AnyIntentEffectResult.html +0 -1
  259. package/typedoc/types/AnyIntentResolver.html +0 -1
  260. package/typedoc/types/AnyIntentResult.html +0 -1
  261. package/typedoc/types/Capabilities.FileUploader.html +0 -1
  262. package/typedoc/types/Capabilities.IntentResolver.html +0 -1
  263. package/typedoc/types/Capabilities.Layout.html +0 -1
  264. package/typedoc/types/Capabilities.Metadata.html +0 -1
  265. package/typedoc/types/Capabilities.ReactContext.html +0 -1
  266. package/typedoc/types/Capabilities.ReactRoot.html +0 -1
  267. package/typedoc/types/Capabilities.ReactSurface.html +0 -1
  268. package/typedoc/types/Capabilities.Settings.html +0 -4
  269. package/typedoc/types/Capability.html +0 -9
  270. package/typedoc/types/CreateAppOptions.html +0 -10
  271. package/typedoc/types/FileInfo.html +0 -1
  272. package/typedoc/types/Intent.html +0 -10
  273. package/typedoc/types/IntentChain.html +0 -6
  274. package/typedoc/types/IntentContext.html +0 -5
  275. package/typedoc/types/IntentData.html +0 -1
  276. package/typedoc/types/IntentDispatcher.html +0 -2
  277. package/typedoc/types/IntentDispatcherResult.html +0 -2
  278. package/typedoc/types/IntentEffectDefinition.html +0 -2
  279. package/typedoc/types/IntentEffectResult.html +0 -15
  280. package/typedoc/types/IntentParams.html +0 -3
  281. package/typedoc/types/IntentResolver.html +0 -2
  282. package/typedoc/types/IntentResultData.html +0 -1
  283. package/typedoc/types/IntentSchema.html +0 -1
  284. package/typedoc/types/IntentUndo.html +0 -2
  285. package/typedoc/types/InterfaceDef.html +0 -4
  286. package/typedoc/types/Label.html +0 -1
  287. package/typedoc/types/NodeSerializer.html +0 -8
  288. package/typedoc/types/PluginManagerOptions.html +0 -6
  289. package/typedoc/types/PluginMeta.html +0 -21
  290. package/typedoc/types/PromiseIntentDispatcher.html +0 -2
  291. package/typedoc/types/PromiseIntentUndo.html +0 -2
  292. package/typedoc/types/Resource.html +0 -1
  293. package/typedoc/types/ResourceKey.html +0 -1
  294. package/typedoc/types/ResourceLanguage.html +0 -1
  295. package/typedoc/types/SerializedNode.html +0 -4
  296. package/typedoc/types/SurfaceComponent.html +0 -2
  297. package/typedoc/types/SurfaceDefinition.html +0 -2
  298. package/typedoc/types/SurfaceProps.html +0 -4
  299. package/typedoc/variables/Capabilities.AnchorSort.html +0 -1
  300. package/typedoc/variables/Capabilities.AppGraph.html +0 -1
  301. package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
  302. package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
  303. package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
  304. package/typedoc/variables/Capabilities.FileUploader.html +0 -1
  305. package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
  306. package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
  307. package/typedoc/variables/Capabilities.Layout.html +0 -1
  308. package/typedoc/variables/Capabilities.Metadata.html +0 -1
  309. package/typedoc/variables/Capabilities.Null.html +0 -1
  310. package/typedoc/variables/Capabilities.PluginManager.html +0 -1
  311. package/typedoc/variables/Capabilities.ReactContext.html +0 -1
  312. package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
  313. package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
  314. package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
  315. package/typedoc/variables/Capabilities.Settings.html +0 -1
  316. package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
  317. package/typedoc/variables/Capabilities.Tools.html +0 -1
  318. package/typedoc/variables/Capabilities.Translations.html +0 -1
  319. package/typedoc/variables/Events.AppGraphReady.html +0 -2
  320. package/typedoc/variables/Events.DispatcherReady.html +0 -2
  321. package/typedoc/variables/Events.LayoutReady.html +0 -1
  322. package/typedoc/variables/Events.SettingsReady.html +0 -2
  323. package/typedoc/variables/Events.SetupAppGraph.html +0 -2
  324. package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
  325. package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
  326. package/typedoc/variables/Events.SetupMetadata.html +0 -2
  327. package/typedoc/variables/Events.SetupReactSurface.html +0 -2
  328. package/typedoc/variables/Events.SetupSettings.html +0 -2
  329. package/typedoc/variables/Events.SetupTranslations.html +0 -2
  330. package/typedoc/variables/Events.Startup.html +0 -2
  331. package/typedoc/variables/FileInfoSchema.html +0 -1
  332. package/typedoc/variables/INTENT_ACTION.html +0 -1
  333. package/typedoc/variables/INTENT_PLUGIN.html +0 -1
  334. package/typedoc/variables/LAYOUT_ACTION.html +0 -1
  335. package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
  336. package/typedoc/variables/Label.html +0 -1
  337. package/typedoc/variables/LayoutAction.Toast.html +0 -1
  338. package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
  339. package/typedoc/variables/PluginManagerProvider.html +0 -2
  340. package/typedoc/variables/Resource.html +0 -2
  341. package/typedoc/variables/ResourceKey.html +0 -1
  342. package/typedoc/variables/ResourceLanguage.html +0 -1
  343. package/typedoc/variables/SETTINGS_ACTION.html +0 -1
  344. package/typedoc/variables/SETTINGS_ID.html +0 -1
  345. package/typedoc/variables/SETTINGS_KEY.html +0 -1
  346. package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
  347. package/typedoc/variables/Surface.html +0 -2
  348. package/typedoc/variables/defaultFileTypes.html +0 -1
  349. /package/dist/lib/browser/{chunk-WWEJRWFX.mjs.map → chunk-ORWHM7CO.mjs.map} +0 -0
  350. /package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs.map → intent-dispatcher-MDRGYJIB.mjs.map} +0 -0
  351. /package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs.map → chunk-UMZQERLE.mjs.map} +0 -0
  352. /package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs.map → intent-dispatcher-YFOVJIJP.mjs.map} +0 -0
@@ -1,110 +1,29 @@
1
- // packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts
2
- import { Effect as Effect3, Option, pipe as pipe2, Ref as Ref2 } from "effect";
1
+ // src/plugin-intent/intent-dispatcher.ts
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
- // packages/sdk/app-framework/src/plugin-intent/actions.ts
8
- import { Schema as Schema2 } from "effect";
9
-
10
- // packages/sdk/app-framework/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
- // packages/sdk/app-framework/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
- // packages/sdk/app-framework/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
- // packages/sdk/app-framework/src/core/capabilities.ts
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";
107
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/core/capabilities.ts";
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
+ }
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) => {
110
29
  return {
@@ -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,9 +164,41 @@ 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
- // packages/sdk/app-framework/src/core/events.ts
201
+ // src/core/events.ts
278
202
  var defineEvent = (id, specifier) => {
279
203
  return {
280
204
  id,
@@ -296,41 +220,31 @@ var getEvents = (events) => "type" in events ? events.events : [
296
220
  events
297
221
  ];
298
222
 
299
- // packages/sdk/app-framework/src/core/manager.ts
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";
306
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/core/manager.ts";
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
+ }
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 }) => meta.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
- // packages/sdk/app-framework/src/core/plugin.ts
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;
@@ -849,6 +855,8 @@ var PluginModule = class {
849
855
  var defineModule = (options) => new PluginModule(options);
850
856
  var Plugin = class {
851
857
  constructor(meta, modules) {
858
+ _define_property3(this, "meta", void 0);
859
+ _define_property3(this, "modules", void 0);
852
860
  this.meta = meta;
853
861
  this.modules = modules;
854
862
  }
@@ -857,10 +865,10 @@ var definePlugin = (meta, modules) => {
857
865
  return new Plugin(meta, modules);
858
866
  };
859
867
 
860
- // packages/sdk/app-framework/src/common/capabilities.ts
868
+ // src/common/capabilities.ts
861
869
  (function(Capabilities2) {
862
- Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
863
870
  Capabilities2.Null = defineCapability("dxos.org/app-framework/capability/null");
871
+ Capabilities2.PluginManager = defineCapability("dxos.org/app-framework/capability/plugin-manager");
864
872
  Capabilities2.RxRegistry = defineCapability("dxos.org/app-framework/capability/rx-registry");
865
873
  Capabilities2.ReactContext = defineCapability("dxos.org/app-framework/capability/react-context");
866
874
  Capabilities2.ReactRoot = defineCapability("dxos.org/app-framework/capability/react-root");
@@ -875,34 +883,35 @@ var definePlugin = (meta, modules) => {
875
883
  Capabilities2.SettingsStore = defineCapability("dxos.org/app-framework/capability/settings-store");
876
884
  Capabilities2.Settings = defineCapability("dxos.org/app-framework/capability/settings");
877
885
  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");
886
+ Capabilities2.Toolkit = defineCapability("dxos.org/app-framework/capability/ai-toolkit");
887
+ Capabilities2.ToolkitHandler = defineCapability("dxos.org/app-framework/capability/ai-toolkit-handler");
888
+ Capabilities2.BlueprintDefinition = defineCapability("dxos.org/app-framework/capability/blueprint-definition");
889
+ Capabilities2.AiServiceLayer = defineCapability("dxos.org/app-framework/capability/ai-service-factory");
890
+ Capabilities2.AiModelResolver = defineCapability("dxos.org/app-framework/capability/ai-model-resolver");
891
+ Capabilities2.Functions = defineCapability("dxos.org/app-framework/capability/functions");
880
892
  Capabilities2.FileUploader = defineCapability("dxos.org/app-framework/capability/file-uploader");
881
893
  Capabilities2.AnchorSort = defineCapability("dxos.org/app-framework/capability/anchor-sort");
882
894
  })(Capabilities || (Capabilities = {}));
883
895
  var Capabilities;
884
896
 
885
- // packages/sdk/app-framework/src/common/collaboration.ts
886
- import { Schema as Schema3 } from "effect";
887
- import { Expando, Ref } from "@dxos/echo-schema";
897
+ // src/common/collaboration.ts
898
+ import { Schema } from "effect";
899
+ import { DataType } from "@dxos/schema";
888
900
  (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."
901
+ class AcceptProposal extends Schema.TaggedClass()("collaboration/accept-proposal", {
902
+ input: Schema.Struct({
903
+ subject: Schema.Any,
904
+ anchor: Schema.String,
905
+ proposal: DataType.MessageBlock.Proposal
897
906
  }),
898
- output: Schema3.Void
907
+ output: Schema.Void
899
908
  }) {
900
909
  }
901
- CollaborationActions2.InsertContent = InsertContent;
910
+ CollaborationActions2.AcceptProposal = AcceptProposal;
902
911
  })(CollaborationActions || (CollaborationActions = {}));
903
912
  var CollaborationActions;
904
913
 
905
- // packages/sdk/app-framework/src/common/events.ts
914
+ // src/common/events.ts
906
915
  (function(Events2) {
907
916
  Events2.Startup = defineEvent("dxos.org/app-framework/event/startup");
908
917
  Events2.SetupReactSurface = defineEvent("dxos.org/app-framework/event/setup-react-surface");
@@ -920,8 +929,8 @@ var CollaborationActions;
920
929
  })(Events || (Events = {}));
921
930
  var Events;
922
931
 
923
- // packages/sdk/app-framework/src/common/file.ts
924
- import { Schema as Schema4 } from "effect";
932
+ // src/common/file.ts
933
+ import { Schema as Schema2 } from "effect";
925
934
  var defaultFileTypes = {
926
935
  images: [
927
936
  "png",
@@ -941,17 +950,124 @@ var defaultFileTypes = {
941
950
  "md"
942
951
  ]
943
952
  };
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)
953
+ var FileInfoSchema = Schema2.Struct({
954
+ name: Schema2.String,
955
+ type: Schema2.String,
956
+ url: Schema2.optional(Schema2.String),
957
+ cid: Schema2.optional(Schema2.String)
949
958
  });
950
959
 
951
- // packages/sdk/app-framework/src/common/layout.ts
960
+ // src/common/layout.ts
952
961
  import { Schema as Schema5 } from "effect";
953
962
 
954
- // packages/sdk/app-framework/src/plugin-intent/IntentPlugin.ts
963
+ // src/plugin-intent/actions.ts
964
+ import { Schema as Schema4 } from "effect";
965
+
966
+ // src/plugin-intent/intent.ts
967
+ import { Schema as Schema3 } from "effect";
968
+ var createIntent = (schema, data = {}, params = {}) => {
969
+ const _ = Schema3.validateSync(schema.fields.input)(data);
970
+ const intent = {
971
+ ...params,
972
+ _schema: schema,
973
+ id: schema._tag,
974
+ data
975
+ };
976
+ return {
977
+ first: intent,
978
+ last: intent,
979
+ all: [
980
+ intent
981
+ ]
982
+ };
983
+ };
984
+ var chain = (schema, data = {}, params = {}) => (intent) => {
985
+ const intents = "all" in intent ? intent.all : [
986
+ intent
987
+ ];
988
+ const first = intents[0];
989
+ const last = {
990
+ ...params,
991
+ _schema: schema,
992
+ id: schema._tag,
993
+ data
994
+ };
995
+ return {
996
+ first,
997
+ last,
998
+ all: [
999
+ ...intents,
1000
+ last
1001
+ ]
1002
+ };
1003
+ };
1004
+ var Label = Schema3.Union(Schema3.String, Schema3.mutable(Schema3.Tuple(Schema3.String, Schema3.mutable(Schema3.Struct({
1005
+ ns: Schema3.String,
1006
+ count: Schema3.optional(Schema3.Number),
1007
+ defaultValue: Schema3.optional(Schema3.String)
1008
+ })))));
1009
+
1010
+ // src/plugin-intent/actions.ts
1011
+ var INTENT_PLUGIN = "dxos.org/plugin/intent";
1012
+ var INTENT_ACTION = `${INTENT_PLUGIN}/action`;
1013
+ (function(IntentAction2) {
1014
+ class Track extends Schema4.TaggedClass()(`${INTENT_ACTION}/track`, {
1015
+ input: Schema4.Struct({
1016
+ intents: Schema4.Array(Schema4.String),
1017
+ error: Schema4.optional(Schema4.String)
1018
+ }),
1019
+ output: Schema4.Void
1020
+ }) {
1021
+ }
1022
+ IntentAction2.Track = Track;
1023
+ class ShowUndo extends Schema4.TaggedClass()(`${INTENT_ACTION}/show-undo`, {
1024
+ input: Schema4.Struct({
1025
+ message: Label
1026
+ }),
1027
+ output: Schema4.Void
1028
+ }) {
1029
+ }
1030
+ IntentAction2.ShowUndo = ShowUndo;
1031
+ })(IntentAction || (IntentAction = {}));
1032
+ var IntentAction;
1033
+
1034
+ // src/plugin-intent/errors.ts
1035
+ function _define_property4(obj, key, value) {
1036
+ if (key in obj) {
1037
+ Object.defineProperty(obj, key, {
1038
+ value,
1039
+ enumerable: true,
1040
+ configurable: true,
1041
+ writable: true
1042
+ });
1043
+ } else {
1044
+ obj[key] = value;
1045
+ }
1046
+ return obj;
1047
+ }
1048
+ var BaseError = class extends Error {
1049
+ constructor(code, message, context) {
1050
+ super(message ?? code, {
1051
+ cause: context
1052
+ }), _define_property4(this, "code", void 0), _define_property4(this, "context", void 0), this.code = code, this.context = context;
1053
+ this.name = code;
1054
+ Object.setPrototypeOf(this, new.target.prototype);
1055
+ }
1056
+ };
1057
+ var NoResolversError = class extends BaseError {
1058
+ constructor(action) {
1059
+ super("NO_RESOLVERS", "No resolvers were found for the action", {
1060
+ action
1061
+ });
1062
+ }
1063
+ };
1064
+ var CycleDetectedError = class extends BaseError {
1065
+ constructor(context) {
1066
+ super("CYCLE_DETECTED", "Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.", context);
1067
+ }
1068
+ };
1069
+
1070
+ // src/plugin-intent/IntentPlugin.ts
955
1071
  var IntentPlugin = () => definePlugin({
956
1072
  id: INTENT_PLUGIN,
957
1073
  name: "Intent"
@@ -965,11 +1081,11 @@ var IntentPlugin = () => definePlugin({
965
1081
  activatesAfter: [
966
1082
  Events.DispatcherReady
967
1083
  ],
968
- activate: lazy(() => import("./intent-dispatcher-XVBOMF2Y.mjs"))
1084
+ activate: lazy(() => import("./intent-dispatcher-MDRGYJIB.mjs"))
969
1085
  })
970
1086
  ]);
971
1087
 
972
- // packages/sdk/app-framework/src/common/layout.ts
1088
+ // src/common/layout.ts
973
1089
  var LAYOUT_PLUGIN = "dxos.org/plugin/layout";
974
1090
  var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
975
1091
  (function(LayoutAction2) {
@@ -1306,10 +1422,10 @@ var LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
1306
1422
  })(LayoutAction || (LayoutAction = {}));
1307
1423
  var LayoutAction;
1308
1424
 
1309
- // packages/sdk/app-framework/src/common/surface.ts
1425
+ // src/common/surface.ts
1310
1426
  var createSurface = (definition) => definition;
1311
1427
 
1312
- // packages/sdk/app-framework/src/common/translations.ts
1428
+ // src/common/translations.ts
1313
1429
  import { Schema as Schema6 } from "effect";
1314
1430
  var ResourceKey = Schema6.Union(Schema6.String, Schema6.Record({
1315
1431
  key: Schema6.String,
@@ -1324,8 +1440,8 @@ var Resource = Schema6.Record({
1324
1440
  value: ResourceLanguage
1325
1441
  });
1326
1442
 
1327
- // packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts
1328
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts";
1443
+ // src/plugin-intent/intent-dispatcher.ts
1444
+ var __dxlog_file3 = "/__w/dxos/dxos/packages/sdk/app-framework/src/plugin-intent/intent-dispatcher.ts";
1329
1445
  var EXECUTION_LIMIT = 100;
1330
1446
  var HISTORY_LIMIT = 100;
1331
1447
  var createResolver = (resolver) => resolver;
@@ -1335,7 +1451,15 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1335
1451
  const handleIntent = (intent) => Effect3.gen(function* () {
1336
1452
  const candidates = getResolvers().filter((resolver) => resolver.intent._tag === intent.id).filter((resolver) => !resolver.filter || resolver.filter(intent.data)).toSorted(byPosition);
1337
1453
  if (candidates.length === 0) {
1338
- yield* Effect3.fail(new NoResolversError(intent.id));
1454
+ log3.info("no resolvers found", {
1455
+ intent: intent.id
1456
+ }, {
1457
+ F: __dxlog_file3,
1458
+ L: 200,
1459
+ S: this,
1460
+ C: (f, a) => f(...a)
1461
+ });
1462
+ return yield* Effect3.fail(new NoResolversError(intent.id));
1339
1463
  }
1340
1464
  const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
1341
1465
  const result = Effect3.isEffect(effect) ? yield* effect : yield* Effect3.promise(async () => effect);
@@ -1347,7 +1471,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1347
1471
  const dispatch = (intentChain, depth = 0) => {
1348
1472
  return Effect3.gen(function* () {
1349
1473
  if (depth > executionLimit) {
1350
- yield* Effect3.fail(new CycleDetectedError());
1474
+ return yield* Effect3.fail(new CycleDetectedError());
1351
1475
  }
1352
1476
  const resultsRef = yield* Ref2.make([]);
1353
1477
  for (const intent of intentChain.all) {
@@ -1369,7 +1493,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1369
1493
  }
1370
1494
  }
1371
1495
  if (result2.error) {
1372
- yield* Effect3.fail(result2.error);
1496
+ return yield* Effect3.fail(result2.error);
1373
1497
  }
1374
1498
  }
1375
1499
  const results = yield* resultsRef.get;
@@ -1398,7 +1522,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1398
1522
  })).catch((error) => {
1399
1523
  log3.catch(error, void 0, {
1400
1524
  F: __dxlog_file3,
1401
- L: 270,
1525
+ L: 272,
1402
1526
  S: void 0,
1403
1527
  C: (f, a) => f(...a)
1404
1528
  });
@@ -1451,7 +1575,7 @@ var createDispatcher = (getResolvers, { executionLimit = EXECUTION_LIMIT, histor
1451
1575
  };
1452
1576
  var defaultEffect = () => Effect3.fail(new Error("Intent runtime not ready"));
1453
1577
  var defaultPromise = () => Effect3.runPromise(defaultEffect());
1454
- var intent_dispatcher_default = (context) => {
1578
+ var intent_dispatcher_default = ((context) => {
1455
1579
  const state = live2({
1456
1580
  dispatch: defaultEffect,
1457
1581
  dispatchPromise: defaultPromise,
@@ -1473,7 +1597,7 @@ var intent_dispatcher_default = (context) => {
1473
1597
  state.undo = undo;
1474
1598
  state.undoPromise = undoPromise;
1475
1599
  return contributes(Capabilities.IntentDispatcher, state);
1476
- };
1600
+ });
1477
1601
 
1478
1602
  export {
1479
1603
  defineCapability,
@@ -1503,6 +1627,9 @@ export {
1503
1627
  INTENT_PLUGIN,
1504
1628
  INTENT_ACTION,
1505
1629
  IntentAction,
1630
+ BaseError,
1631
+ NoResolversError,
1632
+ CycleDetectedError,
1506
1633
  createResolver,
1507
1634
  createDispatcher,
1508
1635
  intent_dispatcher_default,
@@ -1515,4 +1642,4 @@ export {
1515
1642
  ResourceLanguage,
1516
1643
  Resource
1517
1644
  };
1518
- //# sourceMappingURL=chunk-EHM4UI3V.mjs.map
1645
+ //# sourceMappingURL=chunk-RAYLWQ5Q.mjs.map