@dxos/app-framework 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/.storybook/main.mts +11 -0
  2. package/.storybook/preview.mts +8 -0
  3. package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
  4. package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
  5. package/dist/lib/browser/{app-graph-builder-LYF7EKNN.mjs → app-graph-builder-XH4OYQLC.mjs} +25 -25
  6. package/dist/lib/browser/app-graph-builder-XH4OYQLC.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-FMN65HSW.mjs → chunk-6V54SRFL.mjs} +388 -269
  8. package/dist/lib/browser/chunk-6V54SRFL.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-RGKMLI6U.mjs} +10 -7
  10. package/dist/lib/browser/chunk-RGKMLI6U.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-FO2PH7M3.mjs → chunk-ZZVFNUHZ.mjs} +189 -137
  12. package/dist/lib/browser/chunk-ZZVFNUHZ.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +20 -28
  14. package/dist/lib/browser/index.mjs.map +3 -3
  15. package/dist/lib/browser/{intent-dispatcher-LSYQZSEB.mjs → intent-dispatcher-VFMJVO2M.mjs} +2 -2
  16. package/dist/lib/browser/{intent-resolver-ZTNOSO3A.mjs → intent-resolver-ICAPD4JL.mjs} +5 -5
  17. package/dist/lib/browser/intent-resolver-ICAPD4JL.mjs.map +7 -0
  18. package/dist/lib/browser/meta.json +1 -1
  19. package/dist/lib/browser/{store-KML2R4IE.mjs → store-7ZGMHOGB.mjs} +4 -4
  20. package/dist/lib/browser/{store-KML2R4IE.mjs.map → store-7ZGMHOGB.mjs.map} +2 -2
  21. package/dist/lib/browser/testing/index.mjs +14 -19
  22. package/dist/lib/browser/testing/index.mjs.map +3 -3
  23. package/dist/lib/browser/worker.mjs +7 -9
  24. package/dist/lib/node-esm/{app-graph-builder-SAOWGJDK.mjs → app-graph-builder-C7H22SOL.mjs} +25 -25
  25. package/dist/lib/node-esm/app-graph-builder-C7H22SOL.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-73HGSHKE.mjs → chunk-AXSZKZFD.mjs} +189 -137
  27. package/dist/lib/node-esm/chunk-AXSZKZFD.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-LKPMRTRR.mjs} +10 -7
  29. package/dist/lib/node-esm/chunk-LKPMRTRR.mjs.map +7 -0
  30. package/dist/lib/node-esm/{chunk-ZEZ4FVEU.mjs → chunk-SOVTUUAY.mjs} +388 -269
  31. package/dist/lib/node-esm/chunk-SOVTUUAY.mjs.map +7 -0
  32. package/dist/lib/node-esm/index.mjs +20 -28
  33. package/dist/lib/node-esm/index.mjs.map +3 -3
  34. package/dist/lib/node-esm/{intent-dispatcher-6CYNGPSW.mjs → intent-dispatcher-SAPOKSLZ.mjs} +2 -2
  35. package/dist/lib/node-esm/{intent-resolver-W7Z7WFFM.mjs → intent-resolver-CRNJ6BMD.mjs} +5 -5
  36. package/dist/lib/node-esm/intent-resolver-CRNJ6BMD.mjs.map +7 -0
  37. package/dist/lib/node-esm/meta.json +1 -1
  38. package/dist/lib/node-esm/{store-QEXGXLWZ.mjs → store-H4F4RMYD.mjs} +4 -4
  39. package/dist/lib/node-esm/{store-QEXGXLWZ.mjs.map → store-H4F4RMYD.mjs.map} +2 -2
  40. package/dist/lib/node-esm/testing/index.mjs +14 -19
  41. package/dist/lib/node-esm/testing/index.mjs.map +3 -3
  42. package/dist/lib/node-esm/worker.mjs +7 -9
  43. package/dist/types/src/common/capabilities.d.ts +82 -8
  44. package/dist/types/src/common/capabilities.d.ts.map +1 -1
  45. package/dist/types/src/common/collaboration.d.ts +9 -8
  46. package/dist/types/src/common/collaboration.d.ts.map +1 -1
  47. package/dist/types/src/common/events.d.ts.map +1 -1
  48. package/dist/types/src/common/index.d.ts +1 -1
  49. package/dist/types/src/common/index.d.ts.map +1 -1
  50. package/dist/types/src/common/layout.d.ts +0 -2
  51. package/dist/types/src/common/layout.d.ts.map +1 -1
  52. package/dist/types/src/common/surface.d.ts +7 -13
  53. package/dist/types/src/common/surface.d.ts.map +1 -1
  54. package/dist/types/src/components/App.d.ts +10 -0
  55. package/dist/types/src/components/App.d.ts.map +1 -0
  56. package/dist/types/src/components/App.stories.d.ts +14 -0
  57. package/dist/types/src/components/App.stories.d.ts.map +1 -0
  58. package/dist/types/src/components/DefaultFallback.d.ts +8 -0
  59. package/dist/types/src/components/DefaultFallback.d.ts.map +1 -0
  60. package/dist/types/src/components/index.d.ts +2 -0
  61. package/dist/types/src/components/index.d.ts.map +1 -0
  62. package/dist/types/src/{App.d.ts → components/useApp.d.ts} +7 -6
  63. package/dist/types/src/components/useApp.d.ts.map +1 -0
  64. package/dist/types/src/components/useLoading.d.ts +19 -0
  65. package/dist/types/src/components/useLoading.d.ts.map +1 -0
  66. package/dist/types/src/core/capabilities.d.ts +4 -1
  67. package/dist/types/src/core/capabilities.d.ts.map +1 -1
  68. package/dist/types/src/core/manager.d.ts +6 -2
  69. package/dist/types/src/core/manager.d.ts.map +1 -1
  70. package/dist/types/src/core/plugin.d.ts +4 -1
  71. package/dist/types/src/core/plugin.d.ts.map +1 -1
  72. package/dist/types/src/index.d.ts +1 -1
  73. package/dist/types/src/index.d.ts.map +1 -1
  74. package/dist/types/src/playground/debug/Debug.d.ts +1 -1
  75. package/dist/types/src/playground/debug/plugin.d.ts +1 -1
  76. package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
  77. package/dist/types/src/playground/generator/Main.d.ts +1 -1
  78. package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
  79. package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
  80. package/dist/types/src/playground/generator/generator.d.ts +1 -1
  81. package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
  82. package/dist/types/src/playground/generator/plugin.d.ts +1 -1
  83. package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
  84. package/dist/types/src/playground/layout/Layout.d.ts +2 -2
  85. package/dist/types/src/playground/layout/plugin.d.ts +1 -1
  86. package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
  87. package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
  88. package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
  89. package/dist/types/src/playground/logger/plugin.d.ts +1 -1
  90. package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
  91. package/dist/types/src/playground/playground.stories.d.ts +5 -4
  92. package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
  93. package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
  94. package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
  95. package/dist/types/src/plugin-intent/actions.d.ts +4 -6
  96. package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
  97. package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
  98. package/dist/types/src/plugin-intent/index.d.ts +1 -0
  99. package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
  100. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +3 -3
  101. package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
  102. package/dist/types/src/plugin-intent/meta.d.ts +3 -0
  103. package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
  104. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
  105. package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
  106. package/dist/types/src/plugin-settings/actions.d.ts +4 -6
  107. package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
  108. package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
  109. package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
  110. package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
  111. package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
  112. package/dist/types/src/plugin-settings/meta.d.ts +3 -0
  113. package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
  114. package/dist/types/src/plugin-settings/store.d.ts +1 -1
  115. package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
  116. package/dist/types/src/plugin-settings/translations.d.ts +2 -1
  117. package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
  118. package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
  119. package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
  120. package/dist/types/src/react/IntentContext.d.ts.map +1 -1
  121. package/dist/types/src/react/Surface.d.ts +2 -2
  122. package/dist/types/src/react/Surface.d.ts.map +1 -1
  123. package/dist/types/src/react/Surface.stories.d.ts +6 -5
  124. package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
  125. package/dist/types/src/react/common.d.ts.map +1 -1
  126. package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
  127. package/dist/types/src/testing/withPluginManager.d.ts +6 -6
  128. package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
  129. package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
  130. package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
  131. package/dist/types/tsconfig.tsbuildinfo +1 -1
  132. package/moon.yml +4 -0
  133. package/package.json +37 -35
  134. package/src/common/capabilities.ts +106 -10
  135. package/src/common/collaboration.ts +5 -8
  136. package/src/common/events.ts +3 -1
  137. package/src/common/index.ts +1 -1
  138. package/src/common/layout.ts +2 -3
  139. package/src/common/surface.ts +15 -18
  140. package/src/components/App.stories.tsx +33 -0
  141. package/src/components/App.tsx +59 -0
  142. package/src/components/DefaultFallback.tsx +26 -0
  143. package/src/components/index.ts +5 -0
  144. package/src/{App.tsx → components/useApp.tsx} +24 -136
  145. package/src/components/useLoading.tsx +70 -0
  146. package/src/core/capabilities.test.ts +1 -1
  147. package/src/core/capabilities.ts +11 -6
  148. package/src/core/manager.test.ts +21 -20
  149. package/src/core/manager.ts +132 -54
  150. package/src/core/plugin.ts +8 -2
  151. package/src/helpers.test.ts +1 -1
  152. package/src/index.ts +1 -1
  153. package/src/playground/debug/Debug.tsx +1 -1
  154. package/src/playground/debug/plugin.ts +7 -8
  155. package/src/playground/generator/Toolbar.tsx +2 -1
  156. package/src/playground/generator/generator.ts +3 -3
  157. package/src/playground/generator/plugin.ts +12 -13
  158. package/src/playground/layout/plugin.ts +10 -9
  159. package/src/playground/logger/Toolbar.tsx +2 -1
  160. package/src/playground/logger/plugin.ts +30 -25
  161. package/src/playground/playground.stories.tsx +20 -16
  162. package/src/plugin-intent/IntentPlugin.ts +13 -13
  163. package/src/plugin-intent/actions.ts +3 -5
  164. package/src/plugin-intent/errors.ts +1 -0
  165. package/src/plugin-intent/index.ts +1 -0
  166. package/src/plugin-intent/intent-dispatcher.test.ts +1 -1
  167. package/src/plugin-intent/intent-dispatcher.ts +9 -8
  168. package/src/plugin-intent/meta.ts +10 -0
  169. package/src/plugin-settings/SettingsPlugin.ts +27 -28
  170. package/src/plugin-settings/actions.ts +8 -12
  171. package/src/plugin-settings/app-graph-builder.ts +14 -12
  172. package/src/plugin-settings/intent-resolver.ts +3 -2
  173. package/src/plugin-settings/meta.ts +10 -0
  174. package/src/plugin-settings/store.ts +1 -1
  175. package/src/plugin-settings/translations.ts +3 -3
  176. package/src/react/ErrorBoundary.tsx +24 -15
  177. package/src/react/IntentContext.tsx +3 -2
  178. package/src/react/Surface.stories.tsx +23 -18
  179. package/src/react/Surface.tsx +14 -5
  180. package/src/react/common.ts +2 -1
  181. package/src/react/useCapabilities.ts +2 -1
  182. package/src/testing/withPluginManager.stories.tsx +9 -5
  183. package/src/testing/withPluginManager.tsx +25 -29
  184. package/tsconfig.json +1 -8
  185. package/vitest.config.ts +8 -6
  186. package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
  187. package/dist/lib/browser/app-graph-builder-LYF7EKNN.mjs.map +0 -7
  188. package/dist/lib/browser/chunk-FMN65HSW.mjs.map +0 -7
  189. package/dist/lib/browser/chunk-FO2PH7M3.mjs.map +0 -7
  190. package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
  191. package/dist/lib/browser/intent-resolver-ZTNOSO3A.mjs.map +0 -7
  192. package/dist/lib/node-esm/app-graph-builder-SAOWGJDK.mjs.map +0 -7
  193. package/dist/lib/node-esm/chunk-73HGSHKE.mjs.map +0 -7
  194. package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
  195. package/dist/lib/node-esm/chunk-ZEZ4FVEU.mjs.map +0 -7
  196. package/dist/lib/node-esm/intent-resolver-W7Z7WFFM.mjs.map +0 -7
  197. package/dist/types/src/App.d.ts.map +0 -1
  198. /package/dist/lib/browser/{intent-dispatcher-LSYQZSEB.mjs.map → intent-dispatcher-VFMJVO2M.mjs.map} +0 -0
  199. /package/dist/lib/node-esm/{intent-dispatcher-6CYNGPSW.mjs.map → intent-dispatcher-SAPOKSLZ.mjs.map} +0 -0
