@dxos/plugin-automation 0.8.4-main.406dc2a → 0.8.4-main.422d1c7879

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 (287) hide show
  1. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  2. package/dist/lib/browser/chunk-LEN2XWRB.mjs +44 -0
  3. package/dist/lib/browser/chunk-LEN2XWRB.mjs.map +7 -0
  4. package/dist/lib/browser/chunk-VKSAIOAL.mjs +54 -0
  5. package/dist/lib/browser/chunk-VKSAIOAL.mjs.map +7 -0
  6. package/dist/lib/browser/cli/index.mjs +1110 -0
  7. package/dist/lib/browser/cli/index.mjs.map +7 -0
  8. package/dist/lib/browser/create-trigger-from-template-NH5EL6LB.mjs +71 -0
  9. package/dist/lib/browser/create-trigger-from-template-NH5EL6LB.mjs.map +7 -0
  10. package/dist/lib/browser/hooks/index.mjs +81 -6
  11. package/dist/lib/browser/hooks/index.mjs.map +4 -4
  12. package/dist/lib/browser/index.mjs +76 -103
  13. package/dist/lib/browser/index.mjs.map +4 -4
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/operations/index.mjs +14 -0
  16. package/dist/lib/browser/operations/index.mjs.map +7 -0
  17. package/dist/lib/browser/types/index.mjs +10 -4
  18. package/dist/lib/node-esm/{chunk-CJUI6AKX.mjs → chunk-45PS7CQD.mjs} +24 -7
  19. package/dist/lib/node-esm/chunk-45PS7CQD.mjs.map +7 -0
  20. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  21. package/dist/lib/node-esm/chunk-V2SSR4MK.mjs +45 -0
  22. package/dist/lib/node-esm/chunk-V2SSR4MK.mjs.map +7 -0
  23. package/dist/lib/node-esm/cli/index.mjs +1111 -0
  24. package/dist/lib/node-esm/cli/index.mjs.map +7 -0
  25. package/dist/lib/node-esm/create-trigger-from-template-C7UPU2VL.mjs +72 -0
  26. package/dist/lib/node-esm/create-trigger-from-template-C7UPU2VL.mjs.map +7 -0
  27. package/dist/lib/node-esm/hooks/index.mjs +81 -6
  28. package/dist/lib/node-esm/hooks/index.mjs.map +4 -4
  29. package/dist/lib/node-esm/index.mjs +76 -103
  30. package/dist/lib/node-esm/index.mjs.map +4 -4
  31. package/dist/lib/node-esm/meta.json +1 -1
  32. package/dist/lib/node-esm/operations/index.mjs +15 -0
  33. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  34. package/dist/lib/node-esm/types/index.mjs +10 -4
  35. package/dist/types/src/AutomationPlugin.d.ts +2 -1
  36. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  37. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  38. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/compute-runtime.d.ts +12 -3
  40. package/dist/types/src/capabilities/compute-runtime.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/index.d.ts +6 -5
  42. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/node.d.ts +3 -0
  44. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  45. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  46. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  47. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  48. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  49. package/dist/types/src/cli/commands/index.d.ts +2 -0
  50. package/dist/types/src/cli/commands/index.d.ts.map +1 -0
  51. package/dist/types/src/cli/commands/trigger/create/index.d.ts +25 -0
  52. package/dist/types/src/cli/commands/trigger/create/index.d.ts.map +1 -0
  53. package/dist/types/src/cli/commands/trigger/create/queue.d.ts +13 -0
  54. package/dist/types/src/cli/commands/trigger/create/queue.d.ts.map +1 -0
  55. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts +15 -0
  56. package/dist/types/src/cli/commands/trigger/create/subscription.d.ts.map +1 -0
  57. package/dist/types/src/cli/commands/trigger/create/timer.d.ts +13 -0
  58. package/dist/types/src/cli/commands/trigger/create/timer.d.ts.map +1 -0
  59. package/dist/types/src/cli/commands/trigger/index.d.ts +57 -0
  60. package/dist/types/src/cli/commands/trigger/index.d.ts.map +1 -0
  61. package/dist/types/src/cli/commands/trigger/list.d.ts +7 -0
  62. package/dist/types/src/cli/commands/trigger/list.d.ts.map +1 -0
  63. package/dist/types/src/cli/commands/trigger/options.d.ts +11 -0
  64. package/dist/types/src/cli/commands/trigger/options.d.ts.map +1 -0
  65. package/dist/types/src/cli/commands/trigger/remove.d.ts +8 -0
  66. package/dist/types/src/cli/commands/trigger/remove.d.ts.map +1 -0
  67. package/dist/types/src/cli/commands/trigger/update/index.d.ts +28 -0
  68. package/dist/types/src/cli/commands/trigger/update/index.d.ts.map +1 -0
  69. package/dist/types/src/cli/commands/trigger/update/queue.d.ts +12 -0
  70. package/dist/types/src/cli/commands/trigger/update/queue.d.ts.map +1 -0
  71. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts +13 -0
  72. package/dist/types/src/cli/commands/trigger/update/subscription.d.ts.map +1 -0
  73. package/dist/types/src/cli/commands/trigger/update/timer.d.ts +11 -0
  74. package/dist/types/src/cli/commands/trigger/update/timer.d.ts.map +1 -0
  75. package/dist/types/src/cli/commands/trigger/util.d.ts +46 -0
  76. package/dist/types/src/cli/commands/trigger/util.d.ts.map +1 -0
  77. package/dist/types/src/cli/index.d.ts +2 -0
  78. package/dist/types/src/cli/index.d.ts.map +1 -0
  79. package/dist/types/src/cli/plugin.d.ts +3 -0
  80. package/dist/types/src/cli/plugin.d.ts.map +1 -0
  81. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +6 -7
  82. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
  83. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +31 -26
  84. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
  85. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +1 -1
  86. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts +8 -0
  87. package/dist/types/src/components/FunctionsRegistry/FunctionsRegistry.d.ts.map +1 -0
  88. package/dist/types/src/components/FunctionsRegistry/index.d.ts +4 -0
  89. package/dist/types/src/components/FunctionsRegistry/index.d.ts.map +1 -0
  90. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +12 -9
  91. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +1 -1
  92. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +6 -3
  93. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +1 -1
  94. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +9 -8
  95. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
  96. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +102 -28
  97. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
  98. package/dist/types/src/components/index.d.ts +3 -4
  99. package/dist/types/src/components/index.d.ts.map +1 -1
  100. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +6 -0
  101. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
  102. package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
  103. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
  104. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts +4 -0
  105. package/dist/types/src/containers/FunctionsContainer/FunctionsContainer.d.ts.map +1 -0
  106. package/dist/types/src/containers/FunctionsContainer/index.d.ts +2 -0
  107. package/dist/types/src/containers/FunctionsContainer/index.d.ts.map +1 -0
  108. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
  109. package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
  110. package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
  111. package/dist/types/src/containers/index.d.ts +5 -0
  112. package/dist/types/src/containers/index.d.ts.map +1 -0
  113. package/dist/types/src/hooks/index.d.ts +2 -0
  114. package/dist/types/src/hooks/index.d.ts.map +1 -1
  115. package/dist/types/src/hooks/useComputeRuntime.d.ts +8 -0
  116. package/dist/types/src/hooks/useComputeRuntime.d.ts.map +1 -0
  117. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts +5 -4
  118. package/dist/types/src/hooks/useComputeRuntimeCallback.d.ts.map +1 -1
  119. package/dist/types/src/hooks/useComputeRuntimeService.d.ts +5 -0
  120. package/dist/types/src/hooks/useComputeRuntimeService.d.ts.map +1 -0
  121. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +6 -5
  122. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -1
  123. package/dist/types/src/index.d.ts +2 -5
  124. package/dist/types/src/index.d.ts.map +1 -1
  125. package/dist/types/src/meta.d.ts +2 -2
  126. package/dist/types/src/meta.d.ts.map +1 -1
  127. package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
  128. package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
  129. package/dist/types/src/operations/definitions.d.ts +19 -0
  130. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  131. package/dist/types/src/operations/index.d.ts +4 -0
  132. package/dist/types/src/operations/index.d.ts.map +1 -0
  133. package/dist/types/src/testing/test-functions.d.ts +204 -3
  134. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  135. package/dist/types/src/translations.d.ts +32 -27
  136. package/dist/types/src/translations.d.ts.map +1 -1
  137. package/dist/types/src/types/capabilities.d.ts +25 -0
  138. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  139. package/dist/types/src/types/events.d.ts +5 -0
  140. package/dist/types/src/types/events.d.ts.map +1 -0
  141. package/dist/types/src/types/index.d.ts +2 -0
  142. package/dist/types/src/types/index.d.ts.map +1 -1
  143. package/dist/types/src/types/schema.d.ts +11 -3
  144. package/dist/types/src/types/schema.d.ts.map +1 -1
  145. package/dist/types/tsconfig.tsbuildinfo +1 -1
  146. package/package.json +92 -58
  147. package/src/AutomationPlugin.tsx +19 -36
  148. package/src/capabilities/app-graph-builder.ts +55 -80
  149. package/src/capabilities/compute-runtime.ts +246 -78
  150. package/src/capabilities/index.ts +9 -7
  151. package/src/capabilities/node.ts +7 -0
  152. package/src/capabilities/operation-handler.ts +16 -0
  153. package/src/capabilities/react-surface.tsx +49 -45
  154. package/src/cli/commands/index.ts +5 -0
  155. package/src/cli/commands/trigger/create/index.ts +14 -0
  156. package/src/cli/commands/trigger/create/queue.ts +87 -0
  157. package/src/cli/commands/trigger/create/subscription.ts +126 -0
  158. package/src/cli/commands/trigger/create/timer.ts +91 -0
  159. package/src/cli/commands/trigger/index.ts +16 -0
  160. package/src/cli/commands/trigger/list.ts +68 -0
  161. package/src/cli/commands/trigger/options.ts +59 -0
  162. package/src/cli/commands/trigger/remove.ts +45 -0
  163. package/src/cli/commands/trigger/update/index.ts +14 -0
  164. package/src/cli/commands/trigger/update/queue.ts +195 -0
  165. package/src/cli/commands/trigger/update/subscription.ts +279 -0
  166. package/src/cli/commands/trigger/update/timer.ts +194 -0
  167. package/src/cli/commands/trigger/util.ts +409 -0
  168. package/src/cli/index.ts +5 -0
  169. package/src/cli/plugin.ts +23 -0
  170. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +8 -7
  171. package/src/components/AutomationPanel/AutomationPanel.tsx +201 -99
  172. package/src/components/FunctionsPanel/FunctionsPanel.tsx +50 -30
  173. package/src/components/FunctionsRegistry/FunctionsRegistry.tsx +114 -0
  174. package/src/components/FunctionsRegistry/index.ts +8 -0
  175. package/src/components/TriggerEditor/FunctionInputEditor.tsx +34 -33
  176. package/src/components/TriggerEditor/SpecSelector.tsx +27 -21
  177. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +88 -41
  178. package/src/components/TriggerEditor/TriggerEditor.tsx +92 -50
  179. package/src/components/index.ts +1 -2
  180. package/src/containers/AutomationSettings/AutomationSettings.tsx +31 -0
  181. package/src/containers/AutomationSettings/index.ts +5 -0
  182. package/src/containers/FunctionsContainer/FunctionsContainer.tsx +34 -0
  183. package/src/containers/FunctionsContainer/index.ts +5 -0
  184. package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
  185. package/src/containers/TriggerSettings/index.ts +6 -0
  186. package/src/containers/index.ts +9 -0
  187. package/src/hooks/index.ts +3 -0
  188. package/src/hooks/useComputeRuntime.ts +21 -0
  189. package/src/hooks/useComputeRuntimeCallback.ts +11 -9
  190. package/src/hooks/useComputeRuntimeService.ts +25 -0
  191. package/src/hooks/useTriggerRuntimeControls.ts +30 -15
  192. package/src/index.ts +2 -6
  193. package/src/meta.ts +9 -6
  194. package/src/operations/create-trigger-from-template.ts +72 -0
  195. package/src/operations/definitions.ts +28 -0
  196. package/src/operations/index.ts +9 -0
  197. package/src/testing/test-functions.ts +9 -6
  198. package/src/translations.ts +39 -33
  199. package/src/types/capabilities.ts +47 -0
  200. package/src/types/events.ts +11 -0
  201. package/src/types/index.ts +2 -0
  202. package/src/types/schema.ts +5 -5
  203. package/dist/lib/browser/AutomationPanel-3PHA5FTJ.mjs +0 -11
  204. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs +0 -69
  205. package/dist/lib/browser/AutomationSettings-3EYSPFKB.mjs.map +0 -7
  206. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs +0 -36
  207. package/dist/lib/browser/FunctionsContainer-HHBMPUOD.mjs.map +0 -7
  208. package/dist/lib/browser/FunctionsPanel-NRIKAPQV.mjs +0 -10
  209. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs +0 -81
  210. package/dist/lib/browser/app-graph-builder-DV5HMFX4.mjs.map +0 -7
  211. package/dist/lib/browser/chunk-5ARH77PV.mjs +0 -15
  212. package/dist/lib/browser/chunk-5ARH77PV.mjs.map +0 -7
  213. package/dist/lib/browser/chunk-6TUZQIEN.mjs +0 -14
  214. package/dist/lib/browser/chunk-6TUZQIEN.mjs.map +0 -7
  215. package/dist/lib/browser/chunk-DK7BLEKU.mjs +0 -14
  216. package/dist/lib/browser/chunk-DK7BLEKU.mjs.map +0 -7
  217. package/dist/lib/browser/chunk-DLLE4FKP.mjs +0 -94
  218. package/dist/lib/browser/chunk-DLLE4FKP.mjs.map +0 -7
  219. package/dist/lib/browser/chunk-MVPRI3DB.mjs +0 -53
  220. package/dist/lib/browser/chunk-MVPRI3DB.mjs.map +0 -7
  221. package/dist/lib/browser/chunk-SUKAEYF3.mjs +0 -267
  222. package/dist/lib/browser/chunk-SUKAEYF3.mjs.map +0 -7
  223. package/dist/lib/browser/chunk-VGBZKM3O.mjs +0 -38
  224. package/dist/lib/browser/chunk-VGBZKM3O.mjs.map +0 -7
  225. package/dist/lib/browser/chunk-VL3KSDVL.mjs +0 -183
  226. package/dist/lib/browser/chunk-VL3KSDVL.mjs.map +0 -7
  227. package/dist/lib/browser/chunk-WWURMV25.mjs +0 -13
  228. package/dist/lib/browser/chunk-WWURMV25.mjs.map +0 -7
  229. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs +0 -160
  230. package/dist/lib/browser/compute-runtime-YJREH6WP.mjs.map +0 -7
  231. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs +0 -77
  232. package/dist/lib/browser/intent-resolver-D2OHKQRR.mjs.map +0 -7
  233. package/dist/lib/browser/react-surface-G7CG7BML.mjs +0 -63
  234. package/dist/lib/browser/react-surface-G7CG7BML.mjs.map +0 -7
  235. package/dist/lib/node-esm/AutomationPanel-EETYIR35.mjs +0 -12
  236. package/dist/lib/node-esm/AutomationPanel-EETYIR35.mjs.map +0 -7
  237. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs +0 -70
  238. package/dist/lib/node-esm/AutomationSettings-WKSMWITV.mjs.map +0 -7
  239. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs +0 -37
  240. package/dist/lib/node-esm/FunctionsContainer-ZKVOBUHV.mjs.map +0 -7
  241. package/dist/lib/node-esm/FunctionsPanel-SAMRTELO.mjs +0 -11
  242. package/dist/lib/node-esm/FunctionsPanel-SAMRTELO.mjs.map +0 -7
  243. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs +0 -82
  244. package/dist/lib/node-esm/app-graph-builder-TR2WXPX2.mjs.map +0 -7
  245. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs +0 -16
  246. package/dist/lib/node-esm/chunk-2EWXIFEK.mjs.map +0 -7
  247. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs +0 -15
  248. package/dist/lib/node-esm/chunk-5MQJPJR2.mjs.map +0 -7
  249. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs +0 -184
  250. package/dist/lib/node-esm/chunk-AKHETVIQ.mjs.map +0 -7
  251. package/dist/lib/node-esm/chunk-B7N3H45O.mjs +0 -16
  252. package/dist/lib/node-esm/chunk-B7N3H45O.mjs.map +0 -7
  253. package/dist/lib/node-esm/chunk-CJUI6AKX.mjs.map +0 -7
  254. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs +0 -268
  255. package/dist/lib/node-esm/chunk-J3XEBEIE.mjs.map +0 -7
  256. package/dist/lib/node-esm/chunk-QCA543ZR.mjs +0 -54
  257. package/dist/lib/node-esm/chunk-QCA543ZR.mjs.map +0 -7
  258. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs +0 -16
  259. package/dist/lib/node-esm/chunk-WHCSOUNN.mjs.map +0 -7
  260. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs +0 -95
  261. package/dist/lib/node-esm/chunk-YQXW3JXD.mjs.map +0 -7
  262. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs +0 -161
  263. package/dist/lib/node-esm/compute-runtime-CMEPAYND.mjs.map +0 -7
  264. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs +0 -78
  265. package/dist/lib/node-esm/intent-resolver-2LGBVXT5.mjs.map +0 -7
  266. package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs +0 -64
  267. package/dist/lib/node-esm/react-surface-OMZSBDHS.mjs.map +0 -7
  268. package/dist/types/src/capabilities/capabilities.d.ts +0 -19
  269. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  270. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  271. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  272. package/dist/types/src/components/AutomationSettings.d.ts +0 -5
  273. package/dist/types/src/components/AutomationSettings.d.ts.map +0 -1
  274. package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
  275. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  276. package/dist/types/src/components/TriggerSettings.d.ts.map +0 -1
  277. package/dist/types/src/events.d.ts +0 -4
  278. package/dist/types/src/events.d.ts.map +0 -1
  279. package/src/capabilities/capabilities.ts +0 -48
  280. package/src/capabilities/intent-resolver.ts +0 -72
  281. package/src/components/AutomationSettings.tsx +0 -30
  282. package/src/components/FunctionsContainer.tsx +0 -29
  283. package/src/components/TriggerSettings.tsx +0 -25
  284. package/src/events.ts +0 -11
  285. /package/dist/lib/browser/{AutomationPanel-3PHA5FTJ.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  286. /package/dist/lib/{browser/FunctionsPanel-NRIKAPQV.mjs.map → node-esm/chunk-HSLMI22Q.mjs.map} +0 -0
  287. /package/dist/types/src/{components → containers/TriggerSettings}/TriggerSettings.d.ts +0 -0
@@ -1,54 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationCapabilities
4
- } from "./chunk-WHCSOUNN.mjs";
5
-
6
- // src/hooks/useComputeRuntimeCallback.ts
7
- import { useCallback } from "react";
8
- import { useCapability } from "@dxos/app-framework";
9
- var useComputeRuntimeCallback = (space, fn, deps) => {
10
- const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);
11
- const runtime = space !== void 0 ? computeRuntime.getRuntime(space.id) : void 0;
12
- return useCallback(() => {
13
- if (!runtime) {
14
- throw new TypeError("Space not provided to useComputeRuntimeCallback");
15
- }
16
- return runtime.runPromise(fn());
17
- }, [
18
- runtime,
19
- ...deps ?? []
20
- ]);
21
- };
22
-
23
- // src/hooks/useTriggerRuntimeControls.ts
24
- import * as Effect from "effect/Effect";
25
- import { Filter } from "@dxos/echo";
26
- import { FunctionTrigger, TriggerDispatcher } from "@dxos/functions";
27
- import { useQuery } from "@dxos/react-client/echo";
28
- import { useAsyncState } from "@dxos/react-ui";
29
- var useTriggerRuntimeControls = (space) => {
30
- const triggers = useQuery(space, Filter.type(FunctionTrigger));
31
- const [isRunningState, setIsRunningState] = useAsyncState(useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))));
32
- const start = useComputeRuntimeCallback(space, Effect.fnUntraced(function* () {
33
- const dispatcher = yield* TriggerDispatcher;
34
- yield* dispatcher.start();
35
- setIsRunningState(true);
36
- }));
37
- const stop = useComputeRuntimeCallback(space, Effect.fnUntraced(function* () {
38
- const dispatcher = yield* TriggerDispatcher;
39
- yield* dispatcher.stop();
40
- setIsRunningState(false);
41
- }));
42
- return {
43
- triggers,
44
- isRunning: isRunningState ?? false,
45
- start: () => void start(),
46
- stop: () => void stop()
47
- };
48
- };
49
-
50
- export {
51
- useComputeRuntimeCallback,
52
- useTriggerRuntimeControls
53
- };
54
- //# sourceMappingURL=chunk-QCA543ZR.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/hooks/useComputeRuntimeCallback.ts", "../../../src/hooks/useTriggerRuntimeControls.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Effect from 'effect/Effect';\nimport { useCallback } from 'react';\n\nimport { useCapability } from '@dxos/app-framework';\nimport type { Space } from '@dxos/react-client/echo';\n\nimport { AutomationCapabilities } from '../capabilities';\n\n/**\n * Create an effectful function that has access to compute services\n */\nexport const useComputeRuntimeCallback = <T>(\n space: Space | undefined,\n fn: () => Effect.Effect<T, any, AutomationCapabilities.ComputeServices>,\n deps?: React.DependencyList,\n): (() => Promise<T>) => {\n const computeRuntime = useCapability(AutomationCapabilities.ComputeRuntime);\n const runtime = space !== undefined ? computeRuntime.getRuntime(space.id) : undefined;\n\n return useCallback(() => {\n if (!runtime) {\n throw new TypeError('Space not provided to useComputeRuntimeCallback');\n }\n return runtime.runPromise(fn());\n }, [runtime, ...(deps ?? [])]);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Filter } from '@dxos/echo';\nimport { FunctionTrigger, TriggerDispatcher } from '@dxos/functions';\nimport { type Space, useQuery } from '@dxos/react-client/echo';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { useComputeRuntimeCallback } from './useComputeRuntimeCallback';\n\ninterface TriggerRuntimeControls {\n triggers: FunctionTrigger[];\n isRunning: boolean;\n start: () => void;\n stop: () => void;\n}\n\nexport const useTriggerRuntimeControls = (space: Space | undefined): TriggerRuntimeControls => {\n const triggers = useQuery(space, Filter.type(FunctionTrigger));\n\n const [isRunningState, setIsRunningState] = useAsyncState(\n useComputeRuntimeCallback(space, () => TriggerDispatcher.pipe(Effect.map((t) => t.running))),\n );\n\n const start = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.start();\n setIsRunningState(true);\n }),\n );\n\n const stop = useComputeRuntimeCallback(\n space,\n Effect.fnUntraced(function* () {\n const dispatcher = yield* TriggerDispatcher;\n yield* dispatcher.stop();\n setIsRunningState(false);\n }),\n );\n\n return {\n triggers,\n isRunning: isRunningState ?? false,\n start: () => void start(),\n stop: () => void stop(),\n };\n};\n"],
5
- "mappings": ";;;;;;AAKA,SAASA,mBAAmB;AAE5B,SAASC,qBAAqB;AAQvB,IAAMC,4BAA4B,CACvCC,OACAC,IACAC,SAAAA;AAEA,QAAMC,iBAAiBC,cAAcC,uBAAuBC,cAAc;AAC1E,QAAMC,UAAUP,UAAUQ,SAAYL,eAAeM,WAAWT,MAAMU,EAAE,IAAIF;AAE5E,SAAOG,YAAY,MAAA;AACjB,QAAI,CAACJ,SAAS;AACZ,YAAM,IAAIK,UAAU,iDAAA;IACtB;AACA,WAAOL,QAAQM,WAAWZ,GAAAA,CAAAA;EAC5B,GAAG;IAACM;OAAaL,QAAQ,CAAA;GAAI;AAC/B;;;ACzBA,YAAYY,YAAY;AAExB,SAASC,cAAc;AACvB,SAASC,iBAAiBC,yBAAyB;AACnD,SAAqBC,gBAAgB;AACrC,SAASC,qBAAqB;AAWvB,IAAMC,4BAA4B,CAACC,UAAAA;AACxC,QAAMC,WAAWC,SAASF,OAAOG,OAAOC,KAAKC,eAAAA,CAAAA;AAE7C,QAAM,CAACC,gBAAgBC,iBAAAA,IAAqBC,cAC1CC,0BAA0BT,OAAO,MAAMU,kBAAkBC,KAAYC,WAAI,CAACC,MAAMA,EAAEC,OAAO,CAAA,CAAA,CAAA;AAG3F,QAAMC,QAAQN,0BACZT,OACOgB,kBAAW,aAAA;AAChB,UAAMC,aAAa,OAAOP;AAC1B,WAAOO,WAAWF,MAAK;AACvBR,sBAAkB,IAAA;EACpB,CAAA,CAAA;AAGF,QAAMW,OAAOT,0BACXT,OACOgB,kBAAW,aAAA;AAChB,UAAMC,aAAa,OAAOP;AAC1B,WAAOO,WAAWC,KAAI;AACtBX,sBAAkB,KAAA;EACpB,CAAA,CAAA;AAGF,SAAO;IACLN;IACAkB,WAAWb,kBAAkB;IAC7BS,OAAO,MAAM,KAAKA,MAAAA;IAClBG,MAAM,MAAM,KAAKA,KAAAA;EACnB;AACF;",
6
- "names": ["useCallback", "useCapability", "useComputeRuntimeCallback", "space", "fn", "deps", "computeRuntime", "useCapability", "AutomationCapabilities", "ComputeRuntime", "runtime", "undefined", "getRuntime", "id", "useCallback", "TypeError", "runPromise", "Effect", "Filter", "FunctionTrigger", "TriggerDispatcher", "useQuery", "useAsyncState", "useTriggerRuntimeControls", "space", "triggers", "useQuery", "Filter", "type", "FunctionTrigger", "isRunningState", "setIsRunningState", "useAsyncState", "useComputeRuntimeCallback", "TriggerDispatcher", "pipe", "map", "t", "running", "start", "fnUntraced", "dispatcher", "stop", "isRunning"]
7
- }
@@ -1,16 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- meta
4
- } from "./chunk-5MQJPJR2.mjs";
5
-
6
- // src/capabilities/capabilities.ts
7
- import { defineCapability } from "@dxos/app-framework";
8
- (function(AutomationCapabilities2) {
9
- AutomationCapabilities2.ComputeRuntime = defineCapability(`${meta.id}/capability/compute-runtime`);
10
- })(AutomationCapabilities || (AutomationCapabilities = {}));
11
- var AutomationCapabilities;
12
-
13
- export {
14
- AutomationCapabilities
15
- };
16
- //# sourceMappingURL=chunk-WHCSOUNN.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/capabilities.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';\nimport { defineCapability } from '@dxos/app-framework';\nimport type {\n CredentialsService,\n DatabaseService,\n FunctionInvocationService,\n InvocationTracer,\n QueueService,\n TriggerDispatcher,\n TriggerStateStore,\n} from '@dxos/functions';\nimport type { SpaceId } from '@dxos/keys';\n\nimport { meta } from '../meta';\n\nexport namespace AutomationCapabilities {\n /**\n * Service stack for executing agents, functions, and triggers.\n */\n export type ComputeServices =\n | TriggerDispatcher\n | AiService.AiService\n | DatabaseService\n | QueueService\n | CredentialsService\n | FunctionInvocationService\n | InvocationTracer\n | TriggerStateStore\n // TODO(dmaretskyi): Those should be provided at AI-chat call site.\n | ToolResolverService\n | ToolExecutionService;\n\n export type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;\n export interface ComputeRuntimeProvider {\n getRuntime(spaceId: SpaceId): ComputeRuntime;\n }\n\n /**\n * Runtime for executing agents, functions, and triggers.\n */\n export const ComputeRuntime = defineCapability<ComputeRuntimeProvider>(`${meta.id}/capability/compute-runtime`);\n}\n"],
5
- "mappings": ";;;;;;AAOA,SAASA,wBAAwB;UAchBC,yBAAAA;0BAyBFC,iBAAiBC,iBAAyC,GAAGC,KAAKC,EAAE,6BAA6B;AAChH,GA1BiBJ,2BAAAA,yBAAAA,CAAAA,EAAAA;;",
6
- "names": ["defineCapability", "AutomationCapabilities", "ComputeRuntime", "defineCapability", "meta", "id"]
7
- }
@@ -1,95 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- meta
4
- } from "./chunk-5MQJPJR2.mjs";
5
-
6
- // src/components/FunctionsPanel/FunctionsPanel.tsx
7
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
8
- import * as Schema from "effect/Schema";
9
- import React, { useCallback, useMemo } from "react";
10
- import { LayoutAction, createIntent, useIntentDispatcher } from "@dxos/app-framework";
11
- import { FunctionType, ScriptType } from "@dxos/functions";
12
- import { Filter, fullyQualifiedId, useQuery } from "@dxos/react-client/echo";
13
- import { Button, useTranslation } from "@dxos/react-ui";
14
- import { controlItemClasses } from "@dxos/react-ui-form";
15
- import { List } from "@dxos/react-ui-list";
16
- import { ghostHover, mx } from "@dxos/react-ui-theme";
17
- var grid = "grid grid-cols-[1fr_auto] min-bs-[2.5rem]";
18
- var FunctionsPanel = ({ space }) => {
19
- var _effect = _useSignals();
20
- try {
21
- const { t } = useTranslation(meta.id);
22
- const functions = useQuery(space, Filter.type(FunctionType));
23
- const scripts = useQuery(space, Filter.type(ScriptType));
24
- const { dispatchPromise: dispatch } = useIntentDispatcher();
25
- const functionToScriptMap = useMemo(() => functions.reduce((map, func) => {
26
- const scriptId = func.source?.target?.id;
27
- if (scriptId) {
28
- const script = scripts.find((s) => s.id === scriptId);
29
- if (script) {
30
- map[func.id] = script;
31
- }
32
- }
33
- return map;
34
- }, {}), [
35
- functions,
36
- scripts
37
- ]);
38
- const getScriptName = useCallback((func) => {
39
- const script = functionToScriptMap[func.id];
40
- return script?.name;
41
- }, [
42
- functionToScriptMap
43
- ]);
44
- const handleGoToScript = useCallback((func) => {
45
- const script = functionToScriptMap[func.id];
46
- if (script) {
47
- void dispatch(createIntent(LayoutAction.Open, {
48
- part: "main",
49
- subject: [
50
- fullyQualifiedId(script)
51
- ]
52
- }));
53
- }
54
- }, [
55
- functionToScriptMap,
56
- dispatch
57
- ]);
58
- return /* @__PURE__ */ React.createElement("div", {
59
- role: "none",
60
- className: mx(controlItemClasses)
61
- }, functions.length > 0 && /* @__PURE__ */ React.createElement(List.Root, {
62
- items: functions,
63
- isItem: Schema.is(FunctionType),
64
- getId: (func) => func.id
65
- }, ({ items }) => /* @__PURE__ */ React.createElement("div", {
66
- role: "list",
67
- className: "flex flex-col w-full"
68
- }, items?.map((func) => /* @__PURE__ */ React.createElement(List.Item, {
69
- key: func.id,
70
- item: func,
71
- classNames: mx(grid, ghostHover, "items-center", "pli-2", "min-bs-[3rem]")
72
- }, /* @__PURE__ */ React.createElement("div", {
73
- className: "flex flex-col truncate"
74
- }, /* @__PURE__ */ React.createElement(List.ItemTitle, {
75
- classNames: "truncate"
76
- }, func.name), getScriptName(func) && /* @__PURE__ */ React.createElement("div", {
77
- className: "text-xs text-description truncate"
78
- }, getScriptName(func))), functionToScriptMap[func.id] && /* @__PURE__ */ React.createElement(Button, {
79
- onClick: () => handleGoToScript(func)
80
- }, t("go to function source button label")))))), functions.length === 0 && /* @__PURE__ */ React.createElement("div", {
81
- className: "text-center plb-4 text-gray-500"
82
- }, t("no functions found")));
83
- } finally {
84
- _effect.f();
85
- }
86
- };
87
-
88
- // src/components/FunctionsPanel/index.ts
89
- var FunctionsPanel_default = FunctionsPanel;
90
-
91
- export {
92
- FunctionsPanel,
93
- FunctionsPanel_default
94
- };
95
- //# sourceMappingURL=chunk-YQXW3JXD.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/FunctionsPanel/FunctionsPanel.tsx", "../../../src/components/FunctionsPanel/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport React, { useCallback, useMemo } from 'react';\n\nimport { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { FunctionType, ScriptType } from '@dxos/functions';\nimport { Filter, type Space, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';\nimport { Button, useTranslation } from '@dxos/react-ui';\nimport { controlItemClasses } from '@dxos/react-ui-form';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { meta } from '../../meta';\n\nconst grid = 'grid grid-cols-[1fr_auto] min-bs-[2.5rem]';\n\nexport type FunctionsPanelProps = {\n space: Space;\n};\n\nexport const FunctionsPanel = ({ space }: FunctionsPanelProps) => {\n const { t } = useTranslation(meta.id);\n const functions = useQuery(space, Filter.type(FunctionType));\n const scripts = useQuery(space, Filter.type(ScriptType));\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const functionToScriptMap = useMemo(\n () =>\n functions.reduce(\n (map, func) => {\n const scriptId = func.source?.target?.id;\n if (scriptId) {\n const script = scripts.find((s) => s.id === scriptId);\n if (script) {\n map[func.id] = script;\n }\n }\n return map;\n },\n {} as Record<string, ScriptType>,\n ),\n [functions, scripts],\n );\n\n const getScriptName = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n return script?.name;\n },\n [functionToScriptMap],\n );\n\n const handleGoToScript = useCallback(\n (func: FunctionType) => {\n const script = functionToScriptMap[func.id];\n if (script) {\n void dispatch(createIntent(LayoutAction.Open, { part: 'main', subject: [fullyQualifiedId(script)] }));\n }\n },\n [functionToScriptMap, dispatch],\n );\n\n return (\n <div role='none' className={mx(controlItemClasses)}>\n {functions.length > 0 && (\n <List.Root<FunctionType> items={functions} isItem={Schema.is(FunctionType)} getId={(func) => func.id}>\n {({ items }) => (\n <div role='list' className='flex flex-col w-full'>\n {items?.map((func) => (\n <List.Item<FunctionType>\n key={func.id}\n item={func}\n classNames={mx(grid, ghostHover, 'items-center', 'pli-2', 'min-bs-[3rem]')}\n >\n <div className='flex flex-col truncate'>\n <List.ItemTitle classNames='truncate'>{func.name}</List.ItemTitle>\n {getScriptName(func) && (\n <div className='text-xs text-description truncate'>{getScriptName(func)}</div>\n )}\n </div>\n {functionToScriptMap[func.id] && (\n <Button onClick={() => handleGoToScript(func)}>{t('go to function source button label')}</Button>\n )}\n </List.Item>\n ))}\n </div>\n )}\n </List.Root>\n )}\n\n {functions.length === 0 && <div className='text-center plb-4 text-gray-500'>{t('no functions found')}</div>}\n </div>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { FunctionsPanel } from './FunctionsPanel';\n\nexport * from './FunctionsPanel';\nexport default FunctionsPanel;\n"],
5
- "mappings": ";;;;;;;AAIA,YAAYA,YAAY;AACxB,OAAOC,SAASC,aAAaC,eAAe;AAE5C,SAASC,cAAcC,cAAcC,2BAA2B;AAChE,SAASC,cAAcC,kBAAkB;AACzC,SAASC,QAAoBC,kBAAkBC,gBAAgB;AAC/D,SAASC,QAAQC,sBAAsB;AACvC,SAASC,0BAA0B;AACnC,SAASC,YAAY;AACrB,SAASC,YAAYC,UAAU;AAI/B,IAAMC,OAAO;AAMN,IAAMC,iBAAiB,CAAC,EAAEC,MAAK,MAAuB;;;AAC3D,UAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AACpC,UAAMC,YAAYC,SAASN,OAAOO,OAAOC,KAAKC,YAAAA,CAAAA;AAC9C,UAAMC,UAAUJ,SAASN,OAAOO,OAAOC,KAAKG,UAAAA,CAAAA;AAC5C,UAAM,EAAEC,iBAAiBC,SAAQ,IAAKC,oBAAAA;AAEtC,UAAMC,sBAAsBC,QAC1B,MACEX,UAAUY,OACR,CAACC,KAAKC,SAAAA;AACJ,YAAMC,WAAWD,KAAKE,QAAQC,QAAQlB;AACtC,UAAIgB,UAAU;AACZ,cAAMG,SAASb,QAAQc,KAAK,CAACC,MAAMA,EAAErB,OAAOgB,QAAAA;AAC5C,YAAIG,QAAQ;AACVL,cAAIC,KAAKf,EAAE,IAAImB;QACjB;MACF;AACA,aAAOL;IACT,GACA,CAAC,CAAA,GAEL;MAACb;MAAWK;KAAQ;AAGtB,UAAMgB,gBAAgBC,YACpB,CAACR,SAAAA;AACC,YAAMI,SAASR,oBAAoBI,KAAKf,EAAE;AAC1C,aAAOmB,QAAQK;IACjB,GACA;MAACb;KAAoB;AAGvB,UAAMc,mBAAmBF,YACvB,CAACR,SAAAA;AACC,YAAMI,SAASR,oBAAoBI,KAAKf,EAAE;AAC1C,UAAImB,QAAQ;AACV,aAAKV,SAASiB,aAAaC,aAAaC,MAAM;UAAEC,MAAM;UAAQC,SAAS;YAACC,iBAAiBZ,MAAAA;;QAAS,CAAA,CAAA;MACpG;IACF,GACA;MAACR;MAAqBF;KAAS;AAGjC,WACE,sBAAA,cAACuB,OAAAA;MAAIC,MAAK;MAAOC,WAAWC,GAAGC,kBAAAA;OAC5BnC,UAAUoC,SAAS,KAClB,sBAAA,cAACC,KAAKC,MAAI;MAAeC,OAAOvC;MAAWwC,QAAeC,UAAGrC,YAAAA;MAAesC,OAAO,CAAC5B,SAASA,KAAKf;OAC/F,CAAC,EAAEwC,MAAK,MACP,sBAAA,cAACR,OAAAA;MAAIC,MAAK;MAAOC,WAAU;OACxBM,OAAO1B,IAAI,CAACC,SACX,sBAAA,cAACuB,KAAKM,MAAI;MACRC,KAAK9B,KAAKf;MACV8C,MAAM/B;MACNgC,YAAYZ,GAAGzC,MAAMsD,YAAY,gBAAgB,SAAS,eAAA;OAE1D,sBAAA,cAAChB,OAAAA;MAAIE,WAAU;OACb,sBAAA,cAACI,KAAKW,WAAS;MAACF,YAAW;OAAYhC,KAAKS,IAAI,GAC/CF,cAAcP,IAAAA,KACb,sBAAA,cAACiB,OAAAA;MAAIE,WAAU;OAAqCZ,cAAcP,IAAAA,CAAAA,CAAAA,GAGrEJ,oBAAoBI,KAAKf,EAAE,KAC1B,sBAAA,cAACkD,QAAAA;MAAOC,SAAS,MAAM1B,iBAAiBV,IAAAA;OAAQlB,EAAE,oCAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAS/DI,UAAUoC,WAAW,KAAK,sBAAA,cAACL,OAAAA;MAAIE,WAAU;OAAmCrC,EAAE,oBAAA,CAAA,CAAA;;;;AAGrF;;;ACzFA,IAAA,yBAAeuD;",
6
- "names": ["Schema", "React", "useCallback", "useMemo", "LayoutAction", "createIntent", "useIntentDispatcher", "FunctionType", "ScriptType", "Filter", "fullyQualifiedId", "useQuery", "Button", "useTranslation", "controlItemClasses", "List", "ghostHover", "mx", "grid", "FunctionsPanel", "space", "t", "useTranslation", "meta", "id", "functions", "useQuery", "Filter", "type", "FunctionType", "scripts", "ScriptType", "dispatchPromise", "dispatch", "useIntentDispatcher", "functionToScriptMap", "useMemo", "reduce", "map", "func", "scriptId", "source", "target", "script", "find", "s", "getScriptName", "useCallback", "name", "handleGoToScript", "createIntent", "LayoutAction", "Open", "part", "subject", "fullyQualifiedId", "div", "role", "className", "mx", "controlItemClasses", "length", "List", "Root", "items", "isItem", "is", "getId", "Item", "key", "item", "classNames", "ghostHover", "ItemTitle", "Button", "onClick", "FunctionsPanel"]
7
- }
@@ -1,161 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationCapabilities
4
- } from "./chunk-WHCSOUNN.mjs";
5
- import "./chunk-5MQJPJR2.mjs";
6
-
7
- // src/capabilities/compute-runtime.ts
8
- import * as Toolkit from "@effect/ai/Toolkit";
9
- import * as BrowserKeyValueStore from "@effect/platform-browser/BrowserKeyValueStore";
10
- import * as Effect from "effect/Effect";
11
- import * as Layer from "effect/Layer";
12
- import * as ManagedRuntime from "effect/ManagedRuntime";
13
- import { Capabilities, contributes } from "@dxos/app-framework";
14
- import { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from "@dxos/assistant";
15
- import { Resource } from "@dxos/context";
16
- import { Query, Ref } from "@dxos/echo";
17
- import { CredentialsService, DatabaseService, FunctionImplementationResolver, FunctionInvocationService, InvocationTracer, LocalFunctionExecutionService, QueueService, RemoteFunctionExecutionService, TriggerDispatcher } from "@dxos/functions";
18
- import { TriggerStateStore } from "@dxos/functions";
19
- import { invariant } from "@dxos/invariant";
20
- import { ClientCapabilities } from "@dxos/plugin-client";
21
- import { PropertiesType } from "@dxos/react-client/echo";
22
- function _check_private_redeclaration(obj, privateCollection) {
23
- if (privateCollection.has(obj)) {
24
- throw new TypeError("Cannot initialize the same private elements twice on an object");
25
- }
26
- }
27
- function _class_apply_descriptor_get(receiver, descriptor) {
28
- if (descriptor.get) {
29
- return descriptor.get.call(receiver);
30
- }
31
- return descriptor.value;
32
- }
33
- function _class_apply_descriptor_set(receiver, descriptor, value) {
34
- if (descriptor.set) {
35
- descriptor.set.call(receiver, value);
36
- } else {
37
- if (!descriptor.writable) {
38
- throw new TypeError("attempted to set read only private field");
39
- }
40
- descriptor.value = value;
41
- }
42
- }
43
- function _class_extract_field_descriptor(receiver, privateMap, action) {
44
- if (!privateMap.has(receiver)) {
45
- throw new TypeError("attempted to " + action + " private field on non-instance");
46
- }
47
- return privateMap.get(receiver);
48
- }
49
- function _class_private_field_get(receiver, privateMap) {
50
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "get");
51
- return _class_apply_descriptor_get(receiver, descriptor);
52
- }
53
- function _class_private_field_init(obj, privateMap, value) {
54
- _check_private_redeclaration(obj, privateMap);
55
- privateMap.set(obj, value);
56
- }
57
- function _class_private_field_set(receiver, privateMap, value) {
58
- var descriptor = _class_extract_field_descriptor(receiver, privateMap, "set");
59
- _class_apply_descriptor_set(receiver, descriptor, value);
60
- return value;
61
- }
62
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-automation/src/capabilities/compute-runtime.ts";
63
- var compute_runtime_default = (async (context) => {
64
- const provider = await new ComputeRuntimeProviderImpl(context).open();
65
- return contributes(AutomationCapabilities.ComputeRuntime, provider, async () => {
66
- await provider.close();
67
- });
68
- });
69
- var _runtimes = /* @__PURE__ */ new WeakMap();
70
- var _context = /* @__PURE__ */ new WeakMap();
71
- var ComputeRuntimeProviderImpl = class extends Resource {
72
- async _open() {
73
- }
74
- async _close() {
75
- await Promise.all(Array.from(_class_private_field_get(this, _runtimes).values()).map((rt) => rt.dispose()));
76
- _class_private_field_get(this, _runtimes).clear();
77
- }
78
- getRuntime(spaceId) {
79
- if (_class_private_field_get(this, _runtimes).has(spaceId)) {
80
- return _class_private_field_get(this, _runtimes).get(spaceId);
81
- }
82
- const layer = Layer.unwrapEffect(Effect.gen(this, function* () {
83
- const client = _class_private_field_get(this, _context).getCapability(ClientCapabilities.Client);
84
- const serviceLayer = _class_private_field_get(this, _context).getCapability(Capabilities.AiServiceLayer) ?? Layer.die("AiService not found");
85
- const functions = _class_private_field_get(this, _context).getCapabilities(Capabilities.Functions);
86
- const toolkits = _class_private_field_get(this, _context).getCapabilities(Capabilities.Toolkit);
87
- const handlers = _class_private_field_get(this, _context).getCapabilities(Capabilities.ToolkitHandler);
88
- const allFunctions = functions.flat();
89
- const toolkit = Toolkit.merge(...toolkits);
90
- const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);
91
- const space = client.spaces.get(spaceId);
92
- invariant(space, void 0, {
93
- F: __dxlog_file,
94
- L: 79,
95
- S: this,
96
- A: [
97
- "space",
98
- ""
99
- ]
100
- });
101
- yield* Effect.promise(() => space.waitUntilReady());
102
- return Layer.mergeAll(TriggerDispatcher.layer({
103
- timeControl: "natural"
104
- })).pipe(Layer.provideMerge(Layer.mergeAll(InvocationTracerLive, TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)), makeToolResolverFromFunctions(allFunctions, toolkit), makeToolExecutionServiceFromFunctions(toolkit, handlersLayer))), Layer.provideMerge(Layer.mergeAll(FunctionInvocationService.layer.pipe(Layer.provideMerge(LocalFunctionExecutionService.layerLive.pipe(Layer.provideMerge(FunctionImplementationResolver.layerTest({
105
- functions: allFunctions
106
- })), Layer.provideMerge(RemoteFunctionExecutionService.fromClient(
107
- client.edge.baseUrl,
108
- // If agent is not enabled do not provide spaceId because space context will be unavailable on EDGE.
109
- client.config.get("runtime.client.edgeFeatures.agents") ? spaceId : void 0
110
- )), Layer.provideMerge(serviceLayer), Layer.provideMerge(CredentialsService.layerFromDatabase()), Layer.provideMerge(space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable), Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable)))))));
111
- }));
112
- const runtime = ManagedRuntime.make(layer);
113
- _class_private_field_get(this, _runtimes).set(spaceId, runtime);
114
- return runtime;
115
- }
116
- constructor(context) {
117
- super(), _class_private_field_init(this, _runtimes, {
118
- writable: true,
119
- value: /* @__PURE__ */ new Map()
120
- }), _class_private_field_init(this, _context, {
121
- writable: true,
122
- value: void 0
123
- });
124
- _class_private_field_set(this, _context, context);
125
- }
126
- };
127
- var InvocationTracerLive = Layer.unwrapEffect(Effect.gen(function* () {
128
- const { objects: [properties] } = yield* DatabaseService.runQuery(Query.type(PropertiesType));
129
- invariant(properties, void 0, {
130
- F: __dxlog_file,
131
- L: 129,
132
- S: this,
133
- A: [
134
- "properties",
135
- ""
136
- ]
137
- });
138
- if (!properties.invocationTraceQueue) {
139
- const queue2 = yield* QueueService.createQueue({
140
- subspaceTag: "trace"
141
- });
142
- properties.invocationTraceQueue = Ref.fromDXN(queue2.dxn);
143
- }
144
- const queue = properties.invocationTraceQueue.target;
145
- invariant(queue, void 0, {
146
- F: __dxlog_file,
147
- L: 135,
148
- S: this,
149
- A: [
150
- "queue",
151
- ""
152
- ]
153
- });
154
- return InvocationTracer.layerLive({
155
- invocationTraceQueue: queue
156
- });
157
- }));
158
- export {
159
- compute_runtime_default as default
160
- };
161
- //# sourceMappingURL=compute-runtime-CMEPAYND.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/compute-runtime.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Toolkit from '@effect/ai/Toolkit';\nimport * as BrowserKeyValueStore from '@effect/platform-browser/BrowserKeyValueStore';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as ManagedRuntime from 'effect/ManagedRuntime';\n\nimport { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';\nimport { makeToolExecutionServiceFromFunctions, makeToolResolverFromFunctions } from '@dxos/assistant';\nimport { Resource } from '@dxos/context';\nimport { Query, Ref } from '@dxos/echo';\nimport {\n CredentialsService,\n DatabaseService,\n FunctionImplementationResolver,\n FunctionInvocationService,\n InvocationTracer,\n LocalFunctionExecutionService,\n QueueService,\n RemoteFunctionExecutionService,\n TriggerDispatcher,\n} from '@dxos/functions';\nimport { TriggerStateStore } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { type SpaceId } from '@dxos/keys';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { PropertiesType } from '@dxos/react-client/echo';\n\nimport { AutomationCapabilities } from './capabilities';\n\nexport default async (context: PluginContext) => {\n const provider = await new ComputeRuntimeProviderImpl(context).open();\n return contributes(AutomationCapabilities.ComputeRuntime, provider, async () => {\n await provider.close();\n });\n};\n\nclass ComputeRuntimeProviderImpl extends Resource implements AutomationCapabilities.ComputeRuntimeProvider {\n readonly #runtimes = new Map<SpaceId, AutomationCapabilities.ComputeRuntime>();\n readonly #context: PluginContext;\n\n constructor(context: PluginContext) {\n super();\n this.#context = context;\n }\n\n protected override async _open() {}\n\n protected override async _close() {\n await Promise.all(Array.from(this.#runtimes.values()).map((rt) => rt.dispose()));\n this.#runtimes.clear();\n }\n\n getRuntime(spaceId: SpaceId): AutomationCapabilities.ComputeRuntime {\n if (this.#runtimes.has(spaceId)) {\n return this.#runtimes.get(spaceId)!;\n }\n\n const layer = Layer.unwrapEffect(\n Effect.gen(this, function* () {\n const client = this.#context.getCapability(ClientCapabilities.Client);\n const serviceLayer =\n this.#context.getCapability(Capabilities.AiServiceLayer) ?? Layer.die('AiService not found');\n\n // TODO(dmaretskyi): Make those reactive.\n const functions = this.#context.getCapabilities(Capabilities.Functions);\n const toolkits = this.#context.getCapabilities(Capabilities.Toolkit);\n const handlers = this.#context.getCapabilities(Capabilities.ToolkitHandler);\n\n const allFunctions = functions.flat();\n // TODO(wittjosiah): Don't cast.\n const toolkit = Toolkit.merge(...toolkits) as Toolkit.Toolkit<any>;\n const handlersLayer = Layer.mergeAll(Layer.empty, ...handlers);\n\n const space = client.spaces.get(spaceId);\n invariant(space);\n yield* Effect.promise(() => space.waitUntilReady());\n\n return Layer.mergeAll(TriggerDispatcher.layer({ timeControl: 'natural' })).pipe(\n Layer.provideMerge(\n Layer.mergeAll(\n InvocationTracerLive,\n TriggerStateStore.layerKv.pipe(Layer.provide(BrowserKeyValueStore.layerLocalStorage)),\n makeToolResolverFromFunctions(allFunctions, toolkit),\n makeToolExecutionServiceFromFunctions(toolkit, handlersLayer),\n ),\n ),\n Layer.provideMerge(\n Layer.mergeAll(\n FunctionInvocationService.layer.pipe(\n Layer.provideMerge(\n LocalFunctionExecutionService.layerLive.pipe(\n Layer.provideMerge(FunctionImplementationResolver.layerTest({ functions: allFunctions })),\n Layer.provideMerge(\n RemoteFunctionExecutionService.fromClient(\n client.edge.baseUrl,\n // If agent is not enabled do not provide spaceId because space context will be unavailable on EDGE.\n client.config.get('runtime.client.edgeFeatures.agents') ? spaceId : undefined,\n ),\n ),\n Layer.provideMerge(serviceLayer),\n Layer.provideMerge(CredentialsService.layerFromDatabase()),\n Layer.provideMerge(space ? DatabaseService.layer(space.db) : DatabaseService.notAvailable),\n Layer.provideMerge(space ? QueueService.layer(space.queues) : QueueService.notAvailable),\n ),\n ),\n ),\n ),\n ),\n );\n }),\n );\n\n const runtime = ManagedRuntime.make(layer);\n this.#runtimes.set(spaceId, runtime);\n\n return runtime;\n }\n}\n\nconst InvocationTracerLive = Layer.unwrapEffect(\n Effect.gen(function* () {\n const {\n objects: [properties],\n } = yield* DatabaseService.runQuery(Query.type(PropertiesType));\n invariant(properties);\n if (!properties.invocationTraceQueue) {\n const queue = yield* QueueService.createQueue({ subspaceTag: 'trace' });\n properties.invocationTraceQueue = Ref.fromDXN(queue.dxn);\n }\n const queue = properties.invocationTraceQueue.target;\n invariant(queue);\n return InvocationTracer.layerLive({ invocationTraceQueue: queue });\n }),\n);\n"],
5
- "mappings": "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",
6
- "names": ["Toolkit", "BrowserKeyValueStore", "Effect", "Layer", "ManagedRuntime", "Capabilities", "contributes", "makeToolExecutionServiceFromFunctions", "makeToolResolverFromFunctions", "Resource", "Query", "Ref", "CredentialsService", "DatabaseService", "FunctionImplementationResolver", "FunctionInvocationService", "InvocationTracer", "LocalFunctionExecutionService", "QueueService", "RemoteFunctionExecutionService", "TriggerDispatcher", "TriggerStateStore", "invariant", "ClientCapabilities", "PropertiesType", "context", "provider", "ComputeRuntimeProviderImpl", "open", "contributes", "AutomationCapabilities", "ComputeRuntime", "close", "Resource", "_open", "_close", "Promise", "all", "Array", "from", "values", "map", "rt", "dispose", "clear", "getRuntime", "spaceId", "has", "get", "layer", "unwrapEffect", "gen", "client", "getCapability", "ClientCapabilities", "Client", "serviceLayer", "Capabilities", "AiServiceLayer", "die", "functions", "getCapabilities", "Functions", "toolkits", "Toolkit", "handlers", "ToolkitHandler", "allFunctions", "flat", "toolkit", "merge", "handlersLayer", "mergeAll", "empty", "space", "spaces", "invariant", "promise", "waitUntilReady", "TriggerDispatcher", "timeControl", "pipe", "provideMerge", "InvocationTracerLive", "TriggerStateStore", "layerKv", "provide", "layerLocalStorage", "makeToolResolverFromFunctions", "makeToolExecutionServiceFromFunctions", "FunctionInvocationService", "LocalFunctionExecutionService", "layerLive", "FunctionImplementationResolver", "layerTest", "RemoteFunctionExecutionService", "fromClient", "edge", "baseUrl", "config", "undefined", "CredentialsService", "layerFromDatabase", "DatabaseService", "db", "notAvailable", "QueueService", "queues", "runtime", "make", "set", "Map", "objects", "properties", "runQuery", "Query", "type", "PropertiesType", "invocationTraceQueue", "queue", "createQueue", "subspaceTag", "Ref", "fromDXN", "dxn", "target", "InvocationTracer"]
7
- }
@@ -1,78 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationAction
4
- } from "./chunk-CJUI6AKX.mjs";
5
- import "./chunk-5MQJPJR2.mjs";
6
-
7
- // src/capabilities/intent-resolver.ts
8
- import { Capabilities, LayoutAction, contributes, createIntent, createResolver } from "@dxos/app-framework";
9
- import { Obj, Ref } from "@dxos/echo";
10
- import { FunctionTrigger, FunctionType, ScriptType } from "@dxos/functions";
11
- import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/plugin-deck/types";
12
- import { SpaceAction } from "@dxos/plugin-space/types";
13
- import { Filter } from "@dxos/react-client/echo";
14
- var intent_resolver_default = ((context) => contributes(Capabilities.IntentResolver, [
15
- createResolver({
16
- intent: AutomationAction.CreateTriggerFromTemplate,
17
- resolve: async ({ space, template, enabled = false, scriptName, input }) => {
18
- const trigger = Obj.make(FunctionTrigger, {
19
- enabled,
20
- input
21
- });
22
- if (scriptName) {
23
- const { objects: [script] } = await space.db.query(Filter.type(ScriptType, {
24
- name: scriptName
25
- })).run();
26
- if (script) {
27
- const { objects: [fn] } = await space.db.query(Filter.type(FunctionType, {
28
- source: Ref.make(script)
29
- })).run();
30
- if (fn) {
31
- trigger.function = Ref.make(fn);
32
- }
33
- }
34
- }
35
- switch (template.type) {
36
- case "timer": {
37
- trigger.spec = {
38
- kind: "timer",
39
- cron: template.cron
40
- };
41
- break;
42
- }
43
- case "queue": {
44
- trigger.spec = {
45
- kind: "queue",
46
- queue: template.queueDXN.toString()
47
- };
48
- break;
49
- }
50
- default: {
51
- break;
52
- }
53
- }
54
- return {
55
- intents: [
56
- createIntent(SpaceAction.AddObject, {
57
- object: trigger,
58
- target: space,
59
- hidden: true
60
- }),
61
- createIntent(LayoutAction.Open, {
62
- part: "main",
63
- subject: [
64
- `automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`
65
- ],
66
- options: {
67
- workspace: space.id
68
- }
69
- })
70
- ]
71
- };
72
- }
73
- })
74
- ]));
75
- export {
76
- intent_resolver_default as default
77
- };
78
- //# sourceMappingURL=intent-resolver-2LGBVXT5.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n Capabilities,\n LayoutAction,\n type PluginContext,\n contributes,\n createIntent,\n createResolver,\n} from '@dxos/app-framework';\nimport { Obj, Ref } from '@dxos/echo';\nimport { FunctionTrigger, FunctionType, ScriptType } from '@dxos/functions';\nimport { type DXN } from '@dxos/keys';\nimport { ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { SpaceAction } from '@dxos/plugin-space/types';\nimport { Filter } from '@dxos/react-client/echo';\n\nimport { AutomationAction } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: AutomationAction.CreateTriggerFromTemplate,\n resolve: async ({ space, template, enabled = false, scriptName, input }) => {\n const trigger = Obj.make(FunctionTrigger, { enabled, input });\n\n // TODO(wittjosiah): Factor out function lookup by script name?\n if (scriptName) {\n const {\n objects: [script],\n } = await space.db.query(Filter.type(ScriptType, { name: scriptName })).run();\n if (script) {\n const {\n objects: [fn],\n } = await space.db.query(Filter.type(FunctionType, { source: Ref.make(script) })).run();\n if (fn) {\n trigger.function = Ref.make(fn);\n }\n }\n }\n\n switch (template.type) {\n case 'timer': {\n trigger.spec = { kind: 'timer', cron: template.cron };\n break;\n }\n case 'queue': {\n trigger.spec = { kind: 'queue', queue: (template.queueDXN as DXN).toString() };\n break;\n }\n default: {\n break;\n }\n }\n\n return {\n intents: [\n createIntent(SpaceAction.AddObject, { object: trigger, target: space, hidden: true }),\n createIntent(LayoutAction.Open, {\n part: 'main',\n subject: [`automation-settings${ATTENDABLE_PATH_SEPARATOR}${space.id}`],\n options: {\n workspace: space.id,\n },\n }),\n ],\n };\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;AAIA,SACEA,cACAC,cAEAC,aACAC,cACAC,sBACK;AACP,SAASC,KAAKC,WAAW;AACzB,SAASC,iBAAiBC,cAAcC,kBAAkB;AAE1D,SAASC,iCAAiC;AAC1C,SAASC,mBAAmB;AAC5B,SAASC,cAAc;AAIvB,IAAA,2BAAe,CAACC,YACdC,YAAYC,aAAaC,gBAAgB;EACvCC,eAAe;IACbC,QAAQC,iBAAiBC;IACzBC,SAAS,OAAO,EAAEC,OAAOC,UAAUC,UAAU,OAAOC,YAAYC,MAAK,MAAE;AACrE,YAAMC,UAAUC,IAAIC,KAAKC,iBAAiB;QAAEN;QAASE;MAAM,CAAA;AAG3D,UAAID,YAAY;AACd,cAAM,EACJM,SAAS,CAACC,MAAAA,EAAO,IACf,MAAMV,MAAMW,GAAGC,MAAMC,OAAOC,KAAKC,YAAY;UAAEC,MAAMb;QAAW,CAAA,CAAA,EAAIc,IAAG;AAC3E,YAAIP,QAAQ;AACV,gBAAM,EACJD,SAAS,CAACS,EAAAA,EAAG,IACX,MAAMlB,MAAMW,GAAGC,MAAMC,OAAOC,KAAKK,cAAc;YAAEC,QAAQC,IAAId,KAAKG,MAAAA;UAAQ,CAAA,CAAA,EAAIO,IAAG;AACrF,cAAIC,IAAI;AACNb,oBAAQiB,WAAWD,IAAId,KAAKW,EAAAA;UAC9B;QACF;MACF;AAEA,cAAQjB,SAASa,MAAI;QACnB,KAAK,SAAS;AACZT,kBAAQkB,OAAO;YAAEC,MAAM;YAASC,MAAMxB,SAASwB;UAAK;AACpD;QACF;QACA,KAAK,SAAS;AACZpB,kBAAQkB,OAAO;YAAEC,MAAM;YAASE,OAAQzB,SAAS0B,SAAiBC,SAAQ;UAAG;AAC7E;QACF;QACA,SAAS;AACP;QACF;MACF;AAEA,aAAO;QACLC,SAAS;UACPC,aAAaC,YAAYC,WAAW;YAAEC,QAAQ5B;YAAS6B,QAAQlC;YAAOmC,QAAQ;UAAK,CAAA;UACnFL,aAAaM,aAAaC,MAAM;YAC9BC,MAAM;YACNC,SAAS;cAAC,sBAAsBC,yBAAAA,GAA4BxC,MAAMyC,EAAE;;YACpEC,SAAS;cACPC,WAAW3C,MAAMyC;YACnB;UACF,CAAA;;MAEJ;IACF;EACF,CAAA;CACD;",
6
- "names": ["Capabilities", "LayoutAction", "contributes", "createIntent", "createResolver", "Obj", "Ref", "FunctionTrigger", "FunctionType", "ScriptType", "ATTENDABLE_PATH_SEPARATOR", "SpaceAction", "Filter", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "AutomationAction", "CreateTriggerFromTemplate", "resolve", "space", "template", "enabled", "scriptName", "input", "trigger", "Obj", "make", "FunctionTrigger", "objects", "script", "db", "query", "Filter", "type", "ScriptType", "name", "run", "fn", "FunctionType", "source", "Ref", "function", "spec", "kind", "cron", "queue", "queueDXN", "toString", "intents", "createIntent", "SpaceAction", "AddObject", "object", "target", "hidden", "LayoutAction", "Open", "part", "subject", "ATTENDABLE_PATH_SEPARATOR", "id", "options", "workspace"]
7
- }
@@ -1,64 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- AutomationSettings,
4
- FunctionsContainer
5
- } from "./chunk-B7N3H45O.mjs";
6
- import "./chunk-J3XEBEIE.mjs";
7
- import {
8
- meta
9
- } from "./chunk-5MQJPJR2.mjs";
10
-
11
- // src/capabilities/react-surface.tsx
12
- import React from "react";
13
- import { Capabilities, contributes, createSurface, useLayout } from "@dxos/app-framework";
14
- import { Obj } from "@dxos/echo";
15
- import { getSpace, parseId, useSpace } from "@dxos/react-client/echo";
16
- var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
17
- createSurface({
18
- id: `${meta.id}/space-settings-functions`,
19
- role: "article",
20
- filter: (data) => data.subject === `${meta.id}/space-settings-functions`,
21
- component: () => {
22
- const layout = useLayout();
23
- const { spaceId } = parseId(layout.workspace);
24
- const space = useSpace(spaceId);
25
- if (!space) {
26
- return null;
27
- }
28
- return /* @__PURE__ */ React.createElement(FunctionsContainer, {
29
- space
30
- });
31
- }
32
- }),
33
- createSurface({
34
- id: `${meta.id}/space-settings-automation`,
35
- role: "article",
36
- filter: (data) => data.subject === `${meta.id}/space-settings-automation`,
37
- component: () => {
38
- const layout = useLayout();
39
- const { spaceId } = parseId(layout.workspace);
40
- const space = useSpace(spaceId);
41
- if (!space) {
42
- return null;
43
- }
44
- return /* @__PURE__ */ React.createElement(AutomationSettings, {
45
- space
46
- });
47
- }
48
- }),
49
- createSurface({
50
- id: `${meta.id}/companion/automation`,
51
- role: "article",
52
- filter: (data) => Obj.isObject(data.companionTo) && data.subject === "automation",
53
- component: ({ data }) => {
54
- return /* @__PURE__ */ React.createElement(AutomationSettings, {
55
- space: getSpace(data.companionTo),
56
- object: data.companionTo
57
- });
58
- }
59
- })
60
- ]));
61
- export {
62
- react_surface_default as default
63
- };
64
- //# sourceMappingURL=react-surface-OMZSBDHS.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface, useLayout } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { getSpace, parseId, useSpace } from '@dxos/react-client/echo';\n\nimport { AutomationSettings, FunctionsContainer } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${meta.id}/space-settings-functions`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-functions`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space) {\n return null;\n }\n\n return <FunctionsContainer space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/space-settings-automation`,\n role: 'article',\n filter: (data): data is { subject: string } => data.subject === `${meta.id}/space-settings-automation`,\n component: () => {\n const layout = useLayout();\n const { spaceId } = parseId(layout.workspace);\n const space = useSpace(spaceId);\n if (!space) {\n return null;\n }\n\n return <AutomationSettings space={space} />;\n },\n }),\n createSurface({\n id: `${meta.id}/companion/automation`,\n role: 'article',\n filter: (data): data is { companionTo: Obj.Any; subject: 'automation' } =>\n Obj.isObject(data.companionTo) && data.subject === 'automation',\n component: ({ data }) => {\n return <AutomationSettings space={getSpace(data.companionTo)!} object={data.companionTo} />;\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,eAAeC,iBAAiB;AACpE,SAASC,WAAW;AACpB,SAASC,UAAUC,SAASC,gBAAgB;AAK5C,IAAA,yBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,OAAO;AACV,eAAO;MACT;AAEA,aAAO,sBAAA,cAACE,oBAAAA;QAAmBF;;IAC7B;EACF,CAAA;EACAb,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SAAsCA,KAAKC,YAAY,GAAGJ,KAAKD,EAAE;IAC1EM,WAAW,MAAA;AACT,YAAMC,SAASC,UAAAA;AACf,YAAM,EAAEC,QAAO,IAAKC,QAAQH,OAAOI,SAAS;AAC5C,YAAMC,QAAQC,SAASJ,OAAAA;AACvB,UAAI,CAACG,OAAO;AACV,eAAO;MACT;AAEA,aAAO,sBAAA,cAACG,oBAAAA;QAAmBH;;IAC7B;EACF,CAAA;EACAb,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,QAAQ,CAACC,SACPY,IAAIC,SAASb,KAAKc,WAAW,KAAKd,KAAKC,YAAY;IACrDC,WAAW,CAAC,EAAEF,KAAI,MAAE;AAClB,aAAO,sBAAA,cAACW,oBAAAA;QAAmBH,OAAOO,SAASf,KAAKc,WAAW;QAAIE,QAAQhB,KAAKc;;IAC9E;EACF,CAAA;CACD;",
6
- "names": ["React", "Capabilities", "contributes", "createSurface", "useLayout", "Obj", "getSpace", "parseId", "useSpace", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "subject", "component", "layout", "useLayout", "spaceId", "parseId", "workspace", "space", "useSpace", "FunctionsContainer", "AutomationSettings", "Obj", "isObject", "companionTo", "getSpace", "object"]
7
- }
@@ -1,19 +0,0 @@
1
- import type * as ManagedRuntime from 'effect/ManagedRuntime';
2
- import { type AiService, type ToolExecutionService, type ToolResolverService } from '@dxos/ai';
3
- import type { CredentialsService, DatabaseService, FunctionInvocationService, InvocationTracer, QueueService, TriggerDispatcher, TriggerStateStore } from '@dxos/functions';
4
- import type { SpaceId } from '@dxos/keys';
5
- export declare namespace AutomationCapabilities {
6
- /**
7
- * Service stack for executing agents, functions, and triggers.
8
- */
9
- type ComputeServices = TriggerDispatcher | AiService.AiService | DatabaseService | QueueService | CredentialsService | FunctionInvocationService | InvocationTracer | TriggerStateStore | ToolResolverService | ToolExecutionService;
10
- type ComputeRuntime = ManagedRuntime.ManagedRuntime<AutomationCapabilities.ComputeServices, never>;
11
- interface ComputeRuntimeProvider {
12
- getRuntime(spaceId: SpaceId): ComputeRuntime;
13
- }
14
- /**
15
- * Runtime for executing agents, functions, and triggers.
16
- */
17
- const ComputeRuntime: import("@dxos/app-framework").InterfaceDef<ComputeRuntimeProvider>;
18
- }
19
- //# sourceMappingURL=capabilities.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/capabilities.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,cAAc,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/F,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1C,yBAAiB,sBAAsB,CAAC;IACtC;;OAEG;IACH,KAAY,eAAe,GACvB,iBAAiB,GACjB,SAAS,CAAC,SAAS,GACnB,eAAe,GACf,YAAY,GACZ,kBAAkB,GAClB,yBAAyB,GACzB,gBAAgB,GAChB,iBAAiB,GAEjB,mBAAmB,GACnB,oBAAoB,CAAC;IAEzB,KAAY,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,sBAAsB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAC1G,UAAiB,sBAAsB;QACrC,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,CAAC;KAC9C;IAED;;OAEG;IACI,MAAM,cAAc,oEAAoF,CAAC;CACjH"}
@@ -1,4 +0,0 @@
1
- import { Capabilities, type PluginContext } from '@dxos/app-framework';
2
- declare const _default: (context: PluginContext) => import("@dxos/app-framework").Capability<import("@dxos/app-framework").InterfaceDef<Capabilities.IntentResolver>>;
3
- export default _default;
4
- //# sourceMappingURL=intent-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,YAAY,EAEZ,KAAK,aAAa,EAInB,MAAM,qBAAqB,CAAC;yBAUb,SAAS,aAAa;AAAtC,wBAkDK"}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { type AutomationPanelProps } from './AutomationPanel';
3
- export declare const AutomationSettings: (props: AutomationPanelProps) => React.JSX.Element;
4
- export default AutomationSettings;
5
- //# sourceMappingURL=AutomationSettings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutomationSettings.d.ts","sourceRoot":"","sources":["../../../../src/components/AutomationSettings.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG/E,eAAO,MAAM,kBAAkB,GAAI,OAAO,oBAAoB,sBAa7D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { type Space } from '@dxos/react-client/echo';
3
- export declare const FunctionsContainer: ({ space }: {
4
- space: Space;
5
- }) => React.JSX.Element;
6
- export default FunctionsContainer;
7
- //# sourceMappingURL=FunctionsContainer.d.ts.map