@dxos/app-framework 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b

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 (382) hide show
  1. package/dist/lib/browser/app-graph-builder-F7VZ6LRN.mjs +137 -0
  2. package/dist/lib/browser/app-graph-builder-F7VZ6LRN.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-ATRNTMSS.mjs +1399 -0
  4. package/dist/lib/browser/chunk-ATRNTMSS.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-LDJ3T4V3.mjs +32 -0
  6. package/dist/lib/browser/chunk-LDJ3T4V3.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-WS6SU6HI.mjs +285 -0
  8. package/dist/lib/browser/chunk-WS6SU6HI.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +119 -642
  10. package/dist/lib/browser/index.mjs.map +4 -4
  11. package/dist/lib/browser/intent-dispatcher-E6J7E5Y5.mjs +11 -0
  12. package/dist/lib/browser/intent-resolver-XLE4L3LS.mjs +38 -0
  13. package/dist/lib/browser/intent-resolver-XLE4L3LS.mjs.map +7 -0
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/store-QU2IKFAI.mjs +19 -0
  16. package/dist/lib/browser/store-QU2IKFAI.mjs.map +7 -0
  17. package/dist/lib/browser/testing/index.mjs +74 -0
  18. package/dist/lib/browser/testing/index.mjs.map +7 -0
  19. package/dist/lib/browser/worker.mjs +77 -0
  20. package/dist/lib/node/app-graph-builder-JGBADFF7.cjs +146 -0
  21. package/dist/lib/node/app-graph-builder-JGBADFF7.cjs.map +7 -0
  22. package/dist/lib/node/{chunk-FCMHRU3M.cjs → chunk-QLVQ6PND.cjs} +23 -35
  23. package/dist/lib/node/chunk-QLVQ6PND.cjs.map +7 -0
  24. package/dist/lib/node/chunk-WKC6YMEQ.cjs +1433 -0
  25. package/dist/lib/node/chunk-WKC6YMEQ.cjs.map +7 -0
  26. package/dist/lib/node/chunk-WRWRZKZU.cjs +308 -0
  27. package/dist/lib/node/chunk-WRWRZKZU.cjs.map +7 -0
  28. package/dist/lib/node/index.cjs +125 -665
  29. package/dist/lib/node/index.cjs.map +4 -4
  30. package/dist/lib/node/{plugin-settings-W6UHMH5M.cjs → intent-dispatcher-CFBKDZQR.cjs} +10 -14
  31. package/dist/lib/node/intent-dispatcher-CFBKDZQR.cjs.map +7 -0
  32. package/dist/lib/node/intent-resolver-3TKCXP4S.cjs +45 -0
  33. package/dist/lib/node/intent-resolver-3TKCXP4S.cjs.map +7 -0
  34. package/dist/lib/node/meta.json +1 -1
  35. package/dist/lib/node/store-4QMUUU2A.cjs +34 -0
  36. package/dist/lib/node/store-4QMUUU2A.cjs.map +7 -0
  37. package/dist/lib/node/testing/index.cjs +98 -0
  38. package/dist/lib/node/testing/index.cjs.map +7 -0
  39. package/dist/lib/node/worker.cjs +99 -0
  40. package/dist/lib/node/worker.cjs.map +7 -0
  41. package/dist/lib/node-esm/app-graph-builder-2QEX57NX.mjs +138 -0
  42. package/dist/lib/node-esm/app-graph-builder-2QEX57NX.mjs.map +7 -0
  43. package/dist/lib/node-esm/chunk-44J2VZBB.mjs +1401 -0
  44. package/dist/lib/node-esm/chunk-44J2VZBB.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-CNJYZNSL.mjs +34 -0
  46. package/dist/lib/node-esm/chunk-CNJYZNSL.mjs.map +7 -0
  47. package/dist/lib/node-esm/chunk-HTLXL32I.mjs +286 -0
  48. package/dist/lib/node-esm/chunk-HTLXL32I.mjs.map +7 -0
  49. package/dist/lib/node-esm/index.mjs +119 -642
  50. package/dist/lib/node-esm/index.mjs.map +4 -4
  51. package/dist/lib/node-esm/intent-dispatcher-LDQGDZ62.mjs +12 -0
  52. package/dist/lib/node-esm/intent-resolver-7VJWN67U.mjs +39 -0
  53. package/dist/lib/node-esm/intent-resolver-7VJWN67U.mjs.map +7 -0
  54. package/dist/lib/node-esm/meta.json +1 -1
  55. package/dist/lib/node-esm/store-VWDAYUQY.mjs +20 -0
  56. package/dist/lib/node-esm/store-VWDAYUQY.mjs.map +7 -0
  57. package/dist/lib/node-esm/testing/index.mjs +75 -0
  58. package/dist/lib/node-esm/testing/index.mjs.map +7 -0
  59. package/dist/lib/node-esm/worker.mjs +78 -0
  60. package/dist/types/src/App.d.ts +22 -13
  61. package/dist/types/src/App.d.ts.map +1 -1
  62. package/dist/types/src/common/capabilities.d.ts +293 -0
  63. package/dist/types/src/common/capabilities.d.ts.map +1 -0
  64. package/dist/types/src/common/events.d.ts +48 -0
  65. package/dist/types/src/common/events.d.ts.map +1 -0
  66. package/dist/types/src/common/file.d.ts +14 -0
  67. package/dist/types/src/common/file.d.ts.map +1 -0
  68. package/dist/types/src/common/graph.d.ts +21 -0
  69. package/dist/types/src/common/graph.d.ts.map +1 -0
  70. package/dist/types/src/common/index.d.ts +8 -0
  71. package/dist/types/src/common/index.d.ts.map +1 -0
  72. package/dist/types/src/common/layout.d.ts +248 -0
  73. package/dist/types/src/common/layout.d.ts.map +1 -0
  74. package/dist/types/src/{plugins/plugin-surface/SurfaceContext.d.ts → common/surface.d.ts} +12 -29
  75. package/dist/types/src/common/surface.d.ts.map +1 -0
  76. package/dist/types/src/common/translations.d.ts +11 -0
  77. package/dist/types/src/common/translations.d.ts.map +1 -0
  78. package/dist/types/src/core/capabilities.d.ts +94 -0
  79. package/dist/types/src/core/capabilities.d.ts.map +1 -0
  80. package/dist/types/src/core/capabilities.test.d.ts +2 -0
  81. package/dist/types/src/core/capabilities.test.d.ts.map +1 -0
  82. package/dist/types/src/core/events.d.ts +58 -0
  83. package/dist/types/src/core/events.d.ts.map +1 -0
  84. package/dist/types/src/core/index.d.ts +5 -0
  85. package/dist/types/src/core/index.d.ts.map +1 -0
  86. package/dist/types/src/core/manager.d.ts +119 -0
  87. package/dist/types/src/core/manager.d.ts.map +1 -0
  88. package/dist/types/src/core/manager.test.d.ts +2 -0
  89. package/dist/types/src/core/manager.test.d.ts.map +1 -0
  90. package/dist/types/src/core/plugin.d.ts +97 -0
  91. package/dist/types/src/core/plugin.d.ts.map +1 -0
  92. package/dist/types/src/helpers.d.ts +10 -0
  93. package/dist/types/src/helpers.d.ts.map +1 -0
  94. package/dist/types/src/helpers.test.d.ts +2 -0
  95. package/dist/types/src/helpers.test.d.ts.map +1 -0
  96. package/dist/types/src/index.d.ts +5 -1
  97. package/dist/types/src/index.d.ts.map +1 -1
  98. package/dist/types/src/playground/debug/Debug.d.ts +6 -0
  99. package/dist/types/src/playground/debug/Debug.d.ts.map +1 -0
  100. package/dist/types/src/playground/debug/index.d.ts +2 -0
  101. package/dist/types/src/playground/debug/index.d.ts.map +1 -0
  102. package/dist/types/src/playground/debug/plugin.d.ts +2 -0
  103. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -0
  104. package/dist/types/src/playground/generator/Main.d.ts +6 -0
  105. package/dist/types/src/playground/generator/Main.d.ts.map +1 -0
  106. package/dist/types/src/playground/generator/Toolbar.d.ts +6 -0
  107. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -0
  108. package/dist/types/src/playground/generator/generator.d.ts +7 -0
  109. package/dist/types/src/playground/generator/generator.d.ts.map +1 -0
  110. package/dist/types/src/playground/generator/index.d.ts +3 -0
  111. package/dist/types/src/playground/generator/index.d.ts.map +1 -0
  112. package/dist/types/src/playground/generator/plugin.d.ts +2 -0
  113. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -0
  114. package/dist/types/src/playground/layout/Layout.d.ts +8 -0
  115. package/dist/types/src/playground/layout/Layout.d.ts.map +1 -0
  116. package/dist/types/src/playground/layout/index.d.ts +2 -0
  117. package/dist/types/src/playground/layout/index.d.ts.map +1 -0
  118. package/dist/types/src/playground/layout/plugin.d.ts +2 -0
  119. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -0
  120. package/dist/types/src/playground/logger/Toolbar.d.ts +6 -0
  121. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -0
  122. package/dist/types/src/playground/logger/index.d.ts +2 -0
  123. package/dist/types/src/playground/logger/index.d.ts.map +1 -0
  124. package/dist/types/src/playground/logger/plugin.d.ts +2 -0
  125. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -0
  126. package/dist/types/src/playground/logger/schema.d.ts +13 -0
  127. package/dist/types/src/playground/logger/schema.d.ts.map +1 -0
  128. package/dist/types/src/playground/playground.stories.d.ts +10 -0
  129. package/dist/types/src/playground/playground.stories.d.ts.map +1 -0
  130. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +2 -0
  131. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -0
  132. package/dist/types/src/plugin-intent/actions.d.ts +23 -0
  133. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -0
  134. package/dist/types/src/plugin-intent/errors.d.ts +16 -0
  135. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -0
  136. package/dist/types/src/plugin-intent/index.d.ts +5 -0
  137. package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
  138. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +113 -0
  139. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -0
  140. package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
  141. package/dist/types/src/{plugins/plugin-intent → plugin-intent}/intent.d.ts +8 -28
  142. package/dist/types/src/plugin-intent/intent.d.ts.map +1 -0
  143. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -0
  144. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -0
  145. package/dist/types/src/plugin-settings/actions.d.ts +27 -0
  146. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -0
  147. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
  148. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
  149. package/dist/types/src/plugin-settings/index.d.ts +3 -0
  150. package/dist/types/src/plugin-settings/index.d.ts.map +1 -0
  151. package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
  152. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
  153. package/dist/types/src/plugin-settings/store.d.ts +5 -0
  154. package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
  155. package/dist/types/src/plugin-settings/translations.d.ts +11 -0
  156. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
  157. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -0
  158. package/dist/types/src/{plugins/plugin-intent → react}/IntentContext.d.ts +2 -2
  159. package/dist/types/src/react/IntentContext.d.ts.map +1 -0
  160. package/dist/types/src/react/PluginManagerProvider.d.ts +10 -0
  161. package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -0
  162. package/dist/types/src/react/Surface.d.ts +12 -0
  163. package/dist/types/src/react/Surface.d.ts.map +1 -0
  164. package/dist/types/src/react/Surface.stories.d.ts +16 -0
  165. package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
  166. package/dist/types/src/react/common.d.ts +12 -0
  167. package/dist/types/src/react/common.d.ts.map +1 -0
  168. package/dist/types/src/react/index.d.ts +7 -0
  169. package/dist/types/src/react/index.d.ts.map +1 -0
  170. package/dist/types/src/react/useCapabilities.d.ts +13 -0
  171. package/dist/types/src/react/useCapabilities.d.ts.map +1 -0
  172. package/dist/types/src/react/useIntentResolver.d.ts +3 -0
  173. package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
  174. package/dist/types/src/testing/index.d.ts +2 -0
  175. package/dist/types/src/testing/index.d.ts.map +1 -0
  176. package/dist/types/src/testing/withPluginManager.d.ts +10 -0
  177. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -0
  178. package/dist/types/src/testing/withPluginManager.stories.d.ts +5 -0
  179. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -0
  180. package/dist/types/src/worker.d.ts +4 -0
  181. package/dist/types/src/worker.d.ts.map +1 -0
  182. package/dist/types/tsconfig.tsbuildinfo +1 -1
  183. package/package.json +37 -18
  184. package/project.json +4 -3
  185. package/src/App.tsx +139 -34
  186. package/src/common/capabilities.ts +91 -0
  187. package/src/common/events.ts +72 -0
  188. package/src/common/file.ts +22 -0
  189. package/src/common/graph.ts +30 -0
  190. package/src/{plugins/common → common}/index.ts +3 -2
  191. package/src/common/layout.ts +225 -0
  192. package/src/{plugins/plugin-surface/SurfaceContext.ts → common/surface.ts} +6 -37
  193. package/src/common/translations.ts +17 -0
  194. package/src/core/capabilities.test.ts +116 -0
  195. package/src/core/capabilities.ts +222 -0
  196. package/src/core/events.ts +58 -0
  197. package/src/core/index.ts +8 -0
  198. package/src/core/manager.test.ts +516 -0
  199. package/src/core/manager.ts +511 -0
  200. package/src/core/plugin.ts +131 -0
  201. package/src/helpers.test.ts +97 -0
  202. package/src/helpers.ts +45 -0
  203. package/src/index.ts +6 -3
  204. package/src/playground/debug/Debug.tsx +39 -0
  205. package/src/playground/debug/index.ts +5 -0
  206. package/src/playground/debug/plugin.ts +17 -0
  207. package/src/playground/generator/Main.tsx +71 -0
  208. package/src/playground/generator/Toolbar.tsx +46 -0
  209. package/src/playground/generator/generator.ts +48 -0
  210. package/src/playground/generator/index.ts +6 -0
  211. package/src/playground/generator/plugin.ts +23 -0
  212. package/src/playground/layout/Layout.tsx +33 -0
  213. package/src/playground/layout/index.ts +5 -0
  214. package/src/playground/layout/plugin.ts +17 -0
  215. package/src/playground/logger/Toolbar.tsx +29 -0
  216. package/src/playground/logger/index.ts +5 -0
  217. package/src/playground/logger/plugin.ts +36 -0
  218. package/src/playground/logger/schema.ts +12 -0
  219. package/src/playground/playground.stories.tsx +34 -0
  220. package/src/plugin-intent/IntentPlugin.tsx +20 -0
  221. package/src/plugin-intent/actions.ts +22 -0
  222. package/src/plugin-intent/errors.ts +39 -0
  223. package/src/plugin-intent/index.ts +8 -0
  224. package/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.test.ts +83 -63
  225. package/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.ts +114 -95
  226. package/src/{plugins/plugin-intent → plugin-intent}/intent.ts +10 -26
  227. package/src/plugin-settings/SettingsPlugin.ts +35 -0
  228. package/src/plugin-settings/actions.ts +27 -0
  229. package/src/plugin-settings/app-graph-builder.ts +122 -0
  230. package/src/plugin-settings/index.ts +6 -0
  231. package/src/plugin-settings/intent-resolver.ts +28 -0
  232. package/src/plugin-settings/store.ts +20 -0
  233. package/src/plugin-settings/translations.ts +17 -0
  234. package/src/{plugins/plugin-intent → react}/IntentContext.tsx +13 -5
  235. package/src/react/PluginManagerProvider.ts +22 -0
  236. package/src/react/Surface.stories.tsx +96 -0
  237. package/src/react/Surface.tsx +75 -0
  238. package/src/react/common.ts +12 -0
  239. package/src/react/index.ts +10 -0
  240. package/src/react/useCapabilities.ts +39 -0
  241. package/src/react/useIntentResolver.ts +22 -0
  242. package/src/testing/index.ts +5 -0
  243. package/src/testing/withPluginManager.stories.tsx +47 -0
  244. package/src/testing/withPluginManager.tsx +75 -0
  245. package/src/worker.ts +11 -0
  246. package/tsconfig.json +16 -4
  247. package/dist/lib/browser/chunk-3E7RY3CE.mjs +0 -72
  248. package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +0 -7
  249. package/dist/lib/browser/chunk-QG25ZU2N.mjs +0 -320
  250. package/dist/lib/browser/chunk-QG25ZU2N.mjs.map +0 -7
  251. package/dist/lib/browser/chunk-SPDTXTOV.mjs +0 -163
  252. package/dist/lib/browser/chunk-SPDTXTOV.mjs.map +0 -7
  253. package/dist/lib/browser/chunk-WBOXEHBE.mjs +0 -51
  254. package/dist/lib/browser/chunk-WBOXEHBE.mjs.map +0 -7
  255. package/dist/lib/browser/plugin-intent-T7Y3MJ5C.mjs +0 -32
  256. package/dist/lib/browser/plugin-settings-5U2L2NRU.mjs +0 -15
  257. package/dist/lib/browser/plugin-surface-OKPF3EQI.mjs +0 -24
  258. package/dist/lib/node/chunk-BW3RNEVI.cjs +0 -185
  259. package/dist/lib/node/chunk-BW3RNEVI.cjs.map +0 -7
  260. package/dist/lib/node/chunk-FCMHRU3M.cjs.map +0 -7
  261. package/dist/lib/node/chunk-QBM42OQ6.cjs +0 -97
  262. package/dist/lib/node/chunk-QBM42OQ6.cjs.map +0 -7
  263. package/dist/lib/node/chunk-VWHAALIN.cjs +0 -344
  264. package/dist/lib/node/chunk-VWHAALIN.cjs.map +0 -7
  265. package/dist/lib/node/plugin-intent-F3TQZIUR.cjs +0 -53
  266. package/dist/lib/node/plugin-intent-F3TQZIUR.cjs.map +0 -7
  267. package/dist/lib/node/plugin-settings-W6UHMH5M.cjs.map +0 -7
  268. package/dist/lib/node/plugin-surface-CCSIONYW.cjs +0 -45
  269. package/dist/lib/node/plugin-surface-CCSIONYW.cjs.map +0 -7
  270. package/dist/lib/node-esm/chunk-3T5UIJY3.mjs +0 -53
  271. package/dist/lib/node-esm/chunk-3T5UIJY3.mjs.map +0 -7
  272. package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs +0 -164
  273. package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs.map +0 -7
  274. package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs +0 -321
  275. package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs.map +0 -7
  276. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +0 -74
  277. package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +0 -7
  278. package/dist/lib/node-esm/plugin-intent-W2HQC6LC.mjs +0 -33
  279. package/dist/lib/node-esm/plugin-settings-H5RHNFVC.mjs +0 -16
  280. package/dist/lib/node-esm/plugin-settings-H5RHNFVC.mjs.map +0 -7
  281. package/dist/lib/node-esm/plugin-surface-V3YET3UL.mjs +0 -25
  282. package/dist/lib/node-esm/plugin-surface-V3YET3UL.mjs.map +0 -7
  283. package/dist/types/src/plugins/common/file.d.ts +0 -22
  284. package/dist/types/src/plugins/common/file.d.ts.map +0 -1
  285. package/dist/types/src/plugins/common/graph.d.ts +0 -51
  286. package/dist/types/src/plugins/common/graph.d.ts.map +0 -1
  287. package/dist/types/src/plugins/common/index.d.ts +0 -7
  288. package/dist/types/src/plugins/common/index.d.ts.map +0 -1
  289. package/dist/types/src/plugins/common/layout.d.ts +0 -176
  290. package/dist/types/src/plugins/common/layout.d.ts.map +0 -1
  291. package/dist/types/src/plugins/common/metadata.d.ts +0 -16
  292. package/dist/types/src/plugins/common/metadata.d.ts.map +0 -1
  293. package/dist/types/src/plugins/common/navigation.d.ts +0 -243
  294. package/dist/types/src/plugins/common/navigation.d.ts.map +0 -1
  295. package/dist/types/src/plugins/common/translations.d.ts +0 -22
  296. package/dist/types/src/plugins/common/translations.d.ts.map +0 -1
  297. package/dist/types/src/plugins/helpers.d.ts +0 -41
  298. package/dist/types/src/plugins/helpers.d.ts.map +0 -1
  299. package/dist/types/src/plugins/index.d.ts +0 -7
  300. package/dist/types/src/plugins/index.d.ts.map +0 -1
  301. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +0 -16
  302. package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +0 -1
  303. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +0 -14
  304. package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +0 -1
  305. package/dist/types/src/plugins/plugin-host/PluginContext.d.ts +0 -47
  306. package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +0 -1
  307. package/dist/types/src/plugins/plugin-host/index.d.ts +0 -6
  308. package/dist/types/src/plugins/plugin-host/index.d.ts.map +0 -1
  309. package/dist/types/src/plugins/plugin-host/plugin.d.ts +0 -104
  310. package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +0 -1
  311. package/dist/types/src/plugins/plugin-host/plugin.test.d.ts +0 -35
  312. package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +0 -1
  313. package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +0 -1
  314. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts +0 -8
  315. package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +0 -1
  316. package/dist/types/src/plugins/plugin-intent/index.d.ts +0 -7
  317. package/dist/types/src/plugins/plugin-intent/index.d.ts.map +0 -1
  318. package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts +0 -107
  319. package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts.map +0 -1
  320. package/dist/types/src/plugins/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
  321. package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +0 -1
  322. package/dist/types/src/plugins/plugin-intent/meta.d.ts +0 -6
  323. package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +0 -1
  324. package/dist/types/src/plugins/plugin-intent/provides.d.ts +0 -16
  325. package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +0 -1
  326. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +0 -4
  327. package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +0 -1
  328. package/dist/types/src/plugins/plugin-settings/index.d.ts +0 -4
  329. package/dist/types/src/plugins/plugin-settings/index.d.ts.map +0 -1
  330. package/dist/types/src/plugins/plugin-settings/meta.d.ts +0 -5
  331. package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +0 -1
  332. package/dist/types/src/plugins/plugin-settings/provides.d.ts +0 -26
  333. package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +0 -1
  334. package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +0 -1
  335. package/dist/types/src/plugins/plugin-surface/Surface.d.ts +0 -7
  336. package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +0 -1
  337. package/dist/types/src/plugins/plugin-surface/SurfaceContext.d.ts.map +0 -1
  338. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +0 -7
  339. package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +0 -1
  340. package/dist/types/src/plugins/plugin-surface/helpers.d.ts +0 -21
  341. package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +0 -1
  342. package/dist/types/src/plugins/plugin-surface/index.d.ts +0 -8
  343. package/dist/types/src/plugins/plugin-surface/index.d.ts.map +0 -1
  344. package/dist/types/src/plugins/plugin-surface/meta.d.ts +0 -5
  345. package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +0 -1
  346. package/dist/types/src/plugins/plugin-surface/provides.d.ts +0 -17
  347. package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +0 -1
  348. package/src/plugins/common/file.ts +0 -36
  349. package/src/plugins/common/graph.ts +0 -70
  350. package/src/plugins/common/layout.ts +0 -173
  351. package/src/plugins/common/metadata.ts +0 -29
  352. package/src/plugins/common/navigation.ts +0 -214
  353. package/src/plugins/common/translations.ts +0 -36
  354. package/src/plugins/helpers.ts +0 -92
  355. package/src/plugins/index.ts +0 -11
  356. package/src/plugins/plugin-host/HostPlugin.tsx +0 -88
  357. package/src/plugins/plugin-host/PluginContainer.tsx +0 -120
  358. package/src/plugins/plugin-host/PluginContext.tsx +0 -79
  359. package/src/plugins/plugin-host/index.ts +0 -12
  360. package/src/plugins/plugin-host/plugin.test.ts +0 -158
  361. package/src/plugins/plugin-host/plugin.ts +0 -133
  362. package/src/plugins/plugin-intent/IntentPlugin.tsx +0 -75
  363. package/src/plugins/plugin-intent/index.ts +0 -13
  364. package/src/plugins/plugin-intent/meta.ts +0 -11
  365. package/src/plugins/plugin-intent/provides.ts +0 -26
  366. package/src/plugins/plugin-settings/SettingsPlugin.tsx +0 -22
  367. package/src/plugins/plugin-settings/index.ts +0 -9
  368. package/src/plugins/plugin-settings/meta.ts +0 -9
  369. package/src/plugins/plugin-settings/provides.ts +0 -34
  370. package/src/plugins/plugin-surface/Surface.tsx +0 -62
  371. package/src/plugins/plugin-surface/SurfacePlugin.tsx +0 -45
  372. package/src/plugins/plugin-surface/helpers.ts +0 -22
  373. package/src/plugins/plugin-surface/index.ts +0 -14
  374. package/src/plugins/plugin-surface/meta.ts +0 -9
  375. package/src/plugins/plugin-surface/provides.ts +0 -27
  376. /package/dist/lib/browser/{plugin-intent-T7Y3MJ5C.mjs.map → intent-dispatcher-E6J7E5Y5.mjs.map} +0 -0
  377. /package/dist/lib/browser/{plugin-settings-5U2L2NRU.mjs.map → worker.mjs.map} +0 -0
  378. /package/dist/lib/{browser/plugin-surface-OKPF3EQI.mjs.map → node-esm/intent-dispatcher-LDQGDZ62.mjs.map} +0 -0
  379. /package/dist/lib/node-esm/{plugin-intent-W2HQC6LC.mjs.map → worker.mjs.map} +0 -0
  380. /package/dist/types/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.test.d.ts +0 -0
  381. /package/dist/types/src/{plugins/plugin-surface → react}/ErrorBoundary.d.ts +0 -0
  382. /package/src/{plugins/plugin-surface → react}/ErrorBoundary.tsx +0 -0