package/moon.yml CHANGED
@@ -5,6 +5,7 @@ tags:
5
5
  - ts-build
6
6
  - ts-test
7
7
  - typedoc
8
+ - storybook
8
9
  tasks:
9
10
  compile:
10
11
  args:
@@ -12,3 +13,6 @@ tasks:
12
13
  - '--entryPoint=src/testing/index.ts'
13
14
  - '--entryPoint=src/worker.ts'
14
15
  - '--preactSignalTracking'
16
+ test:
17
+ inputs:
18
+ - .storybook/*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/app-framework",
3
- "version": "0.8.4-main.67995b8",
3
+ "version": "0.8.4-main.a4bbb77",
4
4
  "description": "A framework for building applications from composible plugins.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,22 +10,22 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
13
14
  "types": "./dist/types/src/index.d.ts",
14
15
  "browser": "./dist/lib/browser/index.mjs",
15
- "node": "./dist/lib/node-esm/index.mjs",
16
- "source": "./src/index.ts"
16
+ "node": "./dist/lib/node-esm/index.mjs"
17
17
  },
18
18
  "./testing": {
19
+ "source": "./src/testing/index.ts",
19
20
  "types": "./dist/types/src/testing/index.d.ts",
20
21
  "browser": "./dist/lib/browser/testing/index.mjs",
21
- "node": "./dist/lib/node-esm/testing/index.mjs",
22
- "source": "./src/testing/index.ts"
22
+ "node": "./dist/lib/node-esm/testing/index.mjs"
23
23
  },
24
24
  "./worker": {
25
+ "source": "./src/worker.ts",
25
26
  "types": "./dist/types/src/worker.d.ts",
26
27
  "browser": "./dist/lib/browser/worker.mjs",
27
- "node": "./dist/lib/node-esm/worker.mjs",
28
- "source": "./src/worker.ts"
28
+ "node": "./dist/lib/node-esm/worker.mjs"
29
29
  }
30
30
  },
31
31
  "types": "dist/types/src/index.d.ts",
@@ -40,43 +40,45 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
+ "@effect/ai": "0.29.1",
44
+ "@effect/experimental": "0.56.0",
43
45
  "@preact-signals/safe-react": "^0.9.0",
44
- "@preact/signals-core": "^1.9.0",
45
- "@dxos/ai": "0.8.4-main.67995b8",
46
- "@dxos/app-graph": "0.8.4-main.67995b8",
47
- "@dxos/async": "0.8.4-main.67995b8",
48
- "@dxos/client-protocol": "0.8.4-main.67995b8",
49
- "@dxos/blueprints": "0.8.4-main.67995b8",
50
- "@dxos/echo-schema": "0.8.4-main.67995b8",
51
- "@dxos/debug": "0.8.4-main.67995b8",
52
- "@dxos/functions": "0.8.4-main.67995b8",
53
- "@dxos/invariant": "0.8.4-main.67995b8",
54
- "@dxos/keys": "0.8.4-main.67995b8",
55
- "@dxos/local-storage": "0.8.4-main.67995b8",
56
- "@dxos/log": "0.8.4-main.67995b8",
57
- "@dxos/live-object": "0.8.4-main.67995b8",
58
- "@dxos/react-hooks": "0.8.4-main.67995b8",
59
- "@dxos/schema": "0.8.4-main.67995b8",
60
- "@dxos/util": "0.8.4-main.67995b8"
46
+ "@preact/signals-core": "^1.12.1",
47
+ "@dxos/app-graph": "0.8.4-main.a4bbb77",
48
+ "@dxos/ai": "0.8.4-main.a4bbb77",
49
+ "@dxos/blueprints": "0.8.4-main.a4bbb77",
50
+ "@dxos/debug": "0.8.4-main.a4bbb77",
51
+ "@dxos/echo-schema": "0.8.4-main.a4bbb77",
52
+ "@dxos/client-protocol": "0.8.4-main.a4bbb77",
53
+ "@dxos/async": "0.8.4-main.a4bbb77",
54
+ "@dxos/functions": "0.8.4-main.a4bbb77",
55
+ "@dxos/invariant": "0.8.4-main.a4bbb77",
56
+ "@dxos/keys": "0.8.4-main.a4bbb77",
57
+ "@dxos/live-object": "0.8.4-main.a4bbb77",
58
+ "@dxos/local-storage": "0.8.4-main.a4bbb77",
59
+ "@dxos/log": "0.8.4-main.a4bbb77",
60
+ "@dxos/schema": "0.8.4-main.a4bbb77",
61
+ "@dxos/react-hooks": "0.8.4-main.a4bbb77",
62
+ "@dxos/util": "0.8.4-main.a4bbb77"
61
63
  },
62
64
  "devDependencies": {
63
- "@effect-rx/rx-react": "0.38.0",
64
- "@effect/platform": "0.89.0",
65
- "@types/react": "~18.2.0",
66
- "effect": "3.17.0",
67
- "react": "~18.2.0",
65
+ "@effect-rx/rx-react": "0.42.4",
66
+ "@effect/platform": "0.92.1",
67
+ "@types/react": "~19.2.0",
68
+ "effect": "3.18.3",
69
+ "react": "~19.2.0",
68
70
  "typedoc": "0.28.1",
69
- "@dxos/echo-signals": "0.8.4-main.67995b8",
70
- "@dxos/random": "0.8.4-main.67995b8",
71
- "@dxos/react-ui": "0.8.4-main.67995b8",
72
- "@dxos/react-ui-syntax-highlighter": "0.8.4-main.67995b8",
73
- "@dxos/storybook-utils": "0.8.4-main.67995b8"
71
+ "@dxos/echo-signals": "0.8.4-main.a4bbb77",
72
+ "@dxos/random": "0.8.4-main.a4bbb77",
73
+ "@dxos/react-ui-syntax-highlighter": "0.8.4-main.a4bbb77",
74
+ "@dxos/storybook-utils": "0.8.4-main.a4bbb77",
75
+ "@dxos/react-ui": "0.8.4-main.a4bbb77"
74
76
  },
75
77
  "peerDependencies": {
76
78
  "@effect-rx/rx-react": "^0.34.1",
77
79
  "@effect/platform": "^0.80.12",
78
80
  "effect": "^3.13.3",
79
- "react": "~18.2.0"
81
+ "react": "^19.0.0"
80
82
  },
81
83
  "publishConfig": {
82
84
  "access": "public"
@@ -2,44 +2,75 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import { type Tool, type Toolkit } from '@effect/ai';
5
6
  import { type Registry } from '@effect-rx/rx-react';
6
- import { type Schema } from 'effect';
7
+ import { type Layer, type Schema } from 'effect';
7
8
  import { type FC, type PropsWithChildren } from 'react';
8
9
 
9
- import { type ExecutableTool } from '@dxos/ai';
10
- import { type GraphBuilder, type BuilderExtensions } from '@dxos/app-graph';
11
- import { type ArtifactDefinition } from '@dxos/blueprints';
10
+ import { type AiService, type AiServiceRouter } from '@dxos/ai';
11
+ import { type BuilderExtensions, type GraphBuilder } from '@dxos/app-graph';
12
+ import { type Blueprint } from '@dxos/blueprints';
12
13
  import { type Space } from '@dxos/client-protocol';
13
14
  import { type FunctionDefinition } from '@dxos/functions';
14
15
  import { type RootSettingsStore } from '@dxos/local-storage';
15
16
  import { type AnchoredTo } from '@dxos/schema';
16
17
 
18
+ import { type PluginManager, defineCapability } from '../core';
19
+ import { type AnyIntentResolver, type IntentContext } from '../plugin-intent';
20
+
17
21
  import { type FileInfo } from './file';
18
22
  import { type NodeSerializer } from './graph';
19
23
  import { type SurfaceDefinition } from './surface';
20
24
  import { type Resource } from './translations';
21
- import { type PluginManager, defineCapability } from '../core';
22
- import { type AnyIntentResolver, type IntentContext } from '../plugin-intent';
23
25
 
26
+ // TODO(burdon): Sort.
24
27
  export namespace Capabilities {
28
+ /**
29
+ * @category Capability
30
+ */
25
31
  export const Null = defineCapability<null>('dxos.org/app-framework/capability/null');
