@dxos/plugin-automation 0.8.4-main.e098934 → 0.8.4-main.ead640a

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 (177) hide show
  1. package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +11 -0
  2. package/dist/lib/browser/AutomationSettings-OQERZHTG.mjs +69 -0
  3. package/dist/lib/browser/AutomationSettings-OQERZHTG.mjs.map +7 -0
  4. package/dist/lib/browser/{FunctionsContainer-U4HASI4P.mjs → FunctionsContainer-V3OM6BFC.mjs} +7 -7
  5. package/dist/lib/browser/FunctionsContainer-V3OM6BFC.mjs.map +7 -0
  6. package/dist/lib/browser/{FunctionsPanel-I443Y6KB.mjs → FunctionsPanel-PTFCCUTB.mjs} +3 -3
  7. package/dist/lib/browser/{app-graph-builder-4OFKIRAI.mjs → app-graph-builder-DV5HMFX4.mjs} +10 -9
  8. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-2AOFK5FW.mjs +14 -0
  10. package/dist/lib/browser/chunk-2AOFK5FW.mjs.map +7 -0
  11. package/dist/lib/browser/chunk-5ARH77PV.mjs +15 -0
  12. package/dist/lib/browser/chunk-5ARH77PV.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-Z5DT4MHW.mjs → chunk-DK7R2HNC.mjs} +20 -7
  14. package/dist/lib/browser/chunk-DK7R2HNC.mjs.map +7 -0
  15. package/dist/lib/browser/chunk-MVPRI3DB.mjs +53 -0
  16. package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +7 -0
  17. package/dist/lib/browser/chunk-QACR4BJ7.mjs +14 -0
  18. package/dist/lib/browser/chunk-QACR4BJ7.mjs.map +7 -0
  19. package/dist/lib/browser/{chunk-S4SM663I.mjs → chunk-SUKAEYF3.mjs} +55 -18
  20. package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +7 -0
  21. package/dist/lib/browser/{chunk-HN7OHFCB.mjs → chunk-VGBZKM3O.mjs} +3 -3
  22. package/dist/lib/browser/chunk-VGBZKM3O.mjs.map +7 -0
  23. package/dist/lib/browser/{chunk-4TWQV33E.mjs → chunk-VL3KSDVL.mjs} +57 -17
  24. package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +7 -0
  25. package/dist/lib/browser/{chunk-GW5U2DGT.mjs → chunk-WWURMV25.mjs} +2 -4
  26. package/dist/lib/browser/chunk-WWURMV25.mjs.map +7 -0
  27. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +160 -0
  28. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +7 -0
  29. package/dist/lib/browser/hooks/index.mjs +12 -0
  30. package/dist/lib/browser/index.mjs +35 -14
  31. package/dist/lib/browser/index.mjs.map +4 -4
  32. package/dist/lib/browser/{intent-resolver-4PSYSQQG.mjs → intent-resolver-D2OHKQRR.mjs} +5 -5
  33. package/dist/lib/browser/{intent-resolver-4PSYSQQG.mjs.map → intent-resolver-D2OHKQRR.mjs.map} +1 -1
  34. package/dist/lib/browser/meta.json +1 -1
  35. package/dist/lib/browser/{react-surface-M52XGLXY.mjs → react-surface-POLPITTD.mjs} +18 -19
  36. package/dist/lib/browser/react-surface-POLPITTD.mjs.map +7 -0
  37. package/dist/lib/browser/types/index.mjs +2 -2
  38. package/dist/lib/node-esm/{AutomationPanel-MKOLA2FE.mjs → AutomationPanel-EETYIR35.mjs} +4 -4
  39. package/dist/lib/node-esm/AutomationSettings-MCB7HK3O.mjs +70 -0
  40. package/dist/lib/node-esm/AutomationSettings-MCB7HK3O.mjs.map +7 -0
  41. package/dist/lib/node-esm/{FunctionsContainer-VZIVURH6.mjs → FunctionsContainer-UGODP6YP.mjs} +7 -7
  42. package/dist/lib/node-esm/FunctionsContainer-UGODP6YP.mjs.map +7 -0
  43. package/dist/lib/node-esm/{FunctionsPanel-ELINCXPW.mjs → FunctionsPanel-JQFBRVOC.mjs} +3 -3
  44. package/dist/lib/node-esm/FunctionsPanel-JQFBRVOC.mjs.map +7 -0
  45. package/dist/lib/node-esm/{app-graph-builder-555IHYOB.mjs → app-graph-builder-TR2WXPX2.mjs} +10 -9
  46. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-NK5N3QKD.mjs → chunk-5MQJPJR2.mjs} +2 -4
  48. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-AONUBWBE.mjs → chunk-AKHETVIQ.mjs} +57 -17
  50. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +7 -0
  51. package/dist/lib/node-esm/{chunk-OEZNHUL2.mjs → chunk-CJUI6AKX.mjs} +3 -3
  52. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs.map +7 -0
  53. package/dist/lib/node-esm/{chunk-CX2AILIS.mjs → chunk-G72KHW5A.mjs} +20 -7
  54. package/dist/lib/node-esm/chunk-G72KHW5A.mjs.map +7 -0
  55. package/dist/lib/node-esm/{chunk-ZOJVKPCA.mjs → chunk-J3XEBEIE.mjs} +55 -18
  56. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +7 -0
  57. package/dist/lib/node-esm/chunk-LB7UQ4SK.mjs +16 -0
  58. package/dist/lib/node-esm/chunk-LB7UQ4SK.mjs.map +7 -0
  59. package/dist/lib/node-esm/chunk-QCA543ZR.mjs +54 -0
  60. package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +7 -0
  61. package/dist/lib/node-esm/chunk-TXFXIA34.mjs +16 -0
  62. package/dist/lib/node-esm/chunk-TXFXIA34.mjs.map +7 -0
  63. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs +16 -0
  64. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +7 -0
  65. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +161 -0
  66. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +7 -0
  67. package/dist/lib/node-esm/hooks/index.mjs +13 -0
  68. package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
  69. package/dist/lib/node-esm/index.mjs +35 -14
  70. package/dist/lib/node-esm/index.mjs.map +4 -4
  71. package/dist/lib/node-esm/{intent-resolver-6ZGBUILG.mjs → intent-resolver-2LGBVXT5.mjs} +5 -5
  72. package/dist/lib/node-esm/{intent-resolver-6ZGBUILG.mjs.map → intent-resolver-2LGBVXT5.mjs.map} +1 -1
  73. package/dist/lib/node-esm/meta.json +1 -1
  74. package/dist/lib/node-esm/{react-surface-Y6AOXM75.mjs → react-surface-5ULTTXAZ.mjs} +18 -19
  75. package/dist/lib/node-esm/react-surface-5ULTTXAZ.mjs.map +7 -0
  76. package/dist/lib/node-esm/types/index.mjs +2 -2
  77. package/dist/types/src/AutomationPlugin.d.ts +1 -1
  78. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  79. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  80. package/dist/types/src/capabilities/capabilities.d.ts +19 -0
  81. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  82. package/dist/types/src/capabilities/compute-runtime.d.ts +5 -0
  83. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -0
  84. package/dist/types/src/capabilities/index.d.ts +2 -0
  85. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  86. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  87. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  88. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +3 -1
  89. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  90. package/dist/types/src/components/AutomationSettings.d.ts +5 -0
  91. package/dist/types/src/components/AutomationSettings.d.ts.map +1 -0
  92. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  93. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  94. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  95. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +4 -2
  96. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  97. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +7 -4
  98. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  99. package/dist/types/src/components/TriggerSettings.d.ts +6 -0
  100. package/dist/types/src/components/TriggerSettings.d.ts.map +1 -0
  101. package/dist/types/src/components/index.d.ts +1 -1
  102. package/dist/types/src/components/index.d.ts.map +1 -1
  103. package/dist/types/src/events.d.ts +4 -0
  104. package/dist/types/src/events.d.ts.map +1 -0
  105. package/dist/types/src/hooks/index.d.ts +3 -0
  106. package/dist/types/src/hooks/index.d.ts.map +1 -0
  107. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +8 -0
  108. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -0
  109. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +11 -0
  110. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
  111. package/dist/types/src/index.d.ts +2 -0
  112. package/dist/types/src/index.d.ts.map +1 -1
  113. package/dist/types/src/meta.d.ts +0 -1
  114. package/dist/types/src/meta.d.ts.map +1 -1
  115. package/dist/types/src/translations.d.ts +3 -0
  116. package/dist/types/src/translations.d.ts.map +1 -1
  117. package/dist/types/src/types/schema.d.ts +1 -1
  118. package/dist/types/src/types/schema.d.ts.map +1 -1
  119. package/dist/types/tsconfig.tsbuildinfo +1 -1
  120. package/package.json +58 -37
  121. package/src/AutomationPlugin.tsx +35 -29
  122. package/src/capabilities/app-graph-builder.ts +8 -7
  123. package/src/capabilities/capabilities.ts +48 -0
  124. package/src/capabilities/compute-runtime.ts +138 -0
  125. package/src/capabilities/index.ts +3 -0
  126. package/src/capabilities/react-surface.tsx +13 -14
  127. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +3 -6
  128. package/src/components/AutomationPanel/AutomationPanel.tsx +78 -15
  129. package/src/components/{AutomationContainer.tsx → AutomationSettings.tsx} +8 -6
  130. package/src/components/FunctionsContainer.tsx +4 -4
  131. package/src/components/FunctionsPanel/FunctionsPanel.tsx +16 -4
  132. package/src/components/TriggerEditor/FunctionInputEditor.tsx +8 -2
  133. package/src/components/TriggerEditor/SpecSelector.tsx +10 -4
  134. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +57 -18
  135. package/src/components/TriggerEditor/TriggerEditor.tsx +35 -9
  136. package/src/components/TriggerSettings.tsx +25 -0
  137. package/src/components/index.ts +1 -1
  138. package/src/events.ts +11 -0
  139. package/src/hooks/index.ts +6 -0
  140. package/src/hooks/useComputeRuntimeCallback.ts +30 -0
  141. package/src/hooks/useTriggerRuntimeControls.ts +52 -0
  142. package/src/index.ts +2 -0
  143. package/src/meta.ts +1 -3
  144. package/src/testing/test-functions.ts +1 -1
  145. package/src/translations.ts +5 -0
  146. package/src/types/schema.ts +1 -1
  147. package/dist/lib/browser/AutomationContainer-BRV5AJZ3.mjs +0 -35
  148. package/dist/lib/browser/AutomationContainer-BRV5AJZ3.mjs.map +0 -7
  149. package/dist/lib/browser/AutomationPanel-N5HFJJXW.mjs +0 -11
  150. package/dist/lib/browser/FunctionsContainer-U4HASI4P.mjs.map +0 -7
  151. package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs.map +0 -7
  152. package/dist/lib/browser/chunk-4TWQV33E.mjs.map +0 -7
  153. package/dist/lib/browser/chunk-EIY2EUWC.mjs +0 -14
  154. package/dist/lib/browser/chunk-EIY2EUWC.mjs.map +0 -7
  155. package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
  156. package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +0 -7
  157. package/dist/lib/browser/chunk-S4SM663I.mjs.map +0 -7
  158. package/dist/lib/browser/chunk-Z5DT4MHW.mjs.map +0 -7
  159. package/dist/lib/browser/react-surface-M52XGLXY.mjs.map +0 -7
  160. package/dist/lib/node-esm/AutomationContainer-FYRDTERM.mjs +0 -36
  161. package/dist/lib/node-esm/AutomationContainer-FYRDTERM.mjs.map +0 -7
  162. package/dist/lib/node-esm/FunctionsContainer-VZIVURH6.mjs.map +0 -7
  163. package/dist/lib/node-esm/app-graph-builder-555IHYOB.mjs.map +0 -7
  164. package/dist/lib/node-esm/chunk-AONUBWBE.mjs.map +0 -7
  165. package/dist/lib/node-esm/chunk-CICQ73ZT.mjs +0 -16
  166. package/dist/lib/node-esm/chunk-CICQ73ZT.mjs.map +0 -7
  167. package/dist/lib/node-esm/chunk-CX2AILIS.mjs.map +0 -7
  168. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
  169. package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +0 -7
  170. package/dist/lib/node-esm/chunk-ZOJVKPCA.mjs.map +0 -7
  171. package/dist/lib/node-esm/react-surface-Y6AOXM75.mjs.map +0 -7
  172. package/dist/types/src/components/AutomationContainer.d.ts +0 -5
  173. package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
  174. /package/dist/lib/browser/{AutomationPanel-N5HFJJXW.mjs.map → AutomationPanel-3PHA5FTJ.mjs.map} +0 -0
  175. /package/dist/lib/browser/{FunctionsPanel-I443Y6KB.mjs.map → FunctionsPanel-PTFCCUTB.mjs.map} +0 -0
  176. /package/dist/lib/{node-esm/AutomationPanel-MKOLA2FE.mjs.map → browser/hooks/index.mjs.map} +0 -0
  177. /package/dist/lib/node-esm/{FunctionsPanel-ELINCXPW.mjs.map → AutomationPanel-EETYIR35.mjs.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-automation",
3
- "version": "0.8.4-main.e098934",
3
+ "version": "0.8.4-main.ead640a",
4
4
  "description": "Prompt chain plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -15,6 +15,12 @@
15
15
  "browser": "./dist/lib/browser/index.mjs",
16
16
  "node": "./dist/lib/node-esm/index.mjs"
17
17
  },