@@ -2,13 +2,16 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Effect, Ref } from 'effect';
5
+ import { Effect, Option, pipe, Ref } from 'effect';
6
+ import { type Simplify } from 'effect/Types';
6
7
 
7
- import { type MaybePromise, pick } from '@dxos/util';
8
+ import { create } from '@dxos/live-object';
9
+ import { byPosition, type MaybePromise, type Position, type GuardedType } from '@dxos/util';
8
10
 
11
+ import { IntentAction } from './actions';
12
+ import { CycleDetectedError, NoResolversError } from './errors';
9
13
  import {
10
14
  createIntent,
11
- IntentAction,
12
15
  type AnyIntent,
13
16
  type AnyIntentChain,
14
17
  type Intent,
@@ -19,6 +22,8 @@ import {
19
22
  type IntentSchema,
20
23
  type Label,
21
24
  } from './intent';
25
+ import { Events, Capabilities } from '../common';
26
+ import { contributes, type PluginsContext } from '../core';
22
27
 
23
28
  const EXECUTION_LIMIT = 100;
24
29
  const HISTORY_LIMIT = 100;
@@ -26,13 +31,13 @@ const HISTORY_LIMIT = 100;
26
31
  /**
27
32
  * The return value of an intent effect.
28
33
  */
29
- export type IntentEffectResult<Fields extends IntentParams> = {
34
+ export type IntentEffectResult<Input, Output> = {
30
35
  /**
31
36
  * The output of the action that was performed.
32
37
  *
33
38
  * If the intent is apart of a chain of intents, the data will be passed to the next intent.
34
39
  */
35
- data?: IntentResultData<Fields>;
40
+ data?: Output;
36
41
 
37
42
  /**
38
43
  * If provided, the action will be undoable.
@@ -46,13 +51,15 @@ export type IntentEffectResult<Fields extends IntentParams> = {
46
51
  /**
47
52
  * Will be merged with the original intent data when firing the undo intent.
48
53
  */
49
- data?: Partial<IntentData<Fields>>;
54
+ data?: Partial<Input>;
50
55
  };
51
56
 
52
57
  /**
53
58
  * An error that occurred while performing the action.
54
59
  *
55
60
  * If the intent is apart of a chain of intents and an error occurs, the chain will be aborted.
61
+ *
62
+ * Return caught error instead of throwing to trigger other intent to be triggered prior to returning the error.
56
63
  */
57
64
  error?: Error;
58
65
 
@@ -62,42 +69,32 @@ export type IntentEffectResult<Fields extends IntentParams> = {
62
69
  intents?: AnyIntentChain[];
63
70
  };
64
71
 
65
- export type AnyIntentEffectResult = IntentEffectResult<any>;
72
+ export type AnyIntentEffectResult = IntentEffectResult<any, any>;
66
73
 
67
74
  /**
68
75
  * The result of an intent dispatcher.
69
76
  */
70
- export type IntentDispatcherResult<Fields extends IntentParams> = Pick<IntentEffectResult<Fields>, 'data' | 'error'>;
71
-
72
- /**
73
- * Determines the priority of the effect when multiple intent resolvers are matched.
74
- *
75
- * - `static` - The effect is selected in the order it was resolved.
76
- * - `hoist` - The effect is selected before `static` effects.
77
- * - `fallback` - The effect is selected after `static` effects.
78
- */
79
- export type IntentDisposition = 'static' | 'hoist' | 'fallback';
77
+ export type IntentDispatcherResult<Input, Output> = Pick<IntentEffectResult<Input, Output>, 'data' | 'error'>;
80
78
 
81
79
  /**
82
80
  * The implementation of an intent effect.
83
81
  */
84
- export type IntentEffectDefinition<Fields extends IntentParams> = (
85
- data: IntentData<Fields>,
82
+ export type IntentEffectDefinition<Input, Output> = (
83
+ data: Input,
86
84
  undo: boolean,
87
- ) => MaybePromise<IntentEffectResult<Fields> | void> | Effect.Effect<IntentEffectResult<Fields> | void>;
85
+ ) => MaybePromise<IntentEffectResult<Input, Output> | void> | Effect.Effect<IntentEffectResult<Input, Output> | void>;
88
86
 
89
87
  /**
90
88
  * Intent resolver to match intents to their effects.
91
89
  */
92
- export type IntentResolver<Tag extends string, Fields extends IntentParams> = {
93
- action: Tag;
94
- disposition?: IntentDisposition;
95
- // TODO(wittjosiah): Would be nice to make this a guard for intents with optional data.
96
- filter?: (data: IntentData<Fields>) => boolean;
97
- effect: IntentEffectDefinition<Fields>;
98
- };
90
+ export type IntentResolver<Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>> = Readonly<{
91
+ intent: IntentSchema<Tag, Fields>;
92
+ position?: Position;
93
+ filter?: (data: IntentData<Fields>) => data is Data;
94
+ resolve: IntentEffectDefinition<GuardedType<IntentResolver<Tag, Fields, Data>['filter']>, IntentResultData<Fields>>;
95
+ }>;
99
96
 
100
- export type AnyIntentResolver = IntentResolver<any, any>;
97
+ export type AnyIntentResolver = IntentResolver<any, any, any>;
101
98
 
102
99
  /**
103
100
  * Creates an intent resolver to match intents to their effects.
@@ -106,22 +103,16 @@ export type AnyIntentResolver = IntentResolver<any, any>;
106
103
  * @param params.disposition Determines the priority of the resolver when multiple are resolved.
107
104
  * @param params.filter Optional filter to determine if the resolver should be used.
108
105
  */
109
- export const createResolver = <Tag extends string, Fields extends IntentParams>(
110
- schema: IntentSchema<Tag, Fields>,
111
- effect: IntentEffectDefinition<Fields>,
112
- params: Pick<IntentResolver<Tag, Fields>, 'disposition' | 'filter'> = {},
113
- ): IntentResolver<Tag, Fields> => ({
114
- action: schema._tag,
115
- effect,
116
- ...params,
117
- });
106
+ export const createResolver = <Tag extends string, Fields extends IntentParams, Data = IntentData<Fields>>(
107
+ resolver: IntentResolver<Tag, Fields, Data>,
108
+ ) => resolver;
118
109
 
119
110
  /**
120
111
  * Invokes intents and returns the result.
121
112
  */
122
113
  export type PromiseIntentDispatcher = <Fields extends IntentParams>(
123
114
  intent: IntentChain<any, any, any, Fields>,
124
- ) => Promise<IntentDispatcherResult<Fields>>;
115
+ ) => Promise<Simplify<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>>;
125
116
 
126
117
  /**
127
118
  * Creates an effect for intents.
@@ -129,23 +120,29 @@ export type PromiseIntentDispatcher = <Fields extends IntentParams>(
129
120
  export type IntentDispatcher = <Fields extends IntentParams>(
130
121
  intent: IntentChain<any, any, any, Fields>,
131
122
  depth?: number,
132
- ) => Effect.Effect<IntentDispatcherResult<Fields>, Error>;
133
-
134
- type IntentResult<Tag extends string, Fields extends IntentParams> = IntentEffectResult<Fields> & {
123
+ ) => Effect.Effect<
124
+ Simplify<Required<IntentDispatcherResult<IntentData<Fields>, IntentResultData<Fields>>>['data']>,
125
+ Error
126
+ >;
127
+
128
+ type IntentResult<Tag extends string, Fields extends IntentParams> = IntentEffectResult<
129
+ IntentData<Fields>,
130
+ IntentResultData<Fields>
131
+ > & {
135
132
  _intent: Intent<Tag, Fields>;
136
133
  };
137
134
 
138
- type AnyIntentResult = IntentResult<any, any>;
135
+ export type AnyIntentResult = IntentResult<any, any>;
139
136
 
140
137
  /**
141
138
  * Invokes the most recent undoable intent with undo flags.
142
139
  */
143
- export type PromiseIntentUndo = () => Promise<IntentDispatcherResult<any> | undefined>;
140
+ export type PromiseIntentUndo = () => Promise<IntentDispatcherResult<any, any>>;
144
141
 
145
142
  /**
146
143
  * Creates an effect which undoes the last intent.
147
144
  */
148
- export type IntentUndo = () => Effect.Effect<IntentDispatcherResult<any> | undefined, Error>;
145
+ export type IntentUndo = () => Effect.Effect<any, Error>;
149
146
 
150
147
  /**
151
148
  * Check if a chain of results is undoable.
@@ -158,51 +155,40 @@ export type IntentContext = {
158
155
  dispatchPromise: PromiseIntentDispatcher;
159
156
  undo: IntentUndo;
160
157
  undoPromise: PromiseIntentUndo;
161
- registerResolver: (id: string, resolver: AnyIntentResolver) => () => void;
162
158
  };
163
159
 
164
160
  /**
165
161
  * Sets of an intent dispatcher.
166
162
  *
167
- * @param resolvers An array of available intent resolvers.
163
+ * @param getResolvers A function that returns an array of available intent resolvers.
168
164
  * @param params.historyLimit The maximum number of intent results to keep in history.
169
165
  * @param params.executionLimit The maximum recursion depth of intent chains.
170
166
  */
171
167
  export const createDispatcher = (
172
- resolvers: Record<string, AnyIntentResolver[]>,
168
+ getResolvers: (module?: string) => AnyIntentResolver[],
173
169
  { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {},
174
170
  ): IntentContext => {
175
171
  const historyRef = Effect.runSync(Ref.make<AnyIntentResult[][]>([]));
176
172
 
177
- const handleIntent = (intent: AnyIntent) => {
178
- return Effect.gen(function* () {
179
- const candidates = Object.entries(resolvers)
180
- .filter(([id, _]) => (intent.plugin ? id === intent.plugin : true))
181
- .flatMap(([_, resolvers]) => resolvers)
182
- .filter((r) => r.action === intent.action)
173
+ const handleIntent = (intent: AnyIntent) =>
174
+ Effect.gen(function* () {
175
+ const candidates = getResolvers(intent.module)
176
+ .filter((r) => r.intent._tag === intent.id)
183
177
  .filter((r) => !r.filter || r.filter(intent.data))
184
- .toSorted(({ disposition: a = 'static' }, { disposition: b = 'static' }) => {
185
- return a === b ? 0 : a === 'hoist' || b === 'fallback' ? -1 : b === 'hoist' || a === 'fallback' ? 1 : 0;
186
- });
178
+ .toSorted(byPosition);
187
179
  if (candidates.length === 0) {
188
- return {
189
- _intent: intent,
190
- error: new Error(`No resolver found for action: ${intent.action}`),
191
- } satisfies AnyIntentResult;
180
+ yield* Effect.fail(new NoResolversError(intent.id));
192
181
  }
193
182
 
194
- const effect = candidates[0].effect(intent.data, intent.undo ?? false);
183
+ const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
195
184
  const result = Effect.isEffect(effect) ? yield* effect : yield* Effect.promise(async () => effect);
196
- return { _intent: intent, ...result } satisfies AnyIntentResult;
185
+ return { _intent: intent, ...result } as AnyIntentResult;
197
186
  });
198
- };
199
187
 
200
188
  const dispatch: IntentDispatcher = (intentChain, depth = 0) => {
201
189
  return Effect.gen(function* () {
202
190
  if (depth > executionLimit) {
203
- yield* Effect.fail(
204
- new Error('Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.'),
205
- );
191
+ yield* Effect.fail(new CycleDetectedError());
206
192
  }
207
193
 
208
194
  const resultsRef = yield* Ref.make<AnyIntentResult[]>([]);
@@ -210,9 +196,6 @@ export const createDispatcher = (
210
196
  const { data: prev } = (yield* resultsRef.get)[0] ?? {};
211
197
  const result = yield* handleIntent({ ...intent, data: { ...intent.data, ...prev } });
212
198
  yield* Ref.update(resultsRef, (results) => [result, ...results]);
213
- if (result.error) {
214
- break;
215
- }
216
199
  if (result.intents) {
217
200
  for (const intent of result.intents) {
218
201
  // Returned intents are dispatched but not yielded into results,
@@ -221,34 +204,39 @@ export const createDispatcher = (
221
204
  yield* dispatch(intent, depth + 1);
222
205
  }
223
206
  }
207
+ if (result.error) {
208
+ yield* Effect.fail(result.error);
209
+ }
224
210
  }
225
211
 
226
212
  const results = yield* resultsRef.get;
227
213
  const result = results[0];
228
- if (result) {
229
- yield* Ref.update(historyRef, (history) => {
230
- const next = [...history, results];
231
- if (next.length > historyLimit) {
232
- next.splice(0, next.length - historyLimit);
233
- }
234
- return next;
235
- });
236
-
237
- if (result.undoable && isUndoable(results)) {
238
- // TODO(wittjosiah): Is there a better way to handle showing undo for chains?
239
- yield* dispatch(createIntent(IntentAction.ShowUndo, { message: result.undoable.message }));
214
+ yield* Ref.update(historyRef, (history) => {
215
+ const next = [...history, results];
216
+ if (next.length > historyLimit) {
217
+ next.splice(0, next.length - historyLimit);
240
218
  }
241
-
242
- return pick(result, ['data', 'error']);
243
- } else {
244
- return { data: {}, error: new Error('No results') };
219
+ return next;
220
+ });
221
+
222
+ if (result.undoable && isUndoable(results)) {
223
+ // TODO(wittjosiah): Is there a better way to handle showing undo for chains?
224
+ yield* pipe(
225
+ dispatch(createIntent(IntentAction.ShowUndo, { message: result.undoable.message })),
226
+ Effect.catchSome((err) =>
227
+ err instanceof NoResolversError ? Option.some(Effect.succeed(undefined)) : Option.none(),
228
+ ),
229
+ );
245
230
  }
231
+
232
+ return result.data;
246
233
  });
247
234
  };
248
235
 
249
236
  const dispatchPromise: PromiseIntentDispatcher = (intentChain) => {
250
- const program = dispatch(intentChain);
251
- return Effect.runPromise(program);
237
+ return Effect.runPromise(dispatch(intentChain))
238
+ .then((data) => ({ data }))
239
+ .catch((error) => ({ error }));
252
240
  };
253
241
 
254
242
  const undo: IntentUndo = () => {
@@ -270,16 +258,47 @@ export const createDispatcher = (
270
258
  };
271
259
 
272
260
  const undoPromise: PromiseIntentUndo = () => {
273
- const program = undo();
274
- return Effect.runPromise(program);
261
+ return Effect.runPromise(undo())
262
+ .then((data) => ({ data }))
263
+ .catch((error) => ({ error }));
275
264
  };
276
265
 
277
- const registerResolver = (id: string, resolver: AnyIntentResolver) => {
278
- resolvers[id] = [...(resolvers[id] ?? []), resolver];
279
- return () => {
280
- resolvers[id] = resolvers[id].filter((r) => r !== resolver);
281
- };
266
+ return { dispatch, dispatchPromise, undo, undoPromise };
267
+ };
268
+
269
+ const defaultEffect = () => Effect.fail(new Error('Intent runtime not ready'));
270
+ const defaultPromise = () => Effect.runPromise(defaultEffect());
271
+
272
+ export default (context: PluginsContext) => {
273
+ const state = create<IntentContext>({
274
+ dispatch: defaultEffect,
275
+ dispatchPromise: defaultPromise,
276
+ undo: defaultEffect,
277
+ undoPromise: defaultPromise,
278
+ });
279
+
280
+ // TODO(wittjosiah): Make getResolver callback async and allow resolvers to be requested on demand.
281
+ const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher((module) =>
282
+ context
283
+ .requestCapabilities(Capabilities.IntentResolver, (c, moduleId): c is AnyIntentResolver => {
284
+ return module ? moduleId === module : true;
285
+ })
286
+ .flat(),
287
+ );
288
+
289
+ const manager = context.requestCapability(Capabilities.PluginManager);
290
+ state.dispatch = (intentChain, depth) => {
291
+ return Effect.gen(function* () {
292
+ yield* manager._activate(Events.SetupIntents);
293
+ return yield* dispatch(intentChain, depth);
294
+ });
295
+ };
296
+ state.dispatchPromise = async (intentChain) => {
297
+ await manager.activate(Events.SetupIntents);
298
+ return await dispatchPromise(intentChain);
282
299
  };
300
+ state.undo = undo;
301
+ state.undoPromise = undoPromise;
283
302
 
284
- return { dispatch, dispatchPromise, undo, undoPromise, registerResolver };
303
+ return contributes(Capabilities.IntentDispatcher, state);
285
304
  };
@@ -2,9 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { S } from '@dxos/echo-schema';
6
-
7
- import { INTENT_PLUGIN } from './meta';
5
+ import { Schema as S } from '@effect/schema';
8
6
 
9
7
  export type IntentParams = {
10
8
  readonly input: S.Schema.All;
@@ -27,9 +25,9 @@ export type Intent<Tag extends string, Fields extends IntentParams> = {
27
25
  _schema: IntentSchema<Tag, Fields>;
28
26
 
29
27
  /**
30
- * The action to perform.
28
+ * The id of the intent.
31
29
  */
32
- action: Tag;
30
+ id: Tag;
33
31
 
34
32
  /**
35
33
  * Any data needed to perform the desired action.
@@ -37,11 +35,11 @@ export type Intent<Tag extends string, Fields extends IntentParams> = {
37
35
  data: IntentData<Fields>;
38
36
 
39
37
  /**
40
- * Plugin ID.
41
- * If specified, the intent will be sent explicitly to the plugin.
38
+ * Module ID.
39
+ * If specified, the intent will be sent explicitly to the plugin module.
42
40
  * Otherwise, the intent will be sent to all plugins, in order and the first to resolve a non-null value will be used.
43
41
  */
44
- plugin?: string;
42
+ module?: string;
45
43
 
46
44
  /**
47
45
  * Whether or not the intent is being undone.
@@ -78,7 +76,7 @@ export type AnyIntentChain = IntentChain<any, any, any, any>;
78
76
  export const createIntent = <Tag extends string, Fields extends IntentParams>(
79
77
  schema: IntentSchema<Tag, Fields>,
80
78
  data: IntentData<Fields> = {},
81
- params: Pick<AnyIntent, 'plugin' | 'undo'> = {},
79
+ params: Pick<AnyIntent, 'module' | 'undo'> = {},
82
80
  ): IntentChain<Tag, Tag, Fields, Fields> => {
83
81
  // The output of validateSync breaks proxy objects so this is just used for validation.
84
82
  // TODO(wittjosiah): Is there a better way to make theses types align?
@@ -86,7 +84,7 @@ export const createIntent = <Tag extends string, Fields extends IntentParams>(
86
84
  const intent = {
87
85
  ...params,
88
86
  _schema: schema,
89
- action: schema._tag,
87
+ id: schema._tag,
90
88
  data,
91
89
  } satisfies Intent<Tag, Fields>;
92
90
 
@@ -114,7 +112,7 @@ export const chain =
114
112
  >(
115
113
  schema: IntentSchema<NextTag, NextFields>,
116
114
  data: Omit<IntentData<NextFields>, keyof IntentResultData<LastFields>> = {},
117
- params: Pick<AnyIntent, 'plugin' | 'undo'> = {},
115
+ params: Pick<AnyIntent, 'module' | 'undo'> = {},
118
116
  ) =>
119
117
  (
120
118
  intent: IntentChain<FirstTag, any, FirstFields, LastFields>,
@@ -124,7 +122,7 @@ export const chain =
124
122
  const last = {
125
123
  ...params,
126
124
  _schema: schema,
127
- action: schema._tag,
125
+ id: schema._tag,
128
126
  data,
129
127
  } satisfies Intent<NextTag, NextFields>;
130
128
 
@@ -146,17 +144,3 @@ export const Label = S.Union(
146
144
  S.mutable(S.Tuple(S.String, S.mutable(S.Struct({ ns: S.String, count: S.optional(S.Number) })))),
147
145
  );
148
146
  export type Label = S.Schema.Type<typeof Label>;
149
-
150
- export const INTENT_ACTION = `${INTENT_PLUGIN}/action`;
151
-
152
- export namespace IntentAction {
153
- /**
154
- * Fired after an intent is dispatched if the intent is undoable.
155
- */
156
- export class ShowUndo extends S.TaggedClass<ShowUndo>()(`${INTENT_ACTION}/show-undo`, {
157
- input: S.Struct({
158
- message: Label,
159
- }),
160
- output: S.Void,
161
- }) {}
162
- }
@@ -0,0 +1,35 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { SETTINGS_PLUGIN } from './actions';
6
+ import translations from './translations';
7
+ import { Capabilities, Events } from '../common';
8
+ import { contributes, defineModule, definePlugin, lazy } from '../core';
9
+
10
+ // TODO(wittjosiah): Add options to exclude some modules.
11
+ export const SettingsPlugin = () =>
12
+ definePlugin({ id: SETTINGS_PLUGIN }, [
13
+ defineModule({
14
+ id: `${SETTINGS_PLUGIN}/module/store`,
15
+ activatesOn: Events.Startup,
16
+ activatesBefore: [Events.SetupSettings],
17
+ activatesAfter: [Events.SettingsReady],
18
+ activate: lazy(() => import('./store')),
19
+ }),
20
+ defineModule({
21
+ id: `${SETTINGS_PLUGIN}/module/translations`,
22
+ activatesOn: Events.SetupTranslations,
23
+ activate: () => contributes(Capabilities.Translations, translations),
24
+ }),
25
+ defineModule({
26
+ id: `${SETTINGS_PLUGIN}/module/intent-resolver`,
27
+ activatesOn: Events.SetupIntents,
28
+ activate: lazy(() => import('./intent-resolver')),
29
+ }),
30
+ defineModule({
31
+ id: `${SETTINGS_PLUGIN}/module/app-graph-builder`,
32
+ activatesOn: Events.SetupAppGraph,
33
+ activate: lazy(() => import('./app-graph-builder')),
34
+ }),
35
+ ]);
@@ -0,0 +1,27 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { Schema as S } from '@effect/schema';
6
+
7
+ export const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';
8
+ export const SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;
9
+ export const SETTINGS_ID = 'dxos:settings';
10
+ export const SETTINGS_KEY = 'settings';
11
+
12
+ export namespace SettingsAction {
13
+ export class Open extends S.TaggedClass<Open>()(`${SETTINGS_ACTION}/open`, {
14
+ input: S.Struct({
15
+ plugin: S.optional(S.String),
16
+ }),
17
+ output: S.Void,
18
+ }) {}
19
+
20
+ export class OpenPluginRegistry extends S.TaggedClass<OpenPluginRegistry>()(
21
+ `${SETTINGS_ACTION}/open-plugin-registry`,
22
+ {
23
+ input: S.Void,
24
+ output: S.Void,
25
+ },
26
+ ) {}
27
+ }
@@ -0,0 +1,122 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { createExtension, type Node } from '@dxos/app-graph';
6
+ import { type SettingsStore, type SettingsValue } from '@dxos/local-storage';
7
+ import { nonNullable } from '@dxos/util';
8
+
9
+ import { SETTINGS_ID, SETTINGS_KEY, SETTINGS_PLUGIN, SettingsAction } from './actions';
10
+ import { Capabilities } from '../common';
11
+ import { contributes, type PluginMeta, type PluginsContext } from '../core';
12
+ import { createIntent } from '../plugin-intent';
13
+
14
+ export default (context: PluginsContext) =>
15
+ contributes(Capabilities.AppGraphBuilder, [
16
+ createExtension({
17
+ id: `${SETTINGS_PLUGIN}/action`,
18
+ filter: (node): node is Node<null> => node.id === 'root',
19
+ actions: () => [
20
+ {
21
+ id: SETTINGS_PLUGIN,
22
+ data: async () => {
23
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
24
+ await dispatch(createIntent(SettingsAction.Open));
25
+ },
26
+ properties: {
27
+ label: ['open settings label', { ns: SETTINGS_PLUGIN }],
28
+ icon: 'ph--gear--regular',
29
+ keyBinding: {
30
+ macos: 'meta+,',
31
+ windows: 'alt+,',
32
+ },
33
+ },
34
+ },
35
+ ],
36
+ }),
37
+ createExtension({
38
+ id: `${SETTINGS_PLUGIN}/core`,
39
+ filter: (node): node is Node<null> => node.id === 'root',
40
+ connector: () => [
41
+ {
42
+ id: SETTINGS_ID,
43
+ type: SETTINGS_PLUGIN,
44
+ properties: {
45
+ label: ['app settings label', { ns: SETTINGS_PLUGIN }],
46
+ icon: 'ph--gear--regular',
47
+ disposition: 'pin-end',
48
+ position: 'fallback',
49
+ testId: 'treeView.appSettings',
50
+ },
51
+ },
52
+ ],
53
+ }),
54
+ createExtension({
55
+ id: `${SETTINGS_PLUGIN}/core-plugins`,
56
+ filter: (node): node is Node<null> => node.id === SETTINGS_ID,
57
+ connector: () => {
58
+ const manager = context.requestCapability(Capabilities.PluginManager);
59
+ const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
60
+ return [
61
+ ...manager.plugins
62
+ .filter((plugin) => manager.core.includes(plugin.meta.id))
63
+ .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
64
+ const settings = settingsStore?.getStore(plugin.meta.id);
65
+ if (!settings) {
66
+ return null;
67
+ }
68
+
69
+ return [plugin.meta, settings];
70
+ })
71
+ .filter(nonNullable)
72
+ .map(([meta, settings]) => ({
73
+ id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
74
+ type: 'category',
75
+ data: settings,
76
+ properties: {
77
+ label: meta.name ?? meta.id,
78
+ icon: meta.icon ?? 'ph--circle--regular',
79
+ },
80
+ })),
81
+
82
+ {
83
+ id: `${SETTINGS_KEY}:custom-plugins`,
84
+ type: 'collection',
85
+ properties: {
86
+ label: ['custom plugins label', { ns: SETTINGS_PLUGIN }],
87
+ icon: 'ph--squares-four--regular',
88
+ role: 'branch',
89
+ },
90
+ },
91
+ ];
92
+ },
93
+ }),
94
+ createExtension({
95
+ id: `${SETTINGS_PLUGIN}/custom-plugins`,
96
+ filter: (node): node is Node<null> => node.id === `${SETTINGS_KEY}:custom-plugins`,
97
+ connector: () => {
98
+ const manager = context.requestCapability(Capabilities.PluginManager);
99
+ const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
100
+ return manager.plugins
101
+ .filter((plugin) => !manager.core.includes(plugin.meta.id))
102
+ .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
103
+ const settings = settingsStore?.getStore(plugin.meta.id);
104
+ if (!settings) {
105
+ return null;
106
+ }
107
+
108
+ return [plugin.meta, settings];
109
+ })
110
+ .filter(nonNullable)
111
+ .map(([meta, settings]) => ({
112
+ id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
113
+ type: 'category',
114
+ data: settings,
115
+ properties: {
116
+ label: meta.name ?? meta.id,
117
+ icon: meta.icon ?? 'ph--circle--regular',
118
+ },
119
+ }));
120
+ },
121
+ }),
122
+ ]);
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './actions';
6
+ export * from './SettingsPlugin';
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { pipe } from 'effect';
6
+
7
+ import { SETTINGS_ID, SETTINGS_KEY, SettingsAction } from './actions';
8
+ import { Capabilities, LayoutAction } from '../common';
9
+ import { contributes } from '../core';
10
+ import { createResolver, createIntent, chain } from '../plugin-intent';
11
+
12
+ export default () =>
13
+ contributes(
14
+ Capabilities.IntentResolver,
15
+ createResolver({
16
+ intent: SettingsAction.Open,
17
+ resolve: ({ plugin }) => {
18
+ return {
19
+ intents: [
20
+ pipe(
21
+ createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: SETTINGS_ID }),
22
+ chain(LayoutAction.Open, { part: 'main', subject: [`${SETTINGS_KEY}:${plugin.replaceAll('/', ':')}`] }),
23
+ ),
24
+ ],
25
+ };
26
+ },
27
+ }),
28
+ );