26
32
 
33
+ /**
34
+ * @category Capability
35
+ */
27
36
  export const PluginManager = defineCapability<PluginManager>('dxos.org/app-framework/capability/plugin-manager');
28
37
 
38
+ /**
39
+ * @category Capability
40
+ */
29
41
  export const RxRegistry = defineCapability<Registry.Registry>('dxos.org/app-framework/capability/rx-registry');
30
42
 
31
43
  export type ReactContext = Readonly<{ id: string; dependsOn?: string[]; context: FC<PropsWithChildren> }>;
44
+
45
+ /**
46
+ * @category Capability
47
+ */
32
48
  export const ReactContext = defineCapability<ReactContext>('dxos.org/app-framework/capability/react-context');
33
49
 
34
50
  export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;
51
+
52
+ /**
53
+ * @category Capability
54
+ */
35
55
  export const ReactRoot = defineCapability<ReactRoot>('dxos.org/app-framework/capability/react-root');
36
56
 
37
57
  export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];
58
+
59
+ /**
60
+ * @category Capability
61
+ */
38
62
  export const ReactSurface = defineCapability<ReactSurface>('dxos.org/app-framework/common/react-surface');
39
63
 
40
64
  export type IntentResolver = AnyIntentResolver | readonly AnyIntentResolver[];
65
+
66
+ /**
67
+ * @category Capability
68
+ */
41
69
  export const IntentResolver = defineCapability<IntentResolver>('dxos.org/app-framework/capability/intent-resolver');
42
70
 
71
+ /**
72
+ * @category Capability
73
+ */
43
74
  export const IntentDispatcher = defineCapability<IntentContext>(
44
75
  'dxos.org/app-framework/capability/intent-dispatcher',
45
76
  );
@@ -66,23 +97,41 @@ export namespace Capabilities {
66
97
  */
67
98
  scrollIntoView: string | undefined;
68
99
  }>;
100
+
101
+ /**
102
+ * @category Capability
103
+ */
69
104
  export const Layout = defineCapability<Layout>('dxos.org/app-framework/capability/layout');
70
105
 
71
- // TODO(burdon): Why array?
106
+ /**
107
+ * @category Capability
108
+ */
72
109
  export const Translations = defineCapability<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');
73
110
 
111
+ /**
112
+ * @category Capability
113
+ */
74
114
  export const AppGraph = defineCapability<Readonly<Pick<GraphBuilder, 'graph' | 'explore'>>>(
75
115
  'dxos.org/app-framework/capability/app-graph',
76
116
  );
77
117
 
118
+ /**
119
+ * @category Capability
120
+ */
78
121
  export const AppGraphBuilder = defineCapability<BuilderExtensions>(
79
122
  'dxos.org/app-framework/capability/app-graph-builder',
80
123
  );
