@dxos/plugin-automation 0.8.4-main.fd6878d → 0.8.4-staging.60fe92afc8

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 (373) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +428 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/AutomationArticle-GN36NUX2.mjs +17 -0
  5. package/dist/lib/neutral/AutomationCompanion-M26WR6VP.mjs +165 -0
  6. package/dist/lib/neutral/AutomationCompanion-M26WR6VP.mjs.map +7 -0
  7. package/dist/lib/neutral/AutomationPlugin.mjs +10 -0
  8. package/dist/lib/neutral/AutomationPlugin.node.mjs +1132 -0
  9. package/dist/lib/neutral/AutomationPlugin.node.mjs.map +7 -0
  10. package/dist/lib/neutral/AutomationPlugin.workerd.mjs +36 -0
  11. package/dist/lib/neutral/AutomationPlugin.workerd.mjs.map +7 -0
  12. package/dist/lib/neutral/AutomationSettings-YXUJDRQA.mjs +27 -0
  13. package/dist/lib/neutral/AutomationSettings-YXUJDRQA.mjs.map +7 -0
  14. package/dist/lib/neutral/TriggerSettings-XCHIZPOR.mjs +9 -0
  15. package/dist/lib/neutral/app-graph-builder-BTTHS4VK.mjs +102 -0
  16. package/dist/lib/neutral/app-graph-builder-BTTHS4VK.mjs.map +7 -0
  17. package/dist/lib/neutral/capabilities/index.mjs +25 -0
  18. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  19. package/dist/lib/neutral/capabilities/node.mjs +19 -0
  20. package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-24JKY6NU.mjs +21 -0
  22. package/dist/lib/neutral/chunk-24JKY6NU.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-2JP77CMN.mjs +42 -0
  24. package/dist/lib/neutral/chunk-2JP77CMN.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-DUGOIM7G.mjs +36 -0
  26. package/dist/lib/neutral/chunk-DUGOIM7G.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-FE7YFBX7.mjs +486 -0
  28. package/dist/lib/neutral/chunk-FE7YFBX7.mjs.map +7 -0
  29. package/dist/lib/neutral/chunk-GARB7S5R.mjs +157 -0
  30. package/dist/lib/neutral/chunk-GARB7S5R.mjs.map +7 -0
  31. package/dist/lib/neutral/chunk-HPUHQ3L6.mjs +64 -0
  32. package/dist/lib/neutral/chunk-HPUHQ3L6.mjs.map +7 -0
  33. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  34. package/dist/lib/neutral/chunk-SONGOJRB.mjs +8 -0
  35. package/dist/lib/neutral/chunk-SONGOJRB.mjs.map +7 -0
  36. package/dist/lib/neutral/components/index.mjs +48 -0
  37. package/dist/lib/neutral/components/index.mjs.map +7 -0
  38. package/dist/lib/neutral/containers/index.mjs +15 -0
  39. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  40. package/dist/lib/neutral/create-automation-OE3TNXYE.mjs +41 -0
  41. package/dist/lib/neutral/create-automation-OE3TNXYE.mjs.map +7 -0
  42. package/dist/lib/neutral/create-object-MEJOWGMH.mjs +25 -0
  43. package/dist/lib/neutral/create-object-MEJOWGMH.mjs.map +7 -0
  44. package/dist/lib/neutral/create-trigger-from-template-TERHKWJM.mjs +68 -0
  45. package/dist/lib/neutral/create-trigger-from-template-TERHKWJM.mjs.map +7 -0
  46. package/dist/lib/neutral/hooks/index.mjs +47 -0
  47. package/dist/lib/neutral/hooks/index.mjs.map +7 -0
  48. package/dist/lib/neutral/index.mjs +22 -0
  49. package/dist/lib/neutral/layer-specs-G6GCH7BE.mjs +137 -0
  50. package/dist/lib/neutral/layer-specs-G6GCH7BE.mjs.map +7 -0
  51. package/dist/lib/neutral/meta.json +1 -0
  52. package/dist/lib/neutral/meta.mjs +8 -0
  53. package/dist/lib/neutral/navigation-resolver-I3L5FHJO.mjs +14 -0
  54. package/dist/lib/neutral/navigation-resolver-I3L5FHJO.mjs.map +7 -0
  55. package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs +13 -0
  56. package/dist/lib/neutral/operation-handler-YXGYH5W5.mjs.map +7 -0
  57. package/dist/lib/neutral/operations/index.mjs +8 -0
  58. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  59. package/dist/lib/neutral/plugin.mjs +16 -0
  60. package/dist/lib/neutral/plugin.mjs.map +7 -0
  61. package/dist/lib/neutral/react-surface-IBRWUKPC.mjs +54 -0
  62. package/dist/lib/neutral/react-surface-IBRWUKPC.mjs.map +7 -0
  63. package/dist/lib/neutral/registry-sync-G6TKKZGK.mjs +86 -0
  64. package/dist/lib/neutral/registry-sync-G6TKKZGK.mjs.map +7 -0
  65. package/dist/lib/neutral/templates-ETXVD3VE.mjs +16 -0
  66. package/dist/lib/neutral/templates-ETXVD3VE.mjs.map +7 -0
  67. package/dist/lib/neutral/testing.mjs +8 -0
  68. package/dist/lib/neutral/testing.mjs.map +7 -0
  69. package/dist/lib/neutral/translations.mjs +64 -0
  70. package/dist/lib/neutral/translations.mjs.map +7 -0
  71. package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs +77 -0
  72. package/dist/lib/neutral/trigger-runtime-controller-BOEJYGWC.mjs.map +7 -0
  73. package/dist/lib/neutral/types/index.mjs +18 -0
  74. package/dist/lib/neutral/types/index.mjs.map +7 -0
  75. package/dist/types/src/AutomationPlugin.d.ts +3 -1
  76. package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
  77. package/dist/types/src/AutomationPlugin.node.d.ts +4 -0
  78. package/dist/types/src/AutomationPlugin.node.d.ts.map +1 -0
  79. package/dist/types/src/AutomationPlugin.test.d.ts +2 -0
  80. package/dist/types/src/AutomationPlugin.test.d.ts.map +1 -0
  81. package/dist/types/src/AutomationPlugin.workerd.d.ts +4 -0
  82. package/dist/types/src/AutomationPlugin.workerd.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  84. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  85. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  86. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  87. package/dist/types/src/capabilities/create-object.test.d.ts +2 -0
  88. package/dist/types/src/capabilities/create-object.test.d.ts.map +1 -0
  89. package/dist/types/src/capabilities/index.d.ts +16 -3
  90. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  91. package/dist/types/src/capabilities/layer-specs.d.ts +6 -0
  92. package/dist/types/src/capabilities/layer-specs.d.ts.map +1 -0
  93. package/dist/types/src/capabilities/navigation-resolver.d.ts +6 -0
  94. package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
  95. package/dist/types/src/capabilities/node.d.ts +9 -0
  96. package/dist/types/src/capabilities/node.d.ts.map +1 -0
  97. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  98. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  99. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  100. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  101. package/dist/types/src/capabilities/registry-sync.d.ts +21 -0
  102. package/dist/types/src/capabilities/registry-sync.d.ts.map +1 -0
  103. package/dist/types/src/capabilities/templates.d.ts +6 -0
  104. package/dist/types/src/capabilities/templates.d.ts.map +1 -0
  105. package/dist/types/src/capabilities/trigger-runtime-controller.d.ts +5 -0
  106. package/dist/types/src/capabilities/trigger-runtime-controller.d.ts.map +1 -0
  107. package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts +2 -0
  108. package/dist/types/src/capabilities/trigger-runtime-controller.test.d.ts.map +1 -0
  109. package/dist/types/src/commands/index.d.ts +2 -0
  110. package/dist/types/src/commands/index.d.ts.map +1 -0
  111. package/dist/types/src/commands/trigger/create/index.d.ts +25 -0
  112. package/dist/types/src/commands/trigger/create/index.d.ts.map +1 -0
  113. package/dist/types/src/commands/trigger/create/queue.d.ts +13 -0
  114. package/dist/types/src/commands/trigger/create/queue.d.ts.map +1 -0
  115. package/dist/types/src/commands/trigger/create/subscription.d.ts +15 -0
  116. package/dist/types/src/commands/trigger/create/subscription.d.ts.map +1 -0
  117. package/dist/types/src/commands/trigger/create/timer.d.ts +13 -0
  118. package/dist/types/src/commands/trigger/create/timer.d.ts.map +1 -0
  119. package/dist/types/src/commands/trigger/index.d.ts +57 -0
  120. package/dist/types/src/commands/trigger/index.d.ts.map +1 -0
  121. package/dist/types/src/commands/trigger/list.d.ts +7 -0
  122. package/dist/types/src/commands/trigger/list.d.ts.map +1 -0
  123. package/dist/types/src/commands/trigger/options.d.ts +10 -0
  124. package/dist/types/src/commands/trigger/options.d.ts.map +1 -0
  125. package/dist/types/src/commands/trigger/remove.d.ts +8 -0
  126. package/dist/types/src/commands/trigger/remove.d.ts.map +1 -0
  127. package/dist/types/src/commands/trigger/update/index.d.ts +28 -0
  128. package/dist/types/src/commands/trigger/update/index.d.ts.map +1 -0
  129. package/dist/types/src/commands/trigger/update/queue.d.ts +11 -0
  130. package/dist/types/src/commands/trigger/update/queue.d.ts.map +1 -0
  131. package/dist/types/src/commands/trigger/update/subscription.d.ts +13 -0
  132. package/dist/types/src/commands/trigger/update/subscription.d.ts.map +1 -0
  133. package/dist/types/src/commands/trigger/update/timer.d.ts +11 -0
  134. package/dist/types/src/commands/trigger/update/timer.d.ts.map +1 -0
  135. package/dist/types/src/commands/trigger/util.d.ts +85 -0
  136. package/dist/types/src/commands/trigger/util.d.ts.map +1 -0
  137. package/dist/types/src/components/CreateAutomationPanel/CreateAutomationPanel.d.ts +14 -0
  138. package/dist/types/src/components/CreateAutomationPanel/CreateAutomationPanel.d.ts.map +1 -0
  139. package/dist/types/src/components/CreateAutomationPanel/index.d.ts +2 -0
  140. package/dist/types/src/components/CreateAutomationPanel/index.d.ts.map +1 -0
  141. package/dist/types/src/components/index.d.ts +1 -7
  142. package/dist/types/src/components/index.d.ts.map +1 -1
  143. package/dist/types/src/containers/AutomationArticle/AutomationArticle.d.ts +35 -0
  144. package/dist/types/src/containers/AutomationArticle/AutomationArticle.d.ts.map +1 -0
  145. package/dist/types/src/containers/AutomationArticle/index.d.ts +3 -0
  146. package/dist/types/src/containers/AutomationArticle/index.d.ts.map +1 -0
  147. package/dist/types/src/containers/AutomationCompanion/AutomationCompanion.d.ts +13 -0
  148. package/dist/types/src/containers/AutomationCompanion/AutomationCompanion.d.ts.map +1 -0
  149. package/dist/types/src/containers/AutomationCompanion/index.d.ts +3 -0
  150. package/dist/types/src/containers/AutomationCompanion/index.d.ts.map +1 -0
  151. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts +10 -0
  152. package/dist/types/src/containers/AutomationSettings/AutomationSettings.d.ts.map +1 -0
  153. package/dist/types/src/containers/AutomationSettings/index.d.ts +2 -0
  154. package/dist/types/src/containers/AutomationSettings/index.d.ts.map +1 -0
  155. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts +6 -0
  156. package/dist/types/src/containers/TriggerSettings/TriggerSettings.d.ts.map +1 -0
  157. package/dist/types/src/containers/TriggerSettings/index.d.ts +3 -0
  158. package/dist/types/src/containers/TriggerSettings/index.d.ts.map +1 -0
  159. package/dist/types/src/containers/index.d.ts +6 -0
  160. package/dist/types/src/containers/index.d.ts.map +1 -0
  161. package/dist/types/src/hooks/index.d.ts +2 -0
  162. package/dist/types/src/hooks/index.d.ts.map +1 -0
  163. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts +12 -0
  164. package/dist/types/src/hooks/useTriggerRuntimeControls.d.ts.map +1 -0
  165. package/dist/types/src/index.d.ts +1 -2
  166. package/dist/types/src/index.d.ts.map +1 -1
  167. package/dist/types/src/meta.d.ts +2 -3
  168. package/dist/types/src/meta.d.ts.map +1 -1
  169. package/dist/types/src/operations/create-automation.d.ts +5 -0
  170. package/dist/types/src/operations/create-automation.d.ts.map +1 -0
  171. package/dist/types/src/operations/create-trigger-from-template.d.ts +5 -0
  172. package/dist/types/src/operations/create-trigger-from-template.d.ts.map +1 -0
  173. package/dist/types/src/operations/index.d.ts +3 -0
  174. package/dist/types/src/operations/index.d.ts.map +1 -0
  175. package/dist/types/src/paths.d.ts +3 -0
  176. package/dist/types/src/paths.d.ts.map +1 -0
  177. package/dist/types/src/plugin.d.ts +4 -0
  178. package/dist/types/src/plugin.d.ts.map +1 -0
  179. package/dist/types/src/templates/index.d.ts +10 -0
  180. package/dist/types/src/templates/index.d.ts.map +1 -0
  181. package/dist/types/src/testing/test-functions.d.ts +318 -3
  182. package/dist/types/src/testing/test-functions.d.ts.map +1 -1
  183. package/dist/types/src/testing.d.ts +2 -0
  184. package/dist/types/src/testing.d.ts.map +1 -0
  185. package/dist/types/src/translations.d.ts +90 -26
  186. package/dist/types/src/translations.d.ts.map +1 -1
  187. package/dist/types/src/types/Automation.d.ts +41 -0
  188. package/dist/types/src/types/Automation.d.ts.map +1 -0
  189. package/dist/types/src/types/Automation.test.d.ts +2 -0
  190. package/dist/types/src/types/Automation.test.d.ts.map +1 -0
  191. package/dist/types/src/types/AutomationCapabilities.d.ts +42 -0
  192. package/dist/types/src/types/AutomationCapabilities.d.ts.map +1 -0
  193. package/dist/types/src/types/AutomationOperation.d.ts +31 -0
  194. package/dist/types/src/types/AutomationOperation.d.ts.map +1 -0
  195. package/dist/types/src/types/Runnable.d.ts +14 -0
  196. package/dist/types/src/types/Runnable.d.ts.map +1 -0
  197. package/dist/types/src/types/index.d.ts +4 -0
  198. package/dist/types/src/types/index.d.ts.map +1 -1
  199. package/dist/types/src/types/schema.d.ts +14 -6
  200. package/dist/types/src/types/schema.d.ts.map +1 -1
  201. package/dist/types/src/util/automations-for-object.d.ts +20 -0
  202. package/dist/types/src/util/automations-for-object.d.ts.map +1 -0
  203. package/dist/types/src/util/automations-for-object.test.d.ts +2 -0
  204. package/dist/types/src/util/automations-for-object.test.d.ts.map +1 -0
  205. package/dist/types/tsconfig.tsbuildinfo +1 -1
  206. package/package.json +140 -52
  207. package/src/AutomationPlugin.node.ts +48 -0
  208. package/src/AutomationPlugin.test.ts +27 -0
  209. package/src/AutomationPlugin.tsx +52 -34
  210. package/src/AutomationPlugin.workerd.ts +24 -0
  211. package/src/capabilities/app-graph-builder.ts +82 -78
  212. package/src/capabilities/create-object.test.ts +18 -0
  213. package/src/capabilities/create-object.ts +26 -0
  214. package/src/capabilities/index.ts +17 -4
  215. package/src/capabilities/layer-specs.ts +196 -0
  216. package/src/capabilities/navigation-resolver.ts +19 -0
  217. package/src/capabilities/node.ts +19 -0
  218. package/src/capabilities/operation-handler.ts +16 -0
  219. package/src/capabilities/react-surface.tsx +45 -46
  220. package/src/capabilities/registry-sync.ts +114 -0
  221. package/src/capabilities/templates.ts +17 -0
  222. package/src/capabilities/trigger-runtime-controller.test.ts +107 -0
  223. package/src/capabilities/trigger-runtime-controller.ts +126 -0
  224. package/src/commands/index.ts +5 -0
  225. package/src/commands/trigger/create/index.ts +14 -0
  226. package/src/commands/trigger/create/queue.ts +87 -0
  227. package/src/commands/trigger/create/subscription.ts +126 -0
  228. package/src/commands/trigger/create/timer.ts +90 -0
  229. package/src/commands/trigger/index.ts +16 -0
  230. package/src/commands/trigger/list.ts +69 -0
  231. package/src/commands/trigger/options.ts +47 -0
  232. package/src/commands/trigger/remove.ts +45 -0
  233. package/src/commands/trigger/update/index.ts +14 -0
  234. package/src/commands/trigger/update/queue.ts +191 -0
  235. package/src/commands/trigger/update/subscription.ts +279 -0
  236. package/src/commands/trigger/update/timer.ts +195 -0
  237. package/src/commands/trigger/util.ts +410 -0
  238. package/src/components/CreateAutomationPanel/CreateAutomationPanel.tsx +68 -0
  239. package/src/components/CreateAutomationPanel/index.ts +5 -0
  240. package/src/components/index.ts +1 -8
  241. package/src/containers/AutomationArticle/AutomationArticle.tsx +586 -0
  242. package/src/containers/AutomationArticle/index.ts +6 -0
  243. package/src/containers/AutomationCompanion/AutomationCompanion.tsx +183 -0
  244. package/src/containers/AutomationCompanion/index.ts +6 -0
  245. package/src/containers/AutomationSettings/AutomationSettings.tsx +34 -0
  246. package/src/containers/AutomationSettings/index.ts +5 -0
  247. package/src/containers/TriggerSettings/TriggerSettings.tsx +48 -0
  248. package/src/containers/TriggerSettings/index.ts +6 -0
  249. package/src/containers/index.ts +10 -0
  250. package/src/hooks/index.ts +6 -0
  251. package/src/hooks/useTriggerRuntimeControls.ts +72 -0
  252. package/src/index.ts +1 -3
  253. package/src/meta.ts +26 -9
  254. package/src/operations/create-automation.ts +38 -0
  255. package/src/operations/create-trigger-from-template.ts +70 -0
  256. package/src/operations/index.ts +10 -0
  257. package/src/paths.ts +13 -0
  258. package/src/plugin.ts +11 -0
  259. package/src/templates/index.ts +22 -0
  260. package/src/testing/test-functions.ts +44 -10
  261. package/src/testing.ts +7 -0
  262. package/src/translations.ts +49 -26
  263. package/src/types/Automation.test.ts +37 -0
  264. package/src/types/Automation.ts +45 -0
  265. package/src/types/AutomationCapabilities.ts +52 -0
  266. package/src/types/AutomationOperation.ts +61 -0
  267. package/src/types/Runnable.ts +14 -0
  268. package/src/types/index.ts +5 -0
  269. package/src/types/schema.ts +7 -7
  270. package/src/util/automations-for-object.test.ts +86 -0
  271. package/src/util/automations-for-object.ts +72 -0
  272. package/src/vite-env.d.ts +10 -0
  273. package/dist/lib/browser/AutomationContainer-5UYKI7EG.mjs +0 -38
  274. package/dist/lib/browser/AutomationContainer-5UYKI7EG.mjs.map +0 -7
  275. package/dist/lib/browser/AutomationPanel-YYERBNYJ.mjs +0 -11
  276. package/dist/lib/browser/FunctionsContainer-VOGKIPHA.mjs +0 -39
  277. package/dist/lib/browser/FunctionsContainer-VOGKIPHA.mjs.map +0 -7
  278. package/dist/lib/browser/FunctionsPanel-I443Y6KB.mjs +0 -10
  279. package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs +0 -80
  280. package/dist/lib/browser/app-graph-builder-4OFKIRAI.mjs.map +0 -7
  281. package/dist/lib/browser/chunk-7EE4SA6M.mjs +0 -230
  282. package/dist/lib/browser/chunk-7EE4SA6M.mjs.map +0 -7
  283. package/dist/lib/browser/chunk-CHENFUQ6.mjs +0 -14
  284. package/dist/lib/browser/chunk-CHENFUQ6.mjs.map +0 -7
  285. package/dist/lib/browser/chunk-GW5U2DGT.mjs +0 -15
  286. package/dist/lib/browser/chunk-GW5U2DGT.mjs.map +0 -7
  287. package/dist/lib/browser/chunk-HN7OHFCB.mjs +0 -38
  288. package/dist/lib/browser/chunk-HN7OHFCB.mjs.map +0 -7
  289. package/dist/lib/browser/chunk-OX6OW6XP.mjs +0 -147
  290. package/dist/lib/browser/chunk-OX6OW6XP.mjs.map +0 -7
  291. package/dist/lib/browser/chunk-Z5DT4MHW.mjs +0 -94
  292. package/dist/lib/browser/chunk-Z5DT4MHW.mjs.map +0 -7
  293. package/dist/lib/browser/index.mjs +0 -101
  294. package/dist/lib/browser/index.mjs.map +0 -7
  295. package/dist/lib/browser/intent-resolver-YZP6RKTR.mjs +0 -76
  296. package/dist/lib/browser/intent-resolver-YZP6RKTR.mjs.map +0 -7
  297. package/dist/lib/browser/meta.json +0 -1
  298. package/dist/lib/browser/react-surface-WNOIIT4O.mjs +0 -64
  299. package/dist/lib/browser/react-surface-WNOIIT4O.mjs.map +0 -7
  300. package/dist/lib/browser/types/index.mjs +0 -8
  301. package/dist/lib/node-esm/AutomationContainer-EZMY6DTD.mjs +0 -39
  302. package/dist/lib/node-esm/AutomationContainer-EZMY6DTD.mjs.map +0 -7
  303. package/dist/lib/node-esm/AutomationPanel-5EQQF5S2.mjs +0 -12
  304. package/dist/lib/node-esm/FunctionsContainer-IHLMLXHH.mjs +0 -40
  305. package/dist/lib/node-esm/FunctionsContainer-IHLMLXHH.mjs.map +0 -7
  306. package/dist/lib/node-esm/FunctionsPanel-ELINCXPW.mjs +0 -11
  307. package/dist/lib/node-esm/app-graph-builder-555IHYOB.mjs +0 -81
  308. package/dist/lib/node-esm/app-graph-builder-555IHYOB.mjs.map +0 -7
  309. package/dist/lib/node-esm/chunk-CX2AILIS.mjs +0 -95
  310. package/dist/lib/node-esm/chunk-CX2AILIS.mjs.map +0 -7
  311. package/dist/lib/node-esm/chunk-D4VWZD53.mjs +0 -16
  312. package/dist/lib/node-esm/chunk-D4VWZD53.mjs.map +0 -7
  313. package/dist/lib/node-esm/chunk-GHRG4NQV.mjs +0 -148
  314. package/dist/lib/node-esm/chunk-GHRG4NQV.mjs.map +0 -7
  315. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs +0 -17
  316. package/dist/lib/node-esm/chunk-NK5N3QKD.mjs.map +0 -7
  317. package/dist/lib/node-esm/chunk-OEZNHUL2.mjs +0 -39
  318. package/dist/lib/node-esm/chunk-OEZNHUL2.mjs.map +0 -7
  319. package/dist/lib/node-esm/chunk-YPUO4IVX.mjs +0 -231
  320. package/dist/lib/node-esm/chunk-YPUO4IVX.mjs.map +0 -7
  321. package/dist/lib/node-esm/index.mjs +0 -102
  322. package/dist/lib/node-esm/index.mjs.map +0 -7
  323. package/dist/lib/node-esm/intent-resolver-TSLQE27W.mjs +0 -77
  324. package/dist/lib/node-esm/intent-resolver-TSLQE27W.mjs.map +0 -7
  325. package/dist/lib/node-esm/meta.json +0 -1
  326. package/dist/lib/node-esm/react-surface-K6MQFIAS.mjs +0 -65
  327. package/dist/lib/node-esm/react-surface-K6MQFIAS.mjs.map +0 -7
  328. package/dist/lib/node-esm/types/index.mjs +0 -9
  329. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  330. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  331. package/dist/types/src/components/AutomationContainer.d.ts +0 -5
  332. package/dist/types/src/components/AutomationContainer.d.ts.map +0 -1
  333. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +0 -12
  334. package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +0 -1
  335. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts +0 -6
  336. package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +0 -1
  337. package/dist/types/src/components/AutomationPanel/index.d.ts +0 -4
  338. package/dist/types/src/components/AutomationPanel/index.d.ts.map +0 -1
  339. package/dist/types/src/components/FunctionsContainer.d.ts +0 -7
  340. package/dist/types/src/components/FunctionsContainer.d.ts.map +0 -1
  341. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts +0 -7
  342. package/dist/types/src/components/FunctionsPanel/FunctionsPanel.d.ts.map +0 -1
  343. package/dist/types/src/components/FunctionsPanel/index.d.ts +0 -4
  344. package/dist/types/src/components/FunctionsPanel/index.d.ts.map +0 -1
  345. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts +0 -12
  346. package/dist/types/src/components/TriggerEditor/FunctionInputEditor.d.ts.map +0 -1
  347. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts +0 -5
  348. package/dist/types/src/components/TriggerEditor/SpecSelector.d.ts.map +0 -1
  349. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts +0 -11
  350. package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +0 -1
  351. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts +0 -6
  352. package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +0 -1
  353. package/dist/types/src/components/TriggerEditor/index.d.ts +0 -2
  354. package/dist/types/src/components/TriggerEditor/index.d.ts.map +0 -1
  355. package/src/capabilities/intent-resolver.ts +0 -72
  356. package/src/components/AutomationContainer.tsx +0 -31
  357. package/src/components/AutomationPanel/AutomationPanel.stories.tsx +0 -58
  358. package/src/components/AutomationPanel/AutomationPanel.tsx +0 -171
  359. package/src/components/AutomationPanel/index.ts +0 -9
  360. package/src/components/FunctionsContainer.tsx +0 -32
  361. package/src/components/FunctionsPanel/FunctionsPanel.tsx +0 -97
  362. package/src/components/FunctionsPanel/index.ts +0 -8
  363. package/src/components/TriggerEditor/FunctionInputEditor.tsx +0 -78
  364. package/src/components/TriggerEditor/SpecSelector.tsx +0 -59
  365. package/src/components/TriggerEditor/TriggerEditor.stories.tsx +0 -79
  366. package/src/components/TriggerEditor/TriggerEditor.tsx +0 -107
  367. package/src/components/TriggerEditor/index.ts +0 -5
  368. /package/dist/lib/{browser/AutomationPanel-YYERBNYJ.mjs.map → neutral/AutomationArticle-GN36NUX2.mjs.map} +0 -0
  369. /package/dist/lib/{browser/FunctionsPanel-I443Y6KB.mjs.map → neutral/AutomationPlugin.mjs.map} +0 -0
  370. /package/dist/lib/{browser/types/index.mjs.map → neutral/TriggerSettings-XCHIZPOR.mjs.map} +0 -0
  371. /package/dist/lib/{node-esm/AutomationPanel-5EQQF5S2.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  372. /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
  373. /package/dist/lib/{node-esm/FunctionsPanel-ELINCXPW.mjs.map → neutral/meta.mjs.map} +0 -0
@@ -0,0 +1,183 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
6
+
7
+ import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
8
+ import { type Database, Filter, Obj, Type } from '@dxos/echo';
9
+ import { useQuery } from '@dxos/react-client/echo';
10
+ import { DropdownMenu, Icon, Tooltip, useTranslation } from '@dxos/react-ui';
11
+ import { Accordion } from '@dxos/react-ui-list';
12
+
13
+ import { meta } from '#meta';
14
+ import { Automation, AutomationCapabilities, AutomationOperation } from '#types';
15
+
16
+ import { AutomationInlineForm } from '../../containers/AutomationArticle';
17
+ import { connectedAutomationsQuery } from '../../util/automations-for-object';
18
+
19
+ export type AutomationCompanionProps = {
20
+ db: Database.Database;
21
+ object: Obj.Unknown;
22
+ };
23
+
24
+ /** Association state of a row relative to the companion's object. */
25
+ type Status = 'associated' | 'pending' | 'detached';
26
+
27
+ /**
28
+ * Renders the automations connected to an object as an accordion (see `useConnectedAutomations` for the
29
+ * session-stable list it draws from), flagging non-associated rows with a warning badge. New automations are
30
+ * created from a template dropdown (no dialog).
31
+ */
32
+ export const AutomationCompanion = ({ db, object }: AutomationCompanionProps) => {
33
+ const { t } = useTranslation(meta.id);
34
+ const templates = useCapabilities(AutomationCapabilities.Template);
35
+ // Only offer templates applicable to this companion's subject (e.g. a CRM template needs a Mailbox).
36
+ const applicableTemplates = useMemo(
37
+ () => templates.filter((template) => template.appliesTo?.(object) ?? true),
38
+ [templates, object],
39
+ );
40
+ const { items, statusFor, open, setOpen, handleCreate } = useConnectedAutomations(db, object);
41
+
42
+ return (
43
+ <div className='flex flex-col'>
44
+ {items.length === 0 ? (
45
+ <p className='text-sm text-description p-2'>{t('no-automations.message')}</p>
46
+ ) : (
47
+ <Accordion.Root<Automation.Automation> items={items} value={open} onValueChange={setOpen}>
48
+ {({ items }) => (
49
+ <div className='flex flex-col divide-y divide-separator'>
50
+ {items.map((automation) => {
51
+ const status = statusFor(automation.id);
52
+ return (
53
+ <Accordion.Item key={automation.id} item={automation}>
54
+ <Accordion.ItemHeader>
55
+ <Icon icon='ph--lightning--regular' size={4} classNames='mr-2 shrink-0' />
56
+ <span className='flex-1 truncate'>
57
+ {Obj.getLabel(automation) ??
58
+ t('object-name.placeholder', { ns: Type.getTypename(Automation.Automation) })}
59
+ </span>
60
+ {status !== 'associated' && (
61
+ <Tooltip.Trigger
62
+ asChild
63
+ side='bottom'
64
+ content={t(
65
+ status === 'pending' ? 'automation-not-associated.message' : 'automation-detached.message',
66
+ )}
67
+ >
68
+ <Icon icon='ph--warning--regular' size={4} classNames='text-warning-text shrink-0 mr-2' />
69
+ </Tooltip.Trigger>
70
+ )}
71
+ </Accordion.ItemHeader>
72
+ <Accordion.ItemBody>
73
+ <AutomationInlineForm automation={automation} db={db} />
74
+ </Accordion.ItemBody>
75
+ </Accordion.Item>
76
+ );
77
+ })}
78
+ </div>
79
+ )}
80
+ </Accordion.Root>
81
+ )}
82
+
83
+ <div className='border-t border-separator'>
84
+ <DropdownMenu.Root>
85
+ <DropdownMenu.Trigger asChild>
86
+ {/* Mirror the accordion item header layout (p-2 + icon mr-2) so the icon aligns with the rows above. */}
87
+ <button type='button' className='group flex items-center p-2 dx-focus-ring-inset w-full text-start'>
88
+ <Icon icon='ph--plus--regular' size={4} classNames='mr-2 shrink-0' />
89
+ <span className='flex-1 truncate'>
90
+ {t('add-object.label', { ns: Type.getTypename(Automation.Automation) })}
91
+ </span>
92
+ </button>
93
+ </DropdownMenu.Trigger>
94
+ <DropdownMenu.Portal>
95
+ <DropdownMenu.Content>
96
+ <DropdownMenu.Viewport>
97
+ {applicableTemplates.map((template) => (
98
+ <DropdownMenu.Item key={template.id} onClick={() => void handleCreate(template.id)}>
99
+ <Icon icon={template.icon ?? 'ph--lightning--regular'} size={4} />
100
+ <span>{template.label}</span>
101
+ </DropdownMenu.Item>
102
+ ))}
103
+ </DropdownMenu.Viewport>
104
+ <DropdownMenu.Arrow />
105
+ </DropdownMenu.Content>
106
+ </DropdownMenu.Portal>
107
+ </DropdownMenu.Root>
108
+ </div>
109
+ </div>
110
+ );
111
+ };
112
+
113
+ //
114
+ // Hooks
115
+ //
116
+
117
+ /**
118
+ * Owns the companion's session-stable automation list. A reactive reverse-ref query supplies the live
119
+ * connected set, accumulated into an append-only ordering so rows never reorder or disappear while mounted;
120
+ * a row that loses its association (or a freshly-created one not yet connected) is surfaced via `statusFor`
121
+ * rather than dropped. Also holds the accordion open state and a create handler that appends the new
122
+ * automation and auto-expands it for immediate configuration.
123
+ */
124
+ const useConnectedAutomations = (db: Database.Database, object: Obj.Unknown) => {
125
+ const { invokePromise } = useOperationInvoker();
126
+
127
+ // Live connected set (reactive reverse-ref query) + a by-id map for resolving rows that have left it.
128
+ const connected = useQuery(db, connectedAutomationsQuery(object));
129
+ const all = useQuery(db, Filter.type(Automation.Automation));
130
+ const connectedIds = useMemo(() => new Set(connected.map((automation) => automation.id)), [connected]);
131
+ const byId = useMemo(() => new Map(all.map((automation) => [automation.id, automation])), [all]);
132
+
133
+ // Session-stable bookkeeping (held for the component lifetime).
134
+ const seenOrder = useRef<string[]>([]);
135
+ const everConnected = useRef<Set<string>>(new Set());
136
+ const [createdIds, setCreatedIds] = useState<ReadonlySet<string>>(() => new Set());
137
+ const [open, setOpen] = useState<string[]>([]);
138
+
139
+ // Accumulate first-seen order and "was ever connected" — append-only, so rows never reorder or drop.
140
+ for (const id of connectedIds) {
141
+ everConnected.current.add(id);
142
+ }
143
+ for (const id of [...connectedIds, ...createdIds]) {
144
+ if (!seenOrder.current.includes(id)) {
145
+ seenOrder.current.push(id);
146
+ }
147
+ }
148
+
149
+ // Resolve to live objects in stable order, dropping ids whose object was hard-deleted.
150
+ const items = useMemo(
151
+ () =>
152
+ seenOrder.current.flatMap((id) => {
153
+ const automation = byId.get(id);
154
+ return automation ? [automation] : [];
155
+ }),
156
+ [byId, connectedIds, createdIds],
157
+ );
158
+
159
+ const statusFor = useCallback(
160
+ (id: string): Status =>
161
+ connectedIds.has(id) ? 'associated' : everConnected.current.has(id) ? 'detached' : 'pending',
162
+ [connectedIds],
163
+ );
164
+
165
+ const handleCreate = useCallback(
166
+ async (templateId: string) => {
167
+ const { data, error } = await invokePromise(AutomationOperation.CreateAutomation, {
168
+ db,
169
+ templateId,
170
+ subject: object,
171
+ });
172
+ if (error || !data) {
173
+ return;
174
+ }
175
+
176
+ setCreatedIds((prev) => new Set(prev).add(data.object.id));
177
+ setOpen((prev) => (prev.includes(data.object.id) ? prev : [...prev, data.object.id]));
178
+ },
179
+ [invokePromise, db, object],
180
+ );
181
+
182
+ return { items, statusFor, open, setOpen, handleCreate };
183
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ export { AutomationCompanion as default } from './AutomationCompanion';
6
+ export * from './AutomationCompanion';
@@ -0,0 +1,34 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { AppSurface } from '@dxos/app-toolkit/ui';
8
+ import { useTranslation } from '@dxos/react-ui';
9
+ import { Settings } from '@dxos/react-ui-form';
10
+
11
+ import { meta } from '#meta';
12
+
13
+ import { TriggersSettings } from '../TriggerSettings';
14
+
15
+ export type AutomationSettingsProps = AppSurface.SpaceArticleProps;
16
+
17
+ /**
18
+ * Space-level automation settings. Individual automations are now first-class objects (configured in their
19
+ * article + per-object companion), so this page is focused on runtime management — where the space's
20
+ * automations execute.
21
+ */
22
+ export const AutomationSettings = ({ space }: AutomationSettingsProps) => {
23
+ const { t } = useTranslation(meta.id);
24
+ return (
25
+ <Settings.Viewport>
26
+ <Settings.Section
27
+ title={t('automation-verbose.label', { ns: meta.id })}
28
+ description={t('automation.description', { ns: meta.id })}
29
+ >
30
+ <TriggersSettings space={space} />
31
+ </Settings.Section>
32
+ </Settings.Viewport>
33
+ );
34
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { AutomationSettings as default } from './AutomationSettings';
@@ -0,0 +1,48 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { type ComputeEnvironment } from '@dxos/client-protocol';
8
+ import { useObject } from '@dxos/echo-react';
9
+ import { type Space } from '@dxos/react-client/echo';
10
+ import { DropdownMenu, IconButton, useTranslation } from '@dxos/react-ui';
11
+ import { Settings } from '@dxos/react-ui-form';
12
+
13
+ import { meta } from '#meta';
14
+
15
+ export const TriggersSettings = ({ space }: { space: Space }) => {
16
+ const { t } = useTranslation(meta.id);
17
+ const [properties, changeProperties] = useObject(space.properties);
18
+ const selected = properties.computeEnvironment ?? 'local';
19
+
20
+ const handleUpdate = (option: ComputeEnvironment) => {
21
+ changeProperties((draft) => {
22
+ draft.computeEnvironment = option;
23
+ });
24
+ };
25
+
26
+ return (
27
+ <div className='grid grid-cols-1 md:grid-cols-[1fr_min-content]'>
28
+ <Settings.Item title={t('runtime.label')} description={t('runtime.description')}>
29
+ <DropdownMenu.Root>
30
+ <DropdownMenu.Trigger asChild>
31
+ <IconButton iconEnd icon='ph--caret-down--regular' size={4} label={t(`runtime.${selected}.label`)} />
32
+ </DropdownMenu.Trigger>
33
+ <DropdownMenu.Portal>
34
+ <DropdownMenu.Content side='bottom'>
35
+ <DropdownMenu.Viewport>
36
+ <DropdownMenu.Item onClick={() => handleUpdate('disabled')}>
37
+ {t(`runtime.disabled.label`)}
38
+ </DropdownMenu.Item>
39
+ <DropdownMenu.Item onClick={() => handleUpdate('local')}>{t(`runtime.local.label`)}</DropdownMenu.Item>
40
+ <DropdownMenu.Item onClick={() => handleUpdate('edge')}>{t(`runtime.edge.label`)}</DropdownMenu.Item>
41
+ </DropdownMenu.Viewport>
42
+ </DropdownMenu.Content>
43
+ </DropdownMenu.Portal>
44
+ </DropdownMenu.Root>
45
+ </Settings.Item>
46
+ </div>
47
+ );
48
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { TriggersSettings } from './TriggerSettings';
6
+ export { TriggersSettings as default } from './TriggerSettings';
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type ComponentType, lazy } from 'react';
6
+
7
+ export const AutomationArticle: ComponentType<any> = lazy(() => import('./AutomationArticle'));
8
+ export const AutomationSettings: ComponentType<any> = lazy(() => import('./AutomationSettings'));
9
+ export const AutomationCompanion: ComponentType<any> = lazy(() => import('./AutomationCompanion'));
10
+ export const TriggerSettings: ComponentType<any> = lazy(() => import('./TriggerSettings'));
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ // TODO(wittjosiah): Factor out.
6
+ export * from './useTriggerRuntimeControls';
@@ -0,0 +1,72 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Atom, useAtomValue } from '@effect-atom/atom-react';
6
+ import type * as Context from 'effect/Context';
7
+ import * as Effect from 'effect/Effect';
8
+ import { useEffect, useState } from 'react';
9
+
10
+ import { useSpaceCallback } from '@dxos/app-framework/ui';
11
+ import { Trigger } from '@dxos/compute';
12
+ import { type Database, Filter, Query } from '@dxos/echo';
13
+ import { TriggerDispatcher, type TriggerDispatcherState } from '@dxos/functions-runtime';
14
+ import { useQuery } from '@dxos/react-client/echo';
15
+
16
+ interface TriggerRuntimeControls {
17
+ triggers: Trigger.Trigger[];
18
+
19
+ state: TriggerDispatcherState | undefined;
20
+
21
+ start: () => void;
22
+ stop: () => void;
23
+ }
24
+
25
+ export const useTriggerRuntimeControls = (db: Database.Database | undefined): TriggerRuntimeControls => {
26
+ const triggers = useQuery(
27
+ db,
28
+ Query.select(Filter.type(Trigger.Trigger)).debugLabel('plugin-automation.useTriggerRuntimeControls'),
29
+ );
30
+
31
+ const [dispatcher, setDispatcher] = useState<Context.Tag.Service<TriggerDispatcher> | undefined>(undefined);
32
+
33
+ const init = useSpaceCallback(
34
+ db?.spaceId,
35
+ [TriggerDispatcher],
36
+ Effect.fnUntraced(function* () {
37
+ const dispatcher = yield* TriggerDispatcher;
38
+ setDispatcher(dispatcher);
39
+ }),
40
+ );
41
+
42
+ useEffect(() => {
43
+ void init();
44
+ }, []);
45
+
46
+ const state = useAtomValue(dispatcher?.state ?? Atom.make(undefined));
47
+
48
+ const start = useSpaceCallback(
49
+ db?.spaceId,
50
+ [TriggerDispatcher],
51
+ Effect.fnUntraced(function* () {
52
+ const dispatcher = yield* TriggerDispatcher;
53
+ yield* dispatcher.start();
54
+ }),
55
+ );
56
+
57
+ const stop = useSpaceCallback(
58
+ db?.spaceId,
59
+ [TriggerDispatcher],
60
+ Effect.fnUntraced(function* () {
61
+ const dispatcher = yield* TriggerDispatcher;
62
+ yield* dispatcher.stop();
63
+ }),
64
+ );
65
+
66
+ return {
67
+ triggers,
68
+ state,
69
+ start: () => void start(),
70
+ stop: () => void stop(),
71
+ };
72
+ };
package/src/index.ts CHANGED
@@ -2,7 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './components';
6
5
  export * from './meta';
7
-
8
- export * from './AutomationPlugin';
6
+ export * from './types';
package/src/meta.ts CHANGED
@@ -2,15 +2,32 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { DXN } from '@dxos/keys';
7
+ import { trim } from '@dxos/util';
6
8
 
7
- export const AUTOMATION_PLUGIN = 'dxos.org/plugin/automation';
8
-
9
- export const meta: PluginMeta = {
10
- id: AUTOMATION_PLUGIN,
9
+ export const meta = Plugin.makeMeta({
10
+ key: DXN.make('org.dxos.plugin.automation'),
11
11
  name: 'Automation',
12
- description:
13
- 'The Automation tab allows you to trigger pre-defined workflows related to the element you are interacting with inside of Composer.',
14
- icon: 'ph--robot--regular',
12
+ author: 'DXOS',
13
+ description: trim`
14
+ Event-driven workflow automation engine for DXOS Composer.
15
+ An Automation is a user-facing object pairing a trigger ("when" — a timer schedule or an
16
+ incoming feed) with an action ("then" — a persistent compute operation or routine), enabling
17
+ automated pipelines that react to changes in real time without manual intervention.
18
+
19
+ Automations are configured in their own article and surfaced on a per-object "Automations"
20
+ companion that lists the automations connected to each object. A per-space TriggerDispatcher
21
+ manages execution: running locally in the browser when computeEnvironment is "local", or
22
+ delegating to the DXOS edge for server-side reliability; the space settings page chooses the
23
+ runtime location.
24
+
25
+ Operation handlers and blueprints contributed by any plugin in the application are
26
+ automatically merged and made available to every space's OperationRegistry, so new
27
+ capabilities registered by other plugins become instantly invocable from automations.
28
+ `,
29
+ icon: 'ph--atom--regular',
15
30
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-automation',
16
- };
31
+ spec: 'PLUGIN.mdl',
32
+ tags: ['system'],
33
+ });
@@ -0,0 +1,38 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Operation } from '@dxos/compute';
9
+ import { Database } from '@dxos/echo';
10
+ import { invariant } from '@dxos/invariant';
11
+ import { SpaceOperation } from '@dxos/plugin-space';
12
+
13
+ import { getAutomationsPath } from '../paths';
14
+ import { AutomationCapabilities, AutomationOperation } from '../types';
15
+
16
+ const handler: Operation.WithHandler<typeof AutomationOperation.CreateAutomation> =
17
+ AutomationOperation.CreateAutomation.pipe(
18
+ Operation.withHandler(
19
+ Effect.fnUntraced(function* ({ db, templateId, name, subject }) {
20
+ const templates = yield* Capability.getAll(AutomationCapabilities.Template);
21
+ const template = templates.find((entry) => entry.id === templateId);
22
+ invariant(template, `Unknown automation template: ${templateId}`);
23
+
24
+ const object = yield* template
25
+ .scaffold({ name, subject })
26
+ .pipe(Effect.provideService(Database.Service, Database.makeService(db)));
27
+
28
+ return yield* Operation.invoke(SpaceOperation.AddObject, {
29
+ object,
30
+ target: db,
31
+ hidden: true,
32
+ targetNodeId: getAutomationsPath(db.spaceId),
33
+ });
34
+ }),
35
+ ),
36
+ );
37
+
38
+ export default handler;
@@ -0,0 +1,70 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { LayoutOperation, getSpacePath } from '@dxos/app-toolkit';
8
+ import { Operation, Script, Trigger } from '@dxos/compute';
9
+ import { type Feed, Filter, Obj, Ref } from '@dxos/echo';
10
+ import { SpaceOperation } from '@dxos/plugin-space';
11
+
12
+ import { meta } from '#meta';
13
+
14
+ import { AutomationOperation } from '../types';
15
+
16
+ const handler: Operation.WithHandler<typeof AutomationOperation.CreateTriggerFromTemplate> =
17
+ AutomationOperation.CreateTriggerFromTemplate.pipe(
18
+ Operation.withHandler(
19
+ Effect.fnUntraced(function* ({ db, template, enabled = false, scriptName, input }) {
20
+ const trigger = Trigger.make({ enabled, input });
21
+
22
+ // TODO(wittjosiah): Factor out function lookup by script name?
23
+ if (scriptName) {
24
+ const scripts = yield* Effect.promise(() => db.query(Filter.type(Script.Script, { name: scriptName })).run());
25
+ const [script] = scripts;
26
+ if (script) {
27
+ const functions = yield* Effect.promise(() =>
28
+ db.query(Filter.type(Operation.PersistentOperation, { source: Ref.make(script) })).run(),
29
+ );
30
+ const [fn] = functions;
31
+ if (fn) {
32
+ Obj.update(trigger, (trigger) => {
33
+ trigger.function = Ref.make(fn);
34
+ });
35
+ }
36
+ }
37
+ }
38
+
39
+ switch (template.type) {
40
+ case 'timer': {
41
+ Obj.update(trigger, (trigger) => {
42
+ trigger.spec = Trigger.specTimer(template.cron);
43
+ });
44
+ break;
45
+ }
46
+ case 'feed': {
47
+ Obj.update(trigger, (trigger) => {
48
+ trigger.spec = Trigger.specFeed(template.feed as Feed.Feed);
49
+ });
50
+ break;
51
+ }
52
+ default: {
53
+ break;
54
+ }
55
+ }
56
+
57
+ yield* Operation.invoke(SpaceOperation.AddObject, {
58
+ object: trigger,
59
+ target: db,
60
+ hidden: true,
61
+ });
62
+ yield* Operation.invoke(LayoutOperation.Open, {
63
+ subject: [`${getSpacePath(db.spaceId)}/settings/${meta.id}.automations`],
64
+ workspace: getSpacePath(db.spaceId),
65
+ });
66
+ }),
67
+ ),
68
+ );
69
+
70
+ export default handler;
@@ -0,0 +1,10 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { OperationHandlerSet } from '@dxos/compute';
6
+
7
+ export const AutomationOperationHandlerSet = OperationHandlerSet.lazy(
8
+ () => import('./create-trigger-from-template'),
9
+ () => import('./create-automation'),
10
+ );
package/src/paths.ts ADDED
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { createTypeSectionPaths } from '@dxos/app-toolkit';
6
+
7
+ import { Automation } from '#types';
8
+
9
+ const { getSectionPath: getAutomationsPath, getObjectPath: getAutomationPath } = createTypeSectionPaths(
10
+ Automation.Automation,
11
+ );
12
+
13
+ export { getAutomationsPath, getAutomationPath };
package/src/plugin.ts ADDED
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const AutomationPlugin = Plugin.lazy(meta, () => import('#plugin'));
10
+
11
+ export { AutomationOperationHandlerSet } from './operations';
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Automation, type AutomationCapabilities } from '#types';
8
+
9
+ /**
10
+ * Blank template: mints an empty automation with no runnable and no triggers; the action and trigger are
11
+ * configured in the automation article. This is the no-op template (the create dialog's default), so the
12
+ * create flow has a single resolve→scaffold path with no special-casing.
13
+ */
14
+ export const blank: AutomationCapabilities.Template = {
15
+ id: 'org.dxos.automation.blank',
16
+ label: 'Blank',
17
+ icon: 'ph--lightning--regular',
18
+ scaffold: ({ name }) => Effect.succeed(Automation.make({ name, triggers: [] })),
19
+ };
20
+
21
+ /** Templates contributed by plugin-automation itself. */
22
+ export const defaultTemplates: AutomationCapabilities.Template[] = [blank];