18
+ "./hooks": {
19
+ "source": "./src/hooks/index.ts",
20
+ "types": "./dist/types/src/hooks/index.d.ts",
21
+ "browser": "./dist/lib/browser/hooks/index.mjs",
22
+ "node": "./dist/lib/node-esm/hooks/index.mjs"
23
+ },
18
24
  "./types": {
19
25
  "source": "./src/types/index.ts",
20
26
  "types": "./dist/types/src/types/index.d.ts",
@@ -24,7 +30,14 @@
24
30
  },
25
31
  "types": "dist/types/src/index.d.ts",
26
32
  "typesVersions": {
27
- "*": {}
33
+ "*": {
34
+ "hooks": [
35
+ "dist/types/src/hooks/index.d.ts"
36
+ ],
37
+ "types": [
38
+ "dist/types/src/types/index.d.ts"
39
+ ]
40
+ }
28
41
  },
29
42
  "files": [
30
43
  "assets",
@@ -32,49 +45,57 @@
32
45
  "src"
33
46
  ],
34
47
  "dependencies": {
48
+ "@effect/ai": "0.29.1",
49
+ "@effect/platform-browser": "0.72.0",
35
50
  "@preact-signals/safe-react": "^0.9.0",
36
- "@preact/signals-core": "^1.9.0",
37
- "@dxos/app-framework": "0.8.4-main.e098934",
38
- "@dxos/async": "0.8.4-main.e098934",
39
- "@dxos/conductor": "0.8.4-main.e098934",
40
- "@dxos/echo": "0.8.4-main.e098934",
41
- "@dxos/echo-schema": "0.8.4-main.e098934",
42
- "@dxos/functions": "0.8.4-main.e098934",
43
- "@dxos/invariant": "0.8.4-main.e098934",
44
- "@dxos/live-object": "0.8.4-main.e098934",
45
- "@dxos/log": "0.8.4-main.e098934",
46
- "@dxos/plugin-client": "0.8.4-main.e098934",
47
- "@dxos/plugin-graph": "0.8.4-main.e098934",
48
- "@dxos/plugin-space": "0.8.4-main.e098934",
49
- "@dxos/random": "0.8.4-main.e098934",
50
- "@dxos/react-client": "0.8.4-main.e098934",
51
- "@dxos/react-ui-list": "0.8.4-main.e098934",
52
- "@dxos/plugin-deck": "0.8.4-main.e098934",
53
- "@dxos/react-ui-form": "0.8.4-main.e098934",
54
- "@dxos/react-ui-stack": "0.8.4-main.e098934",
55
- "@dxos/util": "0.8.4-main.e098934"
51
+ "@preact/signals-core": "^1.12.1",
52
+ "@dxos/async": "0.8.4-main.ead640a",
53
+ "@dxos/assistant": "0.8.4-main.ead640a",
54
+ "@dxos/ai": "0.8.4-main.ead640a",
55
+ "@dxos/conductor": "0.8.4-main.ead640a",
56
+ "@dxos/context": "0.8.4-main.ead640a",
57
+ "@dxos/app-framework": "0.8.4-main.ead640a",
58
+ "@dxos/functions": "0.8.4-main.ead640a",
59
+ "@dxos/invariant": "0.8.4-main.ead640a",
60
+ "@dxos/keys": "0.8.4-main.ead640a",
61
+ "@dxos/echo": "0.8.4-main.ead640a",
62
+ "@dxos/live-object": "0.8.4-main.ead640a",
63
+ "@dxos/log": "0.8.4-main.ead640a",
64
+ "@dxos/plugin-deck": "0.8.4-main.ead640a",
65
+ "@dxos/plugin-graph": "0.8.4-main.ead640a",
66
+ "@dxos/plugin-client": "0.8.4-main.ead640a",
67
+ "@dxos/random": "0.8.4-main.ead640a",
68
+ "@dxos/react-client": "0.8.4-main.ead640a",
69
+ "@dxos/react-ui-components": "0.8.4-main.ead640a",
70
+ "@dxos/react-ui-editor": "0.8.4-main.ead640a",
71
+ "@dxos/react-ui-list": "0.8.4-main.ead640a",
72
+ "@dxos/react-ui-form": "0.8.4-main.ead640a",
73
+ "@dxos/plugin-space": "0.8.4-main.ead640a",
74
+ "@dxos/react-ui-stack": "0.8.4-main.ead640a",
75
+ "@dxos/schema": "0.8.4-main.ead640a",
76
+ "@dxos/util": "0.8.4-main.ead640a"
56
77
  },
57
78
  "devDependencies": {
58
- "@effect-rx/rx-react": "0.38.0",
59
- "@effect/platform": "0.90.2",
60
- "@types/react": "~18.2.0",
61
- "@types/react-dom": "~18.2.0",
62
- "effect": "3.17.7",
63
- "react": "~18.2.0",
64
- "react-dom": "~18.2.0",
65
- "vite": "7.1.1",
66
- "@dxos/react-ui": "0.8.4-main.e098934",
67
- "@dxos/storybook-utils": "0.8.4-main.e098934",
68
- "@dxos/react-ui-theme": "0.8.4-main.e098934"
79
+ "@effect-rx/rx-react": "0.42.4",
80
+ "@effect/platform": "0.92.1",
81
+ "@types/react": "~19.2.2",
82
+ "@types/react-dom": "~19.2.1",
83
+ "effect": "3.18.3",
84
+ "react": "~19.2.0",
85
+ "react-dom": "~19.2.0",
86
+ "vite": "7.1.9",
87
+ "@dxos/react-ui": "0.8.4-main.ead640a",
88
+ "@dxos/storybook-utils": "0.8.4-main.ead640a",
89
+ "@dxos/react-ui-theme": "0.8.4-main.ead640a"
69
90
  },
70
91
  "peerDependencies": {
71
92
  "@effect-rx/rx-react": "^0.34.1",
72
93
  "@effect/platform": "^0.80.12",
73
94
  "effect": "^3.13.3",
74
- "react": "~18.2.0",
75
- "react-dom": "~18.2.0",
76
- "@dxos/react-ui": "0.8.4-main.e098934",
77
- "@dxos/react-ui-theme": "0.8.4-main.e098934"
95
+ "react": "^19.0.0",
96
+ "react-dom": "^19.0.0",
97
+ "@dxos/react-ui": "0.8.4-main.ead640a",
98
+ "@dxos/react-ui-theme": "0.8.4-main.ead640a"
78
99
  },
79
100
  "publishConfig": {
80
101
  "access": "public"
@@ -6,35 +6,41 @@ import { Capabilities, Events, contributes, defineModule, definePlugin } from '@
6
6
  import { FunctionTrigger, FunctionType } from '@dxos/functions';
7
7
  import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
8
8
 
9
- import { AppGraphBuilder, IntentResolver, ReactSurface } from './capabilities';
9
+ import { AppGraphBuilder, ComputeRuntime, IntentResolver, ReactSurface } from './capabilities';
10
+ import { AutomationEvents } from './events';
10
11
  import { meta } from './meta';
11
12
  import { translations } from './translations';
12
13
 
13
- export const AutomationPlugin = () =>
14
- definePlugin(meta, [
15
- defineModule({
16
- id: `${meta.id}/module/translations`,
17
- activatesOn: Events.SetupTranslations,
18
- activate: () => contributes(Capabilities.Translations, translations),
19
- }),
20
- defineModule({
21
- id: `${meta.id}/module/schema`,
22
- activatesOn: ClientEvents.SetupSchema,
23
- activate: () => contributes(ClientCapabilities.Schema, [FunctionType, FunctionTrigger]),
24
- }),
25
- defineModule({
26
- id: `${meta.id}/module/app-graph-builder`,
27
- activatesOn: Events.SetupAppGraph,
28
- activate: AppGraphBuilder,
29
- }),
30
- defineModule({
31
- id: `${meta.id}/module/intent-resolver`,
32
- activatesOn: Events.SetupIntentResolver,
33
- activate: IntentResolver,
34
- }),
35
- defineModule({
36
- id: `${meta.id}/module/react-surface`,
37
- activatesOn: Events.SetupReactSurface,
38
- activate: ReactSurface,
39
- }),
40
- ]);
14
+ export const AutomationPlugin = definePlugin(meta, () => [
15
+ defineModule({
16
+ id: `${meta.id}/module/translations`,
17
+ activatesOn: Events.SetupTranslations,
18
+ activate: () => contributes(Capabilities.Translations, translations),
19
+ }),
20
+ defineModule({
21
+ id: `${meta.id}/module/schema`,
22
+ activatesOn: ClientEvents.SetupSchema,
23
+ activate: () => contributes(ClientCapabilities.Schema, [FunctionType, FunctionTrigger]),
24
+ }),
25
+ defineModule({
26
+ id: `${meta.id}/module/app-graph-builder`,
27
+ activatesOn: Events.SetupAppGraph,
28
+ activate: AppGraphBuilder,
29
+ }),
30
+ defineModule({
31
+ id: `${meta.id}/module/intent-resolver`,
32
+ activatesOn: Events.SetupIntentResolver,
33
+ activate: IntentResolver,
34
+ }),
35
+ defineModule({
36
+ id: `${meta.id}/module/react-surface`,
37
+ activatesOn: Events.SetupReactSurface,
38
+ activate: ReactSurface,
39
+ }),
40
+ defineModule({
41
+ id: `${meta.id}/module/compute-runtime`,
42
+ activatesOn: ClientEvents.ClientReady,
43
+ activatesAfter: [AutomationEvents.ComputeRuntimeReady],
44
+ activate: ComputeRuntime,
45
+ }),
46
+ ]);
@@ -3,14 +3,15 @@
3
3
  //
4
4
 
5
5
  import { Rx } from '@effect-rx/rx-react';
6
- import { Option, pipe } from 'effect';
6
+ import * as Function from 'effect/Function';
7
+ import * as Option from 'effect/Option';
7
8
 
8
9
  import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
9
10
  import { Obj } from '@dxos/echo';
10
11
  import { ScriptType } from '@dxos/functions';
11
12
  import { ATTENDABLE_PATH_SEPARATOR, PLANK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
12
13
  import { createExtension } from '@dxos/plugin-graph';
13
- import { SPACE_PLUGIN } from '@dxos/plugin-space';
14
+ import { meta as spaceMeta } from '@dxos/plugin-space';
14
15
 
15
16
  import { meta } from '../meta';
16
17
 
@@ -20,9 +21,9 @@ export default (context: PluginContext) =>
20
21
  id: `${meta.id}/space-settings-automation`,
21
22
  connector: (node) =>
22
23
  Rx.make((get) =>
23
- pipe(
24
+ Function.pipe(
24
25
  get(node),
25
- Option.flatMap((node) => (node.type === `${SPACE_PLUGIN}/settings` ? Option.some(node) : Option.none())),
26
+ Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),
26
27
  Option.map((node) => [
27
28
  {
28
29
  id: `automation-${node.id}`,
@@ -42,9 +43,9 @@ export default (context: PluginContext) =>
42
43
  id: `${meta.id}/space-settings-functions`,
43
44
  connector: (node) =>
44
45
  Rx.make((get) =>
45
- pipe(
46
+ Function.pipe(
46
47
  get(node),
47
- Option.flatMap((node) => (node.type === `${SPACE_PLUGIN}/settings` ? Option.some(node) : Option.none())),
48
+ Option.flatMap((node) => (node.type === `${spaceMeta.id}/settings` ? Option.some(node) : Option.none())),
48
49
  Option.map((node) => [
49
50
  {
50
51
  id: `functions-${node.id}`,
@@ -64,7 +65,7 @@ export default (context: PluginContext) =>
64
65
  id: `${meta.id}/script-companion`,
65
66
  connector: (node) =>
66
67
  Rx.make((get) =>
67
- pipe(
68
+ Function.pipe(
68
69
  get(node),
69
70
  Option.flatMap((node) => (Obj.instanceOf(ScriptType, node.data) ? Option.some(node) : Option.none())),
70
71
  Option.map((node) => [
@@ -0,0 +1,48 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import type * as ManagedRuntime from 'effect/ManagedRuntime';
6
+
7
+ import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
8
+ import { defineCapability } from '@dxos/app-framework';
9
+ import type {
10
+ CredentialsService,
11
+ DatabaseService,
12
+ FunctionInvocationService,
13
+ InvocationTracer,
14
+ QueueService,
15
+ TriggerDispatcher,
16
+ TriggerStateStore,
17
+ } from '@dxos/functions';
18
+ import type { SpaceId } from '@dxos/keys';
19
+
20
+ import { meta } from '../meta';
21
+
22
+ export namespace AutomationCapabilities {
23
+ /**
24
+ * Service stack for executing agents, functions, and triggers.
25
+ */
26
+ export type ComputeServices =
27
+ | TriggerDispatcher
28
+ | AiService.AiService
29
+ | DatabaseService
30
+ | QueueService
31
+ | CredentialsService
32
+ | FunctionInvocationService
33
+ | InvocationTracer
34
+ | TriggerStateStore
35
+ // TODO(dmaretskyi): Those should be provided at AI-chat call site.
36
+ | ToolResolverService
37
+ | ToolExecutionService;
38
+
39
+ export type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;
40
+ export interface ComputeRuntimeProvider {
41
+ getRuntime(spaceId: SpaceId): ComputeRuntime;
42
+ }
43
+
44
+ /**
45
+ * Runtime for executing agents, functions, and triggers.
46
+ */
47
+ export const ComputeRuntime = defineCapability<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);
48
+ }
@@ -0,0 +1,138 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Toolkit from '@effect/ai/Toolkit';
6
+ import * as BrowserKeyValueStore from '@effect/platform-browser/BrowserKeyValueStore';
7
+ import * as Effect from 'effect/Effect';
8
+ import * as Layer from 'effect/Layer';
9
+ import * as ManagedRuntime from 'effect/ManagedRuntime';
10
+
11
+ import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
12
+ import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';
13
+ import { Resource } from '@dxos/context';
14
+ import { Query, Ref } from '@dxos/echo';
15
+ import {
16
+ CredentialsService,
17
+ DatabaseService,
18
+ FunctionImplementationResolver,
19
+ FunctionInvocationService,
20
+ InvocationTracer,
21
+ LocalFunctionExecutionService,
22
+ QueueService,
23
+ RemoteFunctionExecutionService,
24
+ TriggerDispatcher,
25
+ } from '@dxos/functions';
26
+ import { TriggerStateStore } from '@dxos/functions';
27
+ import { invariant } from '@dxos/invariant';
28
+ import { type SpaceId } from '@dxos/keys';
29
+ import { ClientCapabilities } from '@dxos/plugin-client';
30
+ import { PropertiesType } from '@dxos/react-client/echo';
31
+
32
+ import { AutomationCapabilities } from './capabilities';
33
+
34
+ export default async (context: PluginContext) => {
35
+ const provider = await new ComputeRuntimeProviderImpl(context).open();
36
+ return contributes(AutomationCapabilities.ComputeRuntime, provider, async () => {
37
+ await provider.close();
38
+ });
39
+ };
40
+
41
+ class ComputeRuntimeProviderImpl extends Resource implements AutomationCapabilities.ComputeRuntimeProvider {
42
+ readonly #runtimes = new Map<SpaceId, AutomationCapabilities.ComputeRuntime>();
43
+ readonly #context: PluginContext;
44
+
45
+ constructor(context: PluginContext) {
46
+ super();
47
+ this.#context = context;
48
+ }
49
+
50
+ protected override async _open() {}
51
+
52
+ protected override async _close() {
53
+ await Promise.all(Array.from(this.#runtimes.values()).map((rt) => rt.dispose()));
54
+ this.#runtimes.clear();
55
+ }
56
+
57
+ getRuntime(spaceId: SpaceId): AutomationCapabilities.ComputeRuntime {
58
+ if (this.#runtimes.has(spaceId)) {
59
+ return this.#runtimes.get(spaceId)!;
60
+ }
61
+
62
+ const layer = Layer.unwrapEffect(
63
+ Effect.gen(this, function* () {
64
+ const client = this.#context.getCapability(ClientCapabilities.Client);
65
+ const serviceLayer =
66
+ this.#context.getCapability(Capabilities.AiServiceLayer) ?? Layer.die('AiService not found');
67
+
68
+ // TODO(dmaretskyi): Make those reactive.
69
+ const functions = this.#context.getCapabilities(Capabilities.Functions);
70
+ const toolkits = this.#context.getCapabilities(Capabilities.Toolkit);
71
+ const handlers = this.#context.getCapabilities(Capabilities.ToolkitHandler);
72
+
73
+ const allFunctions = functions.flat();
74
+ // TODO(wittjosiah): Don't cast.
75
+ const toolkit = Toolkit.merge(...toolkits) as Toolkit.Toolkit<any>;
76
+ const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);
77
+
78
+ const space = client.spaces.get(spaceId);
79
+ invariant(space);
80
+ yield* Effect.promise(() => space.waitUntilReady());
81
+
82
+ return Layer.mergeAll(TriggerDispatcher.layer({ timeControl: 'natural' })).pipe(
83
+ Layer.provideMerge(
84
+ Layer.mergeAll(
85
+ InvocationTracerLive,
86
+ TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)),
87
+ makeToolResolverFromFunctions(allFunctions, toolkit),
88
+ makeToolExecutionServiceFromFunctions(toolkit, handlersLayer),
89
+ ),
90
+ ),
91
+ Layer.provideMerge(
92
+ Layer.mergeAll(
93
+ FunctionInvocationService.layer.pipe(
94
+ Layer.provideMerge(
95
+ LocalFunctionExecutionService.layerLive.pipe(
96
+ Layer.provideMerge(FunctionImplementationResolver.layerTest({ functions: allFunctions })),
97
+ Layer.provideMerge(
98
+ RemoteFunctionExecutionService.fromClient(
99
+ client.edge.baseUrl,
100
+ // If agent is not enabled do not provide spaceId because space context will be unavailable on EDGE.
101
+ client.config.get('runtime.client.edgeFeatures.agents') ? spaceId : undefined,
102
+ ),
103
+ ),
104
+ Layer.provideMerge(serviceLayer),
105
+ Layer.provideMerge(CredentialsService.layerFromDatabase()),
106
+ Layer.provideMerge(space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable),
107
+ Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable),
108
+ ),
109
+ ),
110
+ ),
111
+ ),
112
+ ),
113
+ );
114
+ }),
115
+ );
116
+
117
+ const runtime = ManagedRuntime.make(layer);
118
+ this.#runtimes.set(spaceId, runtime);
119
+
120
+ return runtime;
121
+ }
122
+ }
123
+
124
+ const InvocationTracerLive = Layer.unwrapEffect(
125
+ Effect.gen(function* () {
126
+ const {
127
+ objects: [properties],
128
+ } = yield* DatabaseService.runQuery(Query.type(PropertiesType));
129
+ invariant(properties);
130
+ if (!properties.invocationTraceQueue) {
131
+ const queue = yield* QueueService.createQueue({ subspaceTag: 'trace' });
132
+ properties.invocationTraceQueue = Ref.fromDXN(queue.dxn);
133
+ }
134
+ const queue = properties.invocationTraceQueue.target;
135
+ invariant(queue);
136
+ return InvocationTracer.layerLive({ invocationTraceQueue: queue });
137
+ }),
138
+ );
@@ -5,5 +5,8 @@
5
5
  import { lazy } from '@dxos/app-framework';
6
6
 
7
7
  export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
8
+ export const ComputeRuntime = lazy(() => import('./compute-runtime'));
8
9
  export const IntentResolver = lazy(() => import('./intent-resolver'));
9
10
  export const ReactSurface = lazy(() => import('./react-surface'));
11
+
12
+ export * from './capabilities';
@@ -6,51 +6,50 @@ import React from 'react';
6
6
 
7
7
  import { Capabilities, contributes, createSurface, useLayout } from '@dxos/app-framework';
8
8
  import { Obj } from '@dxos/echo';
9
- import { ScriptType } from '@dxos/functions';
10
9
  import { getSpace, parseId, useSpace } from '@dxos/react-client/echo';
11
10
 
12
- import { AutomationContainer, FunctionsContainer } from '../components';
11
+ import { AutomationSettings, FunctionsContainer } from '../components';
13
12
  import { meta } from '../meta';
14
13
 
15
14
  export default () =>
16
15
  contributes(Capabilities.ReactSurface, [
17
16
  createSurface({
18
- id: `${meta.id}/space-settings-automation`,
17
+ id: `${meta.id}/space-settings-functions`,
19
18
  role: 'article',
20
- filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,
19
+ filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,
21
20
  component: () => {
22
21
  const layout = useLayout();
23
22
  const { spaceId } = parseId(layout.workspace);
24
23
  const space = useSpace(spaceId);
25
- if (!space || !spaceId) {
24
+ if (!space) {
26
25
  return null;
27
26
  }
28
27
 
29
- return <AutomationContainer space={space} />;
28
+ return <FunctionsContainer space={space} />;
30
29
  },
31
30
  }),
32
31
  createSurface({
33
- id: `${meta.id}/space-settings-functions`,
32
+ id: `${meta.id}/space-settings-automation`,
34
33
  role: 'article',
35
- filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,
34
+ filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,
36
35
  component: () => {
37
36
  const layout = useLayout();
38
37
  const { spaceId } = parseId(layout.workspace);
39
38
  const space = useSpace(spaceId);
40
- if (!space || !spaceId) {
39
+ if (!space) {
41
40
  return null;
42
41
  }
43
42
 
44
- return <FunctionsContainer space={space} />;
43
+ return <AutomationSettings space={space} />;
45
44
  },
46
45
  }),
47
46
  createSurface({
48
47
  id: `${meta.id}/companion/automation`,
49
48
  role: 'article',
50
- filter: (data): data is { companionTo: ScriptType; subject: 'automation' } =>
51
- Obj.instanceOf(ScriptType, data.companionTo) && data.subject === 'automation',
52
- component: ({ data, role }) => {
53
- return <AutomationContainer space={getSpace(data.companionTo)!} object={data.companionTo} />;
49
+ filter: (data): data is { companionTo: Obj.Any; subject: 'automation' } =>
50
+ Obj.isObject(data.companionTo) && data.subject === 'automation',
51
+ component: ({ data }) => {
52
+ return <AutomationSettings space={getSpace(data.companionTo)!} object={data.companionTo} />;
54
53
  },
55
54
  }),
56
55
  ]);
@@ -2,8 +2,6 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React from 'react';
9
7
 
@@ -11,7 +9,7 @@ import { Obj } from '@dxos/echo';
11
9
  import { FunctionTrigger, FunctionType } from '@dxos/functions';
12
10
  import { useSpaces } from '@dxos/react-client/echo';
13
11
  import { withClientProvider } from '@dxos/react-client/testing';
14
- import { withLayout, withTheme } from '@dxos/storybook-utils';
12
+ import { withTheme } from '@dxos/react-ui/testing';
15
13
 
16
14
  import { functions } from '../../testing';
17
15
  import { translations } from '../../translations';
@@ -34,18 +32,17 @@ const meta = {
34
32
  component: AutomationPanel as any,
35
33
  render: DefaultStory,
36
34
  decorators: [
35
+ withTheme,
37
36
  withClientProvider({
38
37
  createIdentity: true,
39
38
  createSpace: true,
40
39
  types: [FunctionType, FunctionTrigger],
41
- onSpaceCreated: ({ space }) => {
40
+ onCreateSpace: ({ space }) => {
42
41
  for (const fn of functions) {
43
42
  space.db.add(Obj.make(FunctionType, fn));
44
43
  }
45
44
  },
46
45
  }),
47
- withLayout(),
48
- withTheme,
49
46
  ],
50
47
  parameters: {
51
48
  layout: 'centered',