81
124
 
125
+ /**
126
+ * @category Capability
127
+ */
82
128
  export const AppGraphSerializer = defineCapability<NodeSerializer[]>(
83
129
  'dxos.org/app-framework/capability/app-graph-serializer',
84
130
  );
85
131
 
132
+ /**
133
+ * @category Capability
134
+ */
86
135
  export const SettingsStore = defineCapability<RootSettingsStore>('dxos.org/app-framework/capability/settings-store');
87
136
 
88
137
  // TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.
@@ -93,26 +142,73 @@ export namespace Capabilities {
93
142
  schema: Schema.Schema.All;
94
143
  value?: Record<string, any>;
95
144
  };
145
+
146
+ /**
147
+ * @category Capability
148
+ */
96
149
  export const Settings = defineCapability<Settings>('dxos.org/app-framework/capability/settings');
97
150
 
98
151
  export type Metadata = Readonly<{ id: string; metadata: Record<string, any> }>;
152
+
153
+ /**
154
+ * @category Capability
155
+ */
99
156
  export const Metadata = defineCapability<Metadata>('dxos.org/app-framework/capability/metadata');
100
157
 
101
- export const Tools = defineCapability<ExecutableTool[]>('dxos.org/app-framework/capability/tools');
102
- export const ArtifactDefinition = defineCapability<ArtifactDefinition>(
103
- 'dxos.org/app-framework/capability/artifact-definition',
158
+ // TODO(dmaretskyi): Consider combining Toolkit and ToolkitHandler for type-safe context.
159
+
160
+ /**
161
+ * @category Capability
162
+ */
163
+ export const Toolkit = defineCapability<Toolkit.Any>('dxos.org/app-framework/capability/ai-toolkit');
164
+
165
+ /**
166
+ * @category Capability
167
+ */
168
+ export const ToolkitHandler = defineCapability<Layer.Layer<Tool.Handler<any>, never, never>>(
169
+ 'dxos.org/app-framework/capability/ai-toolkit-handler',
104
170
  );
105
171
 
172
+ /**
173
+ * @category Capability
174
+ */
175
+ export const BlueprintDefinition = defineCapability<Blueprint.Blueprint>(
176
+ 'dxos.org/app-framework/capability/blueprint-definition',
177
+ );
178
+
179
+ export type AiServiceLayer = Layer.Layer<AiService.AiService>;
180
+ export const AiServiceLayer = defineCapability<AiServiceLayer>(
181
+ 'dxos.org/app-framework/capability/ai-service-factory',
182
+ );
183
+
184
+ /**
185
+ * Plugins can contribute them to provide model resolvers.
186
+ */
187
+ export const AiModelResolver = defineCapability<Layer.Layer<AiServiceRouter.AiModelResolver>>(
188
+ 'dxos.org/app-framework/capability/ai-model-resolver',
189
+ );
190
+
191
+ /**
192
+ * @category Capability
193
+ */
106
194
  export const Functions = defineCapability<FunctionDefinition<any, any>[]>(
107
195
  'dxos.org/app-framework/capability/functions',
108
196
  );
109
197
 
110
198
  export type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;
199
+
200
+ /**
201
+ * @category Capability
202
+ */
111
203
  export const FileUploader = defineCapability<FileUploader>('dxos.org/app-framework/capability/file-uploader');
112
204
 
113
205
  type AnchorSort = {
114
206
  key: string;
115
207
  sort: (anchorA: AnchoredTo, anchorB: AnchoredTo) => number;
116
208
  };
209
+
210
+ /**
211
+ * @category Capability
212
+ */
117
213
  export const AnchorSort = defineCapability<AnchorSort>('dxos.org/app-framework/capability/anchor-sort');
118
214
  }
@@ -4,17 +4,14 @@
4
4
 
5
5
  import { Schema } from 'effect';
6
6
 
7
- import { Expando, Ref } from '@dxos/echo-schema';
7
+ import { DataType } from '@dxos/schema';
8
8
 
9
9
  export namespace CollaborationActions {
10
- export class InsertContent extends Schema.TaggedClass<InsertContent>()('assistant/intent-content', {
10
+ export class AcceptProposal extends Schema.TaggedClass<AcceptProposal>()('collaboration/accept-proposal', {
11
11
  input: Schema.Struct({
12
- target: Expando,
13
- object: Ref(Expando),
14
- at: Schema.optional(Schema.String),
15
- label: Schema.String.pipe(Schema.optional),
16
- }).annotations({
17
- description: 'Enables plugins to inject content blocks or references into a related entity.',
12
+ subject: Schema.Any,
13
+ anchor: Schema.String,
14
+ proposal: DataType.MessageBlock.Proposal,
18
15
  }),
19
16
  output: Schema.Void,
20
17
  }) {}
@@ -2,9 +2,10 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities } from './capabilities';
6
5
  import { defineEvent } from '../core';
7
6
 
7
+ import { Capabilities } from './capabilities';
8
+
8
9
  export namespace Events {
9
10
  /**
10
11
  * Fired when the app is started.
@@ -48,6 +49,7 @@ export namespace Events {
48
49
  /**
49
50
  * Fired to load any newly available artifacts definitions.
50
51
  */
52
+ // TODO(burdon): Rename.
51
53
  export const SetupArtifactDefinition = defineEvent('dxos.org/app-framework/event/setup-artifact-definition');
52
54
 
53
55
  //
@@ -6,7 +6,7 @@ export * from './capabilities';
6
6
  export * from './collaboration';
7
7
  export * from './events';
8
8
  export * from './file';
9
- export type * from './graph';
9
+ export * from './graph';
10
10
  export * from './layout';
11
11
  export * from './surface';
12
12
  export * from './translations';
@@ -6,14 +6,13 @@ import { Schema } from 'effect';
6
6
 
7
7
  import { Label } from '../plugin-intent';
8
8
 
9
- export const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';
10
- export const LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
9
+ const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';
11
10
 
12
11
  /**
13
12
  * Expected payload for layout actions.
14
13
  */
15
14
  export namespace LayoutAction {
16
- export const UPDATE_LAYOUT = `${LAYOUT_ACTION}/update-layout`;
15
+ export const UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
17
16
 
18
17
  /**
19
18
  * Generic layout action.
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type JSX, type ForwardedRef, type PropsWithChildren, type ReactNode } from 'react';
5
+ import type { ComponentType, PropsWithChildren, ReactNode } from 'react';
6
6
 
7
7
  import { type GuardedType, type MakeOptional, type Position } from '@dxos/util';
8
8
 
@@ -11,7 +11,7 @@ import { type ErrorBoundary } from '../react';
11
11
  /**
12
12
  * SurfaceProps are the props that are passed to the Surface component.
13
13
  */
14
- export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{
14
+ export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {
15
15
  /**
16
16
  * If specified, the Surface will be wrapped in an error boundary.
17
17
  * The fallback component will be rendered if an error occurs.
@@ -23,17 +23,16 @@ export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>
23
23
  * The placeholder component will be rendered while the surface component is loading.
24
24
  */
25
25
  placeholder?: ReactNode;
26
- }> &
27
- MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> & {
28
- /**
29
- * Additional props to pass to the component.
30
- * These props are not used by Surface itself but may be used by components which resolve the surface.
31
- */
32
- [key: string]: unknown;
26
+ } & MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> &
27
+ // Additional props to pass to the component.
28
+ // These props are not used by Surface itself but may be used by components which resolve the surface.
29
+ // Exclude known prop names to prevent overriding well-defined props.
30
+ {
31
+ [K in keyof Record<string, any>]: K extends keyof CoreSurfaceProps<T> | 'fallback' | 'placeholder' ? never : any;
33
32
  };
34
33
 
35
34
  // NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.
36
- type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {
35
+ type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{
37
36
  /**
38
37
  * ID for debugging.
39
38
  */
@@ -53,19 +52,17 @@ type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> =
53
52
  * If more than one component is resolved, the limit determines how many are rendered.
54
53
  */
55
54
  limit?: number | undefined;
56
- };
55
+ }>;
57
56
 
58
- type SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<
59
- CoreSurfaceProps<T> & { [key: string]: unknown }
60
- >;
57
+ type SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = CoreSurfaceProps<T> &
58
+ Record<string, any>;
61
59
 
62
60
  /**
63
61
  * React component used to render a surface once is has matched.
64
62
  */
65
- export type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = (
66
- props: SurfaceComponentProps<T>,
67
- forwardedRef: ForwardedRef<HTMLElement>,
68
- ) => JSX.Element | null;
63
+ export type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = ComponentType<
64
+ SurfaceComponentProps<T>
65
+ >;
69
66
 
70
67
  /**
71
68
  * Definition of when a SurfaceComponent should be rendered.
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React from 'react';
7
+
8
+ import { withTheme } from '@dxos/react-ui/testing';
9
+
10
+ import { useApp } from './useApp';
11
+
12
+ const DefaultStory = () => {
13
+ const App = useApp({
14
+ placeholder: () => <div className='fixed inset-0 flex items-center justify-center'>Loading...</div>,
15
+ });
16
+
17
+ return <App />;
18
+ };
19
+
20
+ const meta = {
21
+ title: 'sdk/app-framework/App',
22
+ render: DefaultStory,
23
+ decorators: [withTheme],
24
+ parameters: {
25
+ layout: 'fullscreen',
26
+ },
27
+ } satisfies Meta;
28
+
29
+ export default meta;
30
+
31
+ type Story = StoryObj<typeof meta>;
32
+
33
+ export const Default: Story = {};
@@ -0,0 +1,59 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React, { type PropsWithChildren } from 'react';
6
+
7
+ import { Capabilities } from '../common';
8
+ import { topologicalSort } from '../helpers';
9
+ import { useCapabilities } from '../react';
10
+
11
+ import { type UseAppOptions } from './useApp';
12
+ import { LoadingState, useLoading } from './useLoading';
13
+
14
+ export type AppProps = Pick<UseAppOptions, 'placeholder' | 'debounce'> & {
15
+ state: { ready: boolean; error: unknown };
16
+ };
17
+
18
+ export const App = ({ placeholder: Placeholder, state, debounce }: AppProps) => {
19
+ const reactContexts = useCapabilities(Capabilities.ReactContext);
20
+ const reactRoots = useCapabilities(Capabilities.ReactRoot);
21
+ const stage = useLoading(state, debounce);
22
+
23
+ if (state.error) {
24
+ // This triggers the error boundary to provide UI feedback for the startup error.
25
+ throw state.error;
26
+ }
27
+
28
+ // TODO(wittjosiah): Consider using Suspense instead.
29
+ if (stage < LoadingState.Done) {
30
+ if (!Placeholder) {
31
+ return null;
32
+ }
33
+
34
+ return <Placeholder stage={stage} />;
35
+ }
36
+
37
+ const ComposedContext = composeContexts(reactContexts);
38
+ return (
39
+ <ComposedContext>
40
+ {reactRoots.map(({ id, root: Component }) => (
41
+ <Component key={id} />
42
+ ))}
43
+ </ComposedContext>
44
+ );
45
+ };
46
+
47
+ const composeContexts = (contexts: Capabilities.ReactContext[]) => {
48
+ if (contexts.length === 0) {
49
+ return ({ children }: PropsWithChildren) => <>{children}</>;
50
+ }
51
+
52
+ return topologicalSort(contexts)
53
+ .map(({ context }) => context)
54
+ .reduce((Acc, Next) => ({ children }) => (
55
+ <Acc>
56
+ <Next>{children}</Next>
57
+ </Acc>
58
+ ));
59
+ };
@@ -0,0 +1,26 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ /**
8
+ * NOTE: Default fallback should not use tailwind or theme.
9
+ */
10
+ export const DefaultFallback = ({ error }: { error: Error }) => {
11
+ return (
12
+ <div
13
+ style={{
14
+ margin: '1rem',
15
+ padding: '1rem',
16
+ overflow: 'hidden',
17
+ border: '4px solid teal',
18
+ borderRadius: '1rem',
19
+ }}
20
+ >
21
+ {/* TODO(wittjosiah): Link to docs for replacing default. */}
22
+ <h1 style={{ margin: '0.5rem 0', fontSize: '1.2rem' }}>[ERROR]: {error.message}</h1>
23
+ <pre style={{ overflow: 'auto', fontSize: '1rem', whiteSpace: 'pre-wrap', color: '#888888' }}>{error.stack}</pre>
24
+ </div>
25
+ );
26
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export * from './useApp';