@rudderhq/server 0.2.5-canary.8 → 0.2.5

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 (309) hide show
  1. package/dist/bootstrap/plugin-host-runtime.d.ts +39 -39
  2. package/dist/bundled-plugins/plugin-linear/dist/worker.js +101 -147
  3. package/dist/bundled-plugins/plugin-linear/dist/worker.js.map +2 -2
  4. package/dist/bundled-plugins/plugin-linear/package.json +1 -1
  5. package/dist/routes/access-onboarding.helpers.d.ts +142 -0
  6. package/dist/routes/access-onboarding.helpers.d.ts.map +1 -0
  7. package/dist/routes/access-onboarding.helpers.js +762 -0
  8. package/dist/routes/access-onboarding.helpers.js.map +1 -0
  9. package/dist/routes/access.d.ts +2 -48
  10. package/dist/routes/access.d.ts.map +1 -1
  11. package/dist/routes/access.helpers.d.ts +109 -0
  12. package/dist/routes/access.helpers.d.ts.map +1 -0
  13. package/dist/routes/access.helpers.js +460 -0
  14. package/dist/routes/access.helpers.js.map +1 -0
  15. package/dist/routes/access.js +6 -1218
  16. package/dist/routes/access.js.map +1 -1
  17. package/dist/routes/agents.d.ts.map +1 -1
  18. package/dist/routes/agents.js +55 -1057
  19. package/dist/routes/agents.js.map +1 -1
  20. package/dist/routes/agents.management-routes.d.ts +12 -0
  21. package/dist/routes/agents.management-routes.d.ts.map +1 -0
  22. package/dist/routes/agents.management-routes.js +1067 -0
  23. package/dist/routes/agents.management-routes.js.map +1 -0
  24. package/dist/routes/chats.d.ts.map +1 -1
  25. package/dist/routes/chats.js +42 -652
  26. package/dist/routes/chats.js.map +1 -1
  27. package/dist/routes/chats.stream-routes.d.ts +12 -0
  28. package/dist/routes/chats.stream-routes.d.ts.map +1 -0
  29. package/dist/routes/chats.stream-routes.js +666 -0
  30. package/dist/routes/chats.stream-routes.js.map +1 -0
  31. package/dist/routes/issues.comments-attachments.d.ts +12 -0
  32. package/dist/routes/issues.comments-attachments.d.ts.map +1 -0
  33. package/dist/routes/issues.comments-attachments.js +511 -0
  34. package/dist/routes/issues.comments-attachments.js.map +1 -0
  35. package/dist/routes/issues.d.ts.map +1 -1
  36. package/dist/routes/issues.js +43 -1128
  37. package/dist/routes/issues.js.map +1 -1
  38. package/dist/routes/issues.mutations.d.ts +12 -0
  39. package/dist/routes/issues.mutations.d.ts.map +1 -0
  40. package/dist/routes/issues.mutations.js +635 -0
  41. package/dist/routes/issues.mutations.js.map +1 -0
  42. package/dist/routes/plugins.d.ts.map +1 -1
  43. package/dist/routes/plugins.js +14 -694
  44. package/dist/routes/plugins.js.map +1 -1
  45. package/dist/routes/plugins.operations-routes.d.ts +28 -0
  46. package/dist/routes/plugins.operations-routes.d.ts.map +1 -0
  47. package/dist/routes/plugins.operations-routes.js +720 -0
  48. package/dist/routes/plugins.operations-routes.js.map +1 -0
  49. package/dist/services/access.d.ts +21 -21
  50. package/dist/services/activity.d.ts +19 -19
  51. package/dist/services/agents.d.ts +158 -158
  52. package/dist/services/approvals.d.ts +29 -29
  53. package/dist/services/assets.d.ts +8 -8
  54. package/dist/services/automations.d.ts +41 -27
  55. package/dist/services/automations.d.ts.map +1 -1
  56. package/dist/services/automations.js +287 -110
  57. package/dist/services/automations.js.map +1 -1
  58. package/dist/services/automations.scheduler.d.ts +9 -0
  59. package/dist/services/automations.scheduler.d.ts.map +1 -0
  60. package/dist/services/automations.scheduler.js +101 -0
  61. package/dist/services/automations.scheduler.js.map +1 -0
  62. package/dist/services/board-auth.d.ts +32 -32
  63. package/dist/services/calendar.d.ts +26 -26
  64. package/dist/services/chat-assistant.d.ts +3 -47
  65. package/dist/services/chat-assistant.d.ts.map +1 -1
  66. package/dist/services/chat-assistant.helpers.d.ts +156 -0
  67. package/dist/services/chat-assistant.helpers.d.ts.map +1 -0
  68. package/dist/services/chat-assistant.helpers.js +862 -0
  69. package/dist/services/chat-assistant.helpers.js.map +1 -0
  70. package/dist/services/chat-assistant.js +2 -861
  71. package/dist/services/chat-assistant.js.map +1 -1
  72. package/dist/services/chats.d.ts +149 -247
  73. package/dist/services/chats.d.ts.map +1 -1
  74. package/dist/services/chats.helpers.d.ts +117 -0
  75. package/dist/services/chats.helpers.d.ts.map +1 -0
  76. package/dist/services/chats.helpers.js +285 -0
  77. package/dist/services/chats.helpers.js.map +1 -0
  78. package/dist/services/chats.js +6 -286
  79. package/dist/services/chats.js.map +1 -1
  80. package/dist/services/costs.d.ts +8 -8
  81. package/dist/services/finance.d.ts +18 -18
  82. package/dist/services/goals.d.ts +30 -30
  83. package/dist/services/heartbeat.d.ts +3 -1
  84. package/dist/services/heartbeat.d.ts.map +1 -1
  85. package/dist/services/heartbeat.js +3 -1
  86. package/dist/services/heartbeat.js.map +1 -1
  87. package/dist/services/issue-approvals.d.ts +4 -4
  88. package/dist/services/issue-review-wakeup.d.ts +3 -3
  89. package/dist/services/issues.comments-attachments.d.ts +141 -0
  90. package/dist/services/issues.comments-attachments.d.ts.map +1 -0
  91. package/dist/services/issues.comments-attachments.js +313 -0
  92. package/dist/services/issues.comments-attachments.js.map +1 -0
  93. package/dist/services/issues.d.ts +205 -256
  94. package/dist/services/issues.d.ts.map +1 -1
  95. package/dist/services/issues.helpers.d.ts +87 -0
  96. package/dist/services/issues.helpers.d.ts.map +1 -0
  97. package/dist/services/issues.helpers.js +270 -0
  98. package/dist/services/issues.helpers.js.map +1 -0
  99. package/dist/services/issues.js +5 -569
  100. package/dist/services/issues.js.map +1 -1
  101. package/dist/services/knowledge-portability/organization-portability.core.d.ts +210 -0
  102. package/dist/services/knowledge-portability/organization-portability.core.d.ts.map +1 -0
  103. package/dist/services/knowledge-portability/organization-portability.core.js +997 -0
  104. package/dist/services/knowledge-portability/organization-portability.core.js.map +1 -0
  105. package/dist/services/knowledge-portability/organization-portability.d.ts +6 -28
  106. package/dist/services/knowledge-portability/organization-portability.d.ts.map +1 -1
  107. package/dist/services/knowledge-portability/organization-portability.export.d.ts +24 -0
  108. package/dist/services/knowledge-portability/organization-portability.export.d.ts.map +1 -0
  109. package/dist/services/knowledge-portability/organization-portability.export.js +607 -0
  110. package/dist/services/knowledge-portability/organization-portability.export.js.map +1 -0
  111. package/dist/services/knowledge-portability/organization-portability.files.d.ts +69 -0
  112. package/dist/services/knowledge-portability/organization-portability.files.d.ts.map +1 -0
  113. package/dist/services/knowledge-portability/organization-portability.files.js +597 -0
  114. package/dist/services/knowledge-portability/organization-portability.files.js.map +1 -0
  115. package/dist/services/knowledge-portability/organization-portability.import.d.ts +31 -0
  116. package/dist/services/knowledge-portability/organization-portability.import.d.ts.map +1 -0
  117. package/dist/services/knowledge-portability/organization-portability.import.js +575 -0
  118. package/dist/services/knowledge-portability/organization-portability.import.js.map +1 -0
  119. package/dist/services/knowledge-portability/organization-portability.js +37 -3848
  120. package/dist/services/knowledge-portability/organization-portability.js.map +1 -1
  121. package/dist/services/knowledge-portability/organization-portability.package.d.ts +72 -0
  122. package/dist/services/knowledge-portability/organization-portability.package.d.ts.map +1 -0
  123. package/dist/services/knowledge-portability/organization-portability.package.js +749 -0
  124. package/dist/services/knowledge-portability/organization-portability.package.js.map +1 -0
  125. package/dist/services/knowledge-portability/organization-portability.preview.d.ts +18 -0
  126. package/dist/services/knowledge-portability/organization-portability.preview.d.ts.map +1 -0
  127. package/dist/services/knowledge-portability/organization-portability.preview.js +333 -0
  128. package/dist/services/knowledge-portability/organization-portability.preview.js.map +1 -0
  129. package/dist/services/knowledge-portability/organization-portability.resolve-source.d.ts +4 -0
  130. package/dist/services/knowledge-portability/organization-portability.resolve-source.d.ts.map +1 -0
  131. package/dist/services/knowledge-portability/organization-portability.resolve-source.js +86 -0
  132. package/dist/services/knowledge-portability/organization-portability.resolve-source.js.map +1 -0
  133. package/dist/services/knowledge-portability/organization-skills.catalog.d.ts +221 -0
  134. package/dist/services/knowledge-portability/organization-skills.catalog.d.ts.map +1 -0
  135. package/dist/services/knowledge-portability/organization-skills.catalog.js +999 -0
  136. package/dist/services/knowledge-portability/organization-skills.catalog.js.map +1 -0
  137. package/dist/services/knowledge-portability/organization-skills.d.ts +4 -75
  138. package/dist/services/knowledge-portability/organization-skills.d.ts.map +1 -1
  139. package/dist/services/knowledge-portability/organization-skills.js +11 -2008
  140. package/dist/services/knowledge-portability/organization-skills.js.map +1 -1
  141. package/dist/services/knowledge-portability/organization-skills.scans.d.ts +16 -0
  142. package/dist/services/knowledge-portability/organization-skills.scans.d.ts.map +1 -0
  143. package/dist/services/knowledge-portability/organization-skills.scans.js +300 -0
  144. package/dist/services/knowledge-portability/organization-skills.scans.js.map +1 -0
  145. package/dist/services/knowledge-portability/organization-skills.sources.d.ts +68 -0
  146. package/dist/services/knowledge-portability/organization-skills.sources.d.ts.map +1 -0
  147. package/dist/services/knowledge-portability/organization-skills.sources.js +728 -0
  148. package/dist/services/knowledge-portability/organization-skills.sources.js.map +1 -0
  149. package/dist/services/messenger.d.ts +2 -2
  150. package/dist/services/messenger.js +2 -2
  151. package/dist/services/messenger.js.map +1 -1
  152. package/dist/services/organization-skills.d.ts +3 -1
  153. package/dist/services/organization-skills.d.ts.map +1 -1
  154. package/dist/services/organization-skills.js +3 -1
  155. package/dist/services/organization-skills.js.map +1 -1
  156. package/dist/services/orgs.d.ts +9 -9
  157. package/dist/services/plugin-loader.core.d.ts +14 -0
  158. package/dist/services/plugin-loader.core.d.ts.map +1 -0
  159. package/dist/services/plugin-loader.core.js +905 -0
  160. package/dist/services/plugin-loader.core.js.map +1 -0
  161. package/dist/services/plugin-loader.d.ts +3 -440
  162. package/dist/services/plugin-loader.d.ts.map +1 -1
  163. package/dist/services/plugin-loader.helpers.d.ts +468 -0
  164. package/dist/services/plugin-loader.helpers.d.ts.map +1 -0
  165. package/dist/services/plugin-loader.helpers.js +263 -0
  166. package/dist/services/plugin-loader.helpers.js.map +1 -0
  167. package/dist/services/plugin-loader.js +3 -1191
  168. package/dist/services/plugin-loader.js.map +1 -1
  169. package/dist/services/plugin-loader.worker-paths.d.ts +7 -0
  170. package/dist/services/plugin-loader.worker-paths.d.ts.map +1 -0
  171. package/dist/services/plugin-loader.worker-paths.js +85 -0
  172. package/dist/services/plugin-loader.worker-paths.js.map +1 -0
  173. package/dist/services/plugin-registry.d.ts +123 -123
  174. package/dist/services/projects.d.ts +8 -8
  175. package/dist/services/runtime-kernel/heartbeat.core.d.ts +725 -0
  176. package/dist/services/runtime-kernel/heartbeat.core.d.ts.map +1 -0
  177. package/dist/services/runtime-kernel/heartbeat.core.js +525 -0
  178. package/dist/services/runtime-kernel/heartbeat.core.js.map +1 -0
  179. package/dist/services/runtime-kernel/heartbeat.d.ts +38 -259
  180. package/dist/services/runtime-kernel/heartbeat.d.ts.map +1 -1
  181. package/dist/services/runtime-kernel/heartbeat.execute.d.ts +5 -0
  182. package/dist/services/runtime-kernel/heartbeat.execute.d.ts.map +1 -0
  183. package/dist/services/runtime-kernel/heartbeat.execute.js +1052 -0
  184. package/dist/services/runtime-kernel/heartbeat.execute.js.map +1 -0
  185. package/dist/services/runtime-kernel/heartbeat.js +50 -4142
  186. package/dist/services/runtime-kernel/heartbeat.js.map +1 -1
  187. package/dist/services/runtime-kernel/heartbeat.misc.d.ts +30 -0
  188. package/dist/services/runtime-kernel/heartbeat.misc.d.ts.map +1 -0
  189. package/dist/services/runtime-kernel/heartbeat.misc.js +483 -0
  190. package/dist/services/runtime-kernel/heartbeat.misc.js.map +1 -0
  191. package/dist/services/runtime-kernel/heartbeat.recovery.d.ts +38 -0
  192. package/dist/services/runtime-kernel/heartbeat.recovery.d.ts.map +1 -0
  193. package/dist/services/runtime-kernel/heartbeat.recovery.js +605 -0
  194. package/dist/services/runtime-kernel/heartbeat.recovery.js.map +1 -0
  195. package/dist/services/runtime-kernel/heartbeat.release.d.ts +6 -0
  196. package/dist/services/runtime-kernel/heartbeat.release.d.ts.map +1 -0
  197. package/dist/services/runtime-kernel/heartbeat.release.js +398 -0
  198. package/dist/services/runtime-kernel/heartbeat.release.js.map +1 -0
  199. package/dist/services/runtime-kernel/heartbeat.sessions.d.ts +229 -0
  200. package/dist/services/runtime-kernel/heartbeat.sessions.d.ts.map +1 -0
  201. package/dist/services/runtime-kernel/heartbeat.sessions.js +708 -0
  202. package/dist/services/runtime-kernel/heartbeat.sessions.js.map +1 -0
  203. package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts +5 -0
  204. package/dist/services/runtime-kernel/heartbeat.wakeup.d.ts.map +1 -0
  205. package/dist/services/runtime-kernel/heartbeat.wakeup.js +552 -0
  206. package/dist/services/runtime-kernel/heartbeat.wakeup.js.map +1 -0
  207. package/dist/services/secrets.d.ts +25 -25
  208. package/dist/services/sidebar-badges.js +1 -1
  209. package/dist/services/sidebar-badges.js.map +1 -1
  210. package/dist/services/workspace-runtime.comments.d.ts +6 -0
  211. package/dist/services/workspace-runtime.comments.d.ts.map +1 -0
  212. package/dist/services/workspace-runtime.comments.js +17 -0
  213. package/dist/services/workspace-runtime.comments.js.map +1 -0
  214. package/dist/services/workspace-runtime.d.ts +4 -163
  215. package/dist/services/workspace-runtime.d.ts.map +1 -1
  216. package/dist/services/workspace-runtime.helpers.d.ts +163 -0
  217. package/dist/services/workspace-runtime.helpers.d.ts.map +1 -0
  218. package/dist/services/workspace-runtime.helpers.js +360 -0
  219. package/dist/services/workspace-runtime.helpers.js.map +1 -0
  220. package/dist/services/workspace-runtime.js +4 -1236
  221. package/dist/services/workspace-runtime.js.map +1 -1
  222. package/dist/services/workspace-runtime.lifecycle.d.ts +35 -0
  223. package/dist/services/workspace-runtime.lifecycle.d.ts.map +1 -0
  224. package/dist/services/workspace-runtime.lifecycle.js +266 -0
  225. package/dist/services/workspace-runtime.lifecycle.js.map +1 -0
  226. package/dist/services/workspace-runtime.services.d.ts +140 -0
  227. package/dist/services/workspace-runtime.services.d.ts.map +1 -0
  228. package/dist/services/workspace-runtime.services.js +606 -0
  229. package/dist/services/workspace-runtime.services.js.map +1 -0
  230. package/package.json +21 -15
  231. package/ui-dist/assets/{_basePickBy-DeCw-kw3.js → _basePickBy-N8I9ml5Y.js} +1 -1
  232. package/ui-dist/assets/{_baseUniq-CVepsVZm.js → _baseUniq-BuSlpRSQ.js} +1 -1
  233. package/ui-dist/assets/{arc-QifRrkx2.js → arc-qX-dPyA1.js} +1 -1
  234. package/ui-dist/assets/{architectureDiagram-2XIMDMQ5-CT4me0hw.js → architectureDiagram-2XIMDMQ5-DhjkbXsp.js} +1 -1
  235. package/ui-dist/assets/{blockDiagram-WCTKOSBZ-uD6J91MI.js → blockDiagram-WCTKOSBZ-JS-tTu3J.js} +1 -1
  236. package/ui-dist/assets/{c4Diagram-IC4MRINW-D2GM2pzG.js → c4Diagram-IC4MRINW-4DqwCWIx.js} +1 -1
  237. package/ui-dist/assets/channel-CccCW5_a.js +1 -0
  238. package/ui-dist/assets/{chunk-4BX2VUAB-D8pPrlss.js → chunk-4BX2VUAB-T37SqBpp.js} +1 -1
  239. package/ui-dist/assets/{chunk-55IACEB6-CHF68vwj.js → chunk-55IACEB6-BSj9hdqK.js} +1 -1
  240. package/ui-dist/assets/{chunk-FMBD7UC4-CKmGUf9X.js → chunk-FMBD7UC4-Dkrlh0Wk.js} +1 -1
  241. package/ui-dist/assets/{chunk-JSJVCQXG-CTBCV-7X.js → chunk-JSJVCQXG-C0ZE3QdB.js} +1 -1
  242. package/ui-dist/assets/{chunk-KX2RTZJC-DV5XzGob.js → chunk-KX2RTZJC-DOZQM9gW.js} +1 -1
  243. package/ui-dist/assets/{chunk-NQ4KR5QH-B7diT0e4.js → chunk-NQ4KR5QH-5Yr3U2k8.js} +1 -1
  244. package/ui-dist/assets/{chunk-QZHKN3VN-BphcSb1i.js → chunk-QZHKN3VN-CvKTufwF.js} +1 -1
  245. package/ui-dist/assets/{chunk-WL4C6EOR-Bs_jQBMG.js → chunk-WL4C6EOR-IoEM0jyx.js} +1 -1
  246. package/ui-dist/assets/classDiagram-VBA2DB6C-JKk4tCW2.js +1 -0
  247. package/ui-dist/assets/classDiagram-v2-RAHNMMFH-JKk4tCW2.js +1 -0
  248. package/ui-dist/assets/clone-Onaweg8D.js +1 -0
  249. package/ui-dist/assets/{cose-bilkent-S5V4N54A-BxfO0pV9.js → cose-bilkent-S5V4N54A-CTvr1OFj.js} +1 -1
  250. package/ui-dist/assets/{dagre-KLK3FWXG-BiDkAX-Z.js → dagre-KLK3FWXG-UZ-SNjVK.js} +1 -1
  251. package/ui-dist/assets/{diagram-E7M64L7V-Btz_oxkC.js → diagram-E7M64L7V-D7RAN0Hr.js} +1 -1
  252. package/ui-dist/assets/{diagram-IFDJBPK2-Cdp8lQxJ.js → diagram-IFDJBPK2-B4LViaFR.js} +1 -1
  253. package/ui-dist/assets/{diagram-P4PSJMXO-DuTbeAS1.js → diagram-P4PSJMXO-CY1be7ak.js} +1 -1
  254. package/ui-dist/assets/{erDiagram-INFDFZHY-CzoQlOwo.js → erDiagram-INFDFZHY-Dca0KkvJ.js} +1 -1
  255. package/ui-dist/assets/{flowDiagram-PKNHOUZH-Diz_MWi3.js → flowDiagram-PKNHOUZH-i-qMvfwg.js} +1 -1
  256. package/ui-dist/assets/{ganttDiagram-A5KZAMGK-CWeGI1E-.js → ganttDiagram-A5KZAMGK-Wxq2lhbh.js} +1 -1
  257. package/ui-dist/assets/{gitGraphDiagram-K3NZZRJ6-C3QhZnAN.js → gitGraphDiagram-K3NZZRJ6-DwzgPlAY.js} +1 -1
  258. package/ui-dist/assets/{graph-KQH4eaLv.js → graph-BAqf89Tz.js} +1 -1
  259. package/ui-dist/assets/{index-CkEEsJ_9.js → index-4eCzaLuY.js} +1 -1
  260. package/ui-dist/assets/{index-DCOA92Vt.js → index-8uu-nKqK.js} +1 -1
  261. package/ui-dist/assets/{index-DtsZnqcf.js → index-B-1NEcI_.js} +1 -1
  262. package/ui-dist/assets/{index-BvGpil9e.js → index-B0b_3Eu5.js} +1 -1
  263. package/ui-dist/assets/{index-BMhxh9sB.js → index-B8v0eZjP.js} +1 -1
  264. package/ui-dist/assets/{index-aKvEm2pJ.js → index-BN7Moj3u.js} +1 -1
  265. package/ui-dist/assets/{index-iJyjaIGd.js → index-BSpxh3cY.js} +1 -1
  266. package/ui-dist/assets/{index-DhRKQjzu.js → index-BY44RIi9.js} +1 -1
  267. package/ui-dist/assets/{index-Z4rTzdcL.js → index-BhyQJhdZ.js} +1 -1
  268. package/ui-dist/assets/{index-DBxBUiZC.js → index-BkPL_iGU.js} +1 -1
  269. package/ui-dist/assets/{index-CsSppW5U.js → index-BsPfoHXS.js} +1 -1
  270. package/ui-dist/assets/{index-B8J1oewY.js → index-BstW7nmv.js} +1 -1
  271. package/ui-dist/assets/{index-CVZYu_kq.js → index-BwB67Zyz.js} +1 -1
  272. package/ui-dist/assets/index-C2peSkmT.css +1 -0
  273. package/ui-dist/assets/{index-Djz3PL1M.js → index-C3ktOsS_.js} +1 -1
  274. package/ui-dist/assets/{index-BMZfWLwr.js → index-CMyABlS-.js} +1 -1
  275. package/ui-dist/assets/{index-Cqdw7Lnc.js → index-CyBJ8ujC.js} +1 -1
  276. package/ui-dist/assets/{index-Ctp_0y5X.js → index-DAxM2W3O.js} +1 -1
  277. package/ui-dist/assets/{index-_jGthZ-1.js → index-DVZXPmhk.js} +1 -1
  278. package/ui-dist/assets/{index-CBLnbZVL.js → index-Dc19uAyw.js} +1 -1
  279. package/ui-dist/assets/index-DzHrwZu1.js +1511 -0
  280. package/ui-dist/assets/{index-ChTjk1gO.js → index-LJuf53Ye.js} +1 -1
  281. package/ui-dist/assets/{index-wXEAD8rI.js → index-Ugw5VWWz.js} +1 -1
  282. package/ui-dist/assets/{index-ciyPUpT9.js → index-YGraEFR7.js} +1 -1
  283. package/ui-dist/assets/{infoDiagram-LFFYTUFH-DbMzKsuw.js → infoDiagram-LFFYTUFH-jLmDtFVR.js} +1 -1
  284. package/ui-dist/assets/{ishikawaDiagram-PHBUUO56-CcKXcf2V.js → ishikawaDiagram-PHBUUO56-6OGMyLT8.js} +1 -1
  285. package/ui-dist/assets/{journeyDiagram-4ABVD52K-BY2GuHyR.js → journeyDiagram-4ABVD52K-yQjl6E0t.js} +1 -1
  286. package/ui-dist/assets/{kanban-definition-K7BYSVSG-BlZWM0Uz.js → kanban-definition-K7BYSVSG-DkdCeQlS.js} +1 -1
  287. package/ui-dist/assets/{layout-qHGAYgRY.js → layout-CqSYvZ_w.js} +1 -1
  288. package/ui-dist/assets/{linear-BigkGXbh.js → linear-B8xGZaoi.js} +1 -1
  289. package/ui-dist/assets/{mermaid.core-DZ099nW4.js → mermaid.core-AKL_cdyk.js} +4 -4
  290. package/ui-dist/assets/{mindmap-definition-YRQLILUH-CElDqDe0.js → mindmap-definition-YRQLILUH-Zr-dXC0x.js} +1 -1
  291. package/ui-dist/assets/{pieDiagram-SKSYHLDU-I2LDYrgm.js → pieDiagram-SKSYHLDU-BvDAU-Nk.js} +1 -1
  292. package/ui-dist/assets/{quadrantDiagram-337W2JSQ-D-U35edU.js → quadrantDiagram-337W2JSQ-Dn9kM62o.js} +1 -1
  293. package/ui-dist/assets/{requirementDiagram-Z7DCOOCP-FAWtaOKe.js → requirementDiagram-Z7DCOOCP-GIsIh7Sd.js} +1 -1
  294. package/ui-dist/assets/{sankeyDiagram-WA2Y5GQK-CzFHHNNh.js → sankeyDiagram-WA2Y5GQK-CUCuBkuf.js} +1 -1
  295. package/ui-dist/assets/{sequenceDiagram-2WXFIKYE-Cy-UViPL.js → sequenceDiagram-2WXFIKYE-MDpUY2HM.js} +1 -1
  296. package/ui-dist/assets/{stateDiagram-RAJIS63D-BEdt3CLl.js → stateDiagram-RAJIS63D-BymMpuUU.js} +1 -1
  297. package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-Bi2oCU6d.js +1 -0
  298. package/ui-dist/assets/{timeline-definition-YZTLITO2-YD1e-WHS.js → timeline-definition-YZTLITO2-B6ofPhhy.js} +1 -1
  299. package/ui-dist/assets/{treemap-KZPCXAKY-BnqlVkAC.js → treemap-KZPCXAKY-DnLO6w1l.js} +1 -1
  300. package/ui-dist/assets/{vennDiagram-LZ73GAT5-f4WCy3o6.js → vennDiagram-LZ73GAT5-D0MyZIDl.js} +1 -1
  301. package/ui-dist/assets/{xychartDiagram-JWTSCODW-CWA35znA.js → xychartDiagram-JWTSCODW-rADY1iUG.js} +1 -1
  302. package/ui-dist/index.html +2 -2
  303. package/ui-dist/assets/channel-BV7st2TW.js +0 -1
  304. package/ui-dist/assets/classDiagram-VBA2DB6C-Cw_xj5ie.js +0 -1
  305. package/ui-dist/assets/classDiagram-v2-RAHNMMFH-Cw_xj5ie.js +0 -1
  306. package/ui-dist/assets/clone-DGshofUt.js +0 -1
  307. package/ui-dist/assets/index-Ded0dPwB.css +0 -1
  308. package/ui-dist/assets/index-Jhxth516.js +0 -1510
  309. package/ui-dist/assets/stateDiagram-v2-FVOUBMTO-cW7aES_v.js +0 -1
@@ -1,112 +1,21 @@
1
1
  import crypto from "node:crypto";
2
2
  import { and, asc, desc, eq, inArray, isNotNull, isNull, lte, ne, sql } from "drizzle-orm";
3
- import { agents, organizationSecrets, goals, heartbeatRuns, issues, projects, automationRuns, automations, automationTriggers, } from "@rudderhq/db";
3
+ import { agents, organizationSecrets, goals, heartbeatRuns, issues, projects, automationRuns, automations, automationTriggers, chatConversations, chatMessages, } from "@rudderhq/db";
4
4
  import { conflict, forbidden, notFound, unauthorized, unprocessable } from "../errors.js";
5
5
  import { logger } from "../middleware/logger.js";
6
6
  import { issueService } from "./issues.js";
7
7
  import { secretService } from "./secrets.js";
8
- import { parseCron, validateCron } from "./cron.js";
8
+ import { validateCron } from "./cron.js";
9
9
  import { heartbeatService } from "./heartbeat.js";
10
10
  import { queueIssueAssignmentWakeup } from "./issue-assignment-wakeup.js";
11
11
  import { logActivity } from "./activity-log.js";
12
- const OPEN_ISSUE_STATUSES = ["backlog", "todo", "in_progress", "in_review", "blocked"];
13
- const LIVE_HEARTBEAT_RUN_STATUSES = ["queued", "running"];
14
- const TERMINAL_ISSUE_STATUSES = new Set(["done", "cancelled"]);
15
- const MAX_CATCH_UP_RUNS = 25;
16
- const WEEKDAY_INDEX = {
17
- Sun: 0,
18
- Mon: 1,
19
- Tue: 2,
20
- Wed: 3,
21
- Thu: 4,
22
- Fri: 5,
23
- Sat: 6,
24
- };
25
- function assertTimeZone(timeZone) {
26
- try {
27
- new Intl.DateTimeFormat("en-US", { timeZone }).format(new Date());
28
- }
29
- catch {
30
- throw unprocessable(`Invalid timezone: ${timeZone}`);
31
- }
32
- }
33
- function floorToMinute(date) {
34
- const copy = new Date(date.getTime());
35
- copy.setUTCSeconds(0, 0);
36
- return copy;
37
- }
38
- function getZonedMinuteParts(date, timeZone) {
39
- const formatter = new Intl.DateTimeFormat("en-US", {
40
- timeZone,
41
- hour12: false,
42
- year: "numeric",
43
- month: "numeric",
44
- day: "numeric",
45
- hour: "numeric",
46
- minute: "numeric",
47
- weekday: "short",
48
- });
49
- const parts = formatter.formatToParts(date);
50
- const map = Object.fromEntries(parts.map((part) => [part.type, part.value]));
51
- const weekday = WEEKDAY_INDEX[map.weekday ?? ""];
52
- if (weekday == null) {
53
- throw new Error(`Unable to resolve weekday for timezone ${timeZone}`);
54
- }
12
+ import { assertTimeZone, LIVE_HEARTBEAT_RUN_STATUSES, MAX_CATCH_UP_RUNS, nextCronTickInTimeZone, nextResultText, normalizeWebhookTimestampMs, OPEN_ISSUE_STATUSES, } from "./automations.scheduler.js";
13
+ function toAutomation(row) {
55
14
  return {
56
- year: Number(map.year),
57
- month: Number(map.month),
58
- day: Number(map.day),
59
- hour: Number(map.hour),
60
- minute: Number(map.minute),
61
- weekday,
15
+ ...row,
16
+ outputMode: row.outputMode,
62
17
  };
63
18
  }
64
- function matchesCronMinute(expression, timeZone, date) {
65
- const cron = parseCron(expression);
66
- const parts = getZonedMinuteParts(date, timeZone);
67
- return (cron.minutes.includes(parts.minute) &&
68
- cron.hours.includes(parts.hour) &&
69
- cron.daysOfMonth.includes(parts.day) &&
70
- cron.months.includes(parts.month) &&
71
- cron.daysOfWeek.includes(parts.weekday));
72
- }
73
- function nextCronTickInTimeZone(expression, timeZone, after) {
74
- const trimmed = expression.trim();
75
- assertTimeZone(timeZone);
76
- const error = validateCron(trimmed);
77
- if (error) {
78
- throw unprocessable(error);
79
- }
80
- const cursor = floorToMinute(after);
81
- cursor.setUTCMinutes(cursor.getUTCMinutes() + 1);
82
- const limit = 366 * 24 * 60 * 5;
83
- for (let i = 0; i < limit; i += 1) {
84
- if (matchesCronMinute(trimmed, timeZone, cursor)) {
85
- return new Date(cursor.getTime());
86
- }
87
- cursor.setUTCMinutes(cursor.getUTCMinutes() + 1);
88
- }
89
- return null;
90
- }
91
- function nextResultText(status, issueId) {
92
- if (status === "issue_created" && issueId)
93
- return `Created execution issue ${issueId}`;
94
- if (status === "coalesced")
95
- return "Coalesced into an existing live execution issue";
96
- if (status === "skipped")
97
- return "Skipped because a live execution issue already exists";
98
- if (status === "completed")
99
- return "Execution issue completed";
100
- if (status === "failed")
101
- return "Execution failed";
102
- return status;
103
- }
104
- function normalizeWebhookTimestampMs(rawTimestamp) {
105
- const parsed = Number(rawTimestamp);
106
- if (!Number.isFinite(parsed))
107
- return null;
108
- return parsed > 1e12 ? parsed : parsed * 1000;
109
- }
110
19
  export function automationService(db, deps = {}) {
111
20
  const issueSvc = issueService(db);
112
21
  const secretsSvc = secretService(db);
@@ -181,6 +90,34 @@ export function automationService(db, deps = {}) {
181
90
  if (parentIssue.orgId !== orgId)
182
91
  throw unprocessable("Parent issue must belong to same organization");
183
92
  }
93
+ async function assertChatOutputDestination(input) {
94
+ if (input.outputMode !== "chat_output")
95
+ return null;
96
+ if (!input.chatConversationId)
97
+ throw unprocessable("Chat output requires a destination conversation");
98
+ const conversation = await db
99
+ .select({
100
+ id: chatConversations.id,
101
+ orgId: chatConversations.orgId,
102
+ status: chatConversations.status,
103
+ preferredAgentId: chatConversations.preferredAgentId,
104
+ })
105
+ .from(chatConversations)
106
+ .where(eq(chatConversations.id, input.chatConversationId))
107
+ .then((rows) => rows[0] ?? null);
108
+ if (!conversation)
109
+ throw notFound("Chat conversation not found");
110
+ if (conversation.orgId !== input.orgId)
111
+ throw unprocessable("Chat conversation must belong to same organization");
112
+ if (conversation.status !== "active")
113
+ throw unprocessable("Chat output requires an active conversation");
114
+ if (conversation.preferredAgentId &&
115
+ conversation.preferredAgentId !== input.assigneeAgentId &&
116
+ !input.allowAssigneeChatMismatch) {
117
+ throw unprocessable("Chat conversation preferred agent must match the automation assignee");
118
+ }
119
+ return conversation;
120
+ }
184
121
  async function listTriggersForAutomationIds(orgId, automationIds) {
185
122
  if (automationIds.length === 0)
186
123
  return new Map();
@@ -197,6 +134,17 @@ export function automationService(db, deps = {}) {
197
134
  }
198
135
  return map;
199
136
  }
137
+ function linkedChatConversationFromRow(row) {
138
+ return row.linkedChatConversationId
139
+ ? {
140
+ id: row.linkedChatConversationId,
141
+ title: row.chatTitle ?? "Chat",
142
+ status: row.chatStatus ?? "active",
143
+ preferredAgentId: row.chatPreferredAgentId,
144
+ lastMessageAt: row.chatLastMessageAt,
145
+ }
146
+ : null;
147
+ }
200
148
  async function listLatestRunByAutomationIds(orgId, automationIds) {
201
149
  if (automationIds.length === 0)
202
150
  return new Map();
@@ -212,6 +160,10 @@ export function automationService(db, deps = {}) {
212
160
  idempotencyKey: automationRuns.idempotencyKey,
213
161
  triggerPayload: automationRuns.triggerPayload,
214
162
  linkedIssueId: automationRuns.linkedIssueId,
163
+ linkedChatConversationId: automationRuns.linkedChatConversationId,
164
+ startedChatMessageId: automationRuns.startedChatMessageId,
165
+ terminalChatMessageId: automationRuns.terminalChatMessageId,
166
+ lastChatMessageId: automationRuns.lastChatMessageId,
215
167
  coalescedIntoRunId: automationRuns.coalescedIntoRunId,
216
168
  failureReason: automationRuns.failureReason,
217
169
  completedAt: automationRuns.completedAt,
@@ -224,10 +176,15 @@ export function automationService(db, deps = {}) {
224
176
  issueStatus: issues.status,
225
177
  issuePriority: issues.priority,
226
178
  issueUpdatedAt: issues.updatedAt,
179
+ chatTitle: chatConversations.title,
180
+ chatStatus: chatConversations.status,
181
+ chatPreferredAgentId: chatConversations.preferredAgentId,
182
+ chatLastMessageAt: chatConversations.lastMessageAt,
227
183
  })
228
184
  .from(automationRuns)
229
185
  .leftJoin(automationTriggers, eq(automationRuns.triggerId, automationTriggers.id))
230
186
  .leftJoin(issues, eq(automationRuns.linkedIssueId, issues.id))
187
+ .leftJoin(chatConversations, eq(automationRuns.linkedChatConversationId, chatConversations.id))
231
188
  .where(and(eq(automationRuns.orgId, orgId), inArray(automationRuns.automationId, automationIds)))
232
189
  .orderBy(automationRuns.automationId, desc(automationRuns.createdAt), desc(automationRuns.id));
233
190
  const map = new Map();
@@ -243,6 +200,10 @@ export function automationService(db, deps = {}) {
243
200
  idempotencyKey: row.idempotencyKey,
244
201
  triggerPayload: row.triggerPayload,
245
202
  linkedIssueId: row.linkedIssueId,
203
+ linkedChatConversationId: row.linkedChatConversationId,
204
+ startedChatMessageId: row.startedChatMessageId,
205
+ terminalChatMessageId: row.terminalChatMessageId,
206
+ lastChatMessageId: row.lastChatMessageId,
246
207
  coalescedIntoRunId: row.coalescedIntoRunId,
247
208
  failureReason: row.failureReason,
248
209
  completedAt: row.completedAt,
@@ -258,6 +219,7 @@ export function automationService(db, deps = {}) {
258
219
  updatedAt: row.issueUpdatedAt ?? row.updatedAt,
259
220
  }
260
221
  : null,
222
+ linkedChatConversation: linkedChatConversationFromRow(row),
261
223
  trigger: row.triggerId
262
224
  ? {
263
225
  id: row.triggerId,
@@ -381,6 +343,87 @@ export function automationService(db, deps = {}) {
381
343
  .returning()
382
344
  .then((rows) => rows[0] ?? null);
383
345
  }
346
+ async function getAutomationRunById(runId, executor = db) {
347
+ return executor
348
+ .select()
349
+ .from(automationRuns)
350
+ .where(eq(automationRuns.id, runId))
351
+ .then((rows) => rows[0] ?? null);
352
+ }
353
+ function automationRunEventBody(input) {
354
+ if (input.status === "issue_created")
355
+ return `${input.title} started.`;
356
+ if (input.status === "completed")
357
+ return `${input.title} completed.`;
358
+ if (input.status === "coalesced")
359
+ return `${input.title} coalesced into an active automation run.`;
360
+ if (input.status === "skipped")
361
+ return `${input.title} skipped because an active automation run already exists.`;
362
+ if (input.status === "failed") {
363
+ return input.failureReason ? `${input.title} failed: ${input.failureReason}` : `${input.title} failed.`;
364
+ }
365
+ return `${input.title} updated: ${input.status}.`;
366
+ }
367
+ async function postAutomationRunChatEvent(input) {
368
+ if (input.automation.outputMode !== "chat_output" || !input.automation.chatConversationId)
369
+ return null;
370
+ const executor = input.executor ?? db;
371
+ const now = new Date();
372
+ const eventType = input.status === "issue_created" ? "automation_run_started"
373
+ : input.status === "completed" ? "automation_run_completed"
374
+ : input.status === "failed" ? "automation_run_failed"
375
+ : input.status === "skipped" ? "automation_run_skipped"
376
+ : input.status === "coalesced" ? "automation_run_coalesced"
377
+ : "automation_run_updated";
378
+ const [message] = await executor
379
+ .insert(chatMessages)
380
+ .values({
381
+ orgId: input.automation.orgId,
382
+ conversationId: input.automation.chatConversationId,
383
+ role: "system",
384
+ kind: "system_event",
385
+ status: "completed",
386
+ body: automationRunEventBody({
387
+ title: input.automation.title,
388
+ status: input.status,
389
+ issueId: input.issueId,
390
+ failureReason: input.failureReason,
391
+ }),
392
+ structuredPayload: {
393
+ eventType,
394
+ automationId: input.automation.id,
395
+ runId: input.runId,
396
+ issueId: input.issueId ?? null,
397
+ triggerId: input.triggerId ?? null,
398
+ source: input.source,
399
+ status: input.status,
400
+ failureReason: input.failureReason ?? null,
401
+ occurredAt: now.toISOString(),
402
+ links: {
403
+ automation: `/automations/${input.automation.id}`,
404
+ issue: input.issueId ? `/issues/${input.issueId}` : null,
405
+ },
406
+ },
407
+ })
408
+ .returning();
409
+ if (!message)
410
+ return null;
411
+ await executor
412
+ .update(chatConversations)
413
+ .set({ lastMessageAt: message.createdAt, updatedAt: message.createdAt })
414
+ .where(eq(chatConversations.id, input.automation.chatConversationId));
415
+ await executor
416
+ .update(automationRuns)
417
+ .set({
418
+ linkedChatConversationId: input.automation.chatConversationId,
419
+ startedChatMessageId: input.status === "issue_created" ? message.id : undefined,
420
+ terminalChatMessageId: input.terminal ? message.id : undefined,
421
+ lastChatMessageId: message.id,
422
+ updatedAt: new Date(),
423
+ })
424
+ .where(eq(automationRuns.id, input.runId));
425
+ return message;
426
+ }
384
427
  async function createWebhookSecret(orgId, automationId, actor) {
385
428
  const secretValue = crypto.randomBytes(24).toString("hex");
386
429
  const secret = await secretsSvc.create(orgId, {
@@ -431,6 +474,9 @@ export function automationService(db, deps = {}) {
431
474
  triggeredAt,
432
475
  idempotencyKey: input.idempotencyKey ?? null,
433
476
  triggerPayload: input.payload ?? null,
477
+ linkedChatConversationId: input.automation.outputMode === "chat_output"
478
+ ? input.automation.chatConversationId
479
+ : null,
434
480
  })
435
481
  .returning();
436
482
  const nextRunAt = input.trigger?.kind === "schedule" && input.trigger.cronExpression && input.trigger.timezone
@@ -455,7 +501,17 @@ export function automationService(db, deps = {}) {
455
501
  issueId: activeIssue.id,
456
502
  nextRunAt,
457
503
  }, txDb);
458
- return updated ?? createdRun;
504
+ await postAutomationRunChatEvent({
505
+ automation: input.automation,
506
+ runId: createdRun.id,
507
+ status,
508
+ source: input.source,
509
+ triggerId: input.trigger?.id ?? null,
510
+ issueId: activeIssue.id,
511
+ terminal: true,
512
+ executor: txDb,
513
+ });
514
+ return await getAutomationRunById(createdRun.id, txDb) ?? updated ?? createdRun;
459
515
  }
460
516
  try {
461
517
  createdIssue = await issueSvc.create(input.automation.orgId, {
@@ -500,7 +556,17 @@ export function automationService(db, deps = {}) {
500
556
  issueId: existingIssue.id,
501
557
  nextRunAt,
502
558
  }, txDb);
503
- return updated ?? createdRun;
559
+ await postAutomationRunChatEvent({
560
+ automation: input.automation,
561
+ runId: createdRun.id,
562
+ status,
563
+ source: input.source,
564
+ triggerId: input.trigger?.id ?? null,
565
+ issueId: existingIssue.id,
566
+ terminal: true,
567
+ executor: txDb,
568
+ });
569
+ return await getAutomationRunById(createdRun.id, txDb) ?? updated ?? createdRun;
504
570
  }
505
571
  // Keep the dispatch lock until the issue is linked to a queued heartbeat run.
506
572
  await queueIssueAssignmentWakeup({
@@ -524,7 +590,16 @@ export function automationService(db, deps = {}) {
524
590
  issueId: createdIssue.id,
525
591
  nextRunAt,
526
592
  }, txDb);
527
- return updated ?? createdRun;
593
+ await postAutomationRunChatEvent({
594
+ automation: input.automation,
595
+ runId: createdRun.id,
596
+ status: "issue_created",
597
+ source: input.source,
598
+ triggerId: input.trigger?.id ?? null,
599
+ issueId: createdIssue.id,
600
+ executor: txDb,
601
+ });
602
+ return await getAutomationRunById(createdRun.id, txDb) ?? updated ?? createdRun;
528
603
  }
529
604
  catch (error) {
530
605
  if (createdIssue) {
@@ -543,7 +618,17 @@ export function automationService(db, deps = {}) {
543
618
  status: "failed",
544
619
  nextRunAt,
545
620
  }, txDb);
546
- return failed ?? createdRun;
621
+ await postAutomationRunChatEvent({
622
+ automation: input.automation,
623
+ runId: createdRun.id,
624
+ status: "failed",
625
+ source: input.source,
626
+ triggerId: input.trigger?.id ?? null,
627
+ failureReason,
628
+ terminal: true,
629
+ executor: txDb,
630
+ });
631
+ return await getAutomationRunById(createdRun.id, txDb) ?? failed ?? createdRun;
547
632
  }
548
633
  });
549
634
  if (input.source === "schedule" || input.source === "webhook") {
@@ -586,7 +671,7 @@ export function automationService(db, deps = {}) {
586
671
  listLiveIssueByAutomationIds(orgId, automationIds),
587
672
  ]);
588
673
  return rows.map((row) => ({
589
- ...row,
674
+ ...toAutomation(row),
590
675
  triggers: (triggersByAutomation.get(row.id) ?? []).map((trigger) => ({
591
676
  id: trigger.id,
592
677
  kind: trigger.kind,
@@ -606,10 +691,23 @@ export function automationService(db, deps = {}) {
606
691
  return null;
607
692
  if (row.status === "archived")
608
693
  return null;
609
- const [project, assignee, parentIssue, triggers, recentRuns, activeIssue] = await Promise.all([
694
+ const [project, assignee, parentIssue, chatConversation, triggers, recentRuns, activeIssue] = await Promise.all([
610
695
  row.projectId ? db.select().from(projects).where(eq(projects.id, row.projectId)).then((rows) => rows[0] ?? null) : null,
611
696
  db.select().from(agents).where(eq(agents.id, row.assigneeAgentId)).then((rows) => rows[0] ?? null),
612
697
  row.parentIssueId ? issueSvc.getById(row.parentIssueId) : null,
698
+ row.chatConversationId
699
+ ? db
700
+ .select({
701
+ id: chatConversations.id,
702
+ title: chatConversations.title,
703
+ status: chatConversations.status,
704
+ preferredAgentId: chatConversations.preferredAgentId,
705
+ lastMessageAt: chatConversations.lastMessageAt,
706
+ })
707
+ .from(chatConversations)
708
+ .where(eq(chatConversations.id, row.chatConversationId))
709
+ .then((rows) => rows[0] ?? null)
710
+ : null,
613
711
  db.select().from(automationTriggers).where(eq(automationTriggers.automationId, row.id)).orderBy(asc(automationTriggers.createdAt)),
614
712
  db
615
713
  .select({
@@ -623,6 +721,10 @@ export function automationService(db, deps = {}) {
623
721
  idempotencyKey: automationRuns.idempotencyKey,
624
722
  triggerPayload: automationRuns.triggerPayload,
625
723
  linkedIssueId: automationRuns.linkedIssueId,
724
+ linkedChatConversationId: automationRuns.linkedChatConversationId,
725
+ startedChatMessageId: automationRuns.startedChatMessageId,
726
+ terminalChatMessageId: automationRuns.terminalChatMessageId,
727
+ lastChatMessageId: automationRuns.lastChatMessageId,
626
728
  coalescedIntoRunId: automationRuns.coalescedIntoRunId,
627
729
  failureReason: automationRuns.failureReason,
628
730
  completedAt: automationRuns.completedAt,
@@ -635,10 +737,15 @@ export function automationService(db, deps = {}) {
635
737
  issueStatus: issues.status,
636
738
  issuePriority: issues.priority,
637
739
  issueUpdatedAt: issues.updatedAt,
740
+ chatTitle: chatConversations.title,
741
+ chatStatus: chatConversations.status,
742
+ chatPreferredAgentId: chatConversations.preferredAgentId,
743
+ chatLastMessageAt: chatConversations.lastMessageAt,
638
744
  })
639
745
  .from(automationRuns)
640
746
  .leftJoin(automationTriggers, eq(automationRuns.triggerId, automationTriggers.id))
641
747
  .leftJoin(issues, eq(automationRuns.linkedIssueId, issues.id))
748
+ .leftJoin(chatConversations, eq(automationRuns.linkedChatConversationId, chatConversations.id))
642
749
  .where(eq(automationRuns.automationId, row.id))
643
750
  .orderBy(desc(automationRuns.createdAt))
644
751
  .limit(25)
@@ -653,6 +760,10 @@ export function automationService(db, deps = {}) {
653
760
  idempotencyKey: run.idempotencyKey,
654
761
  triggerPayload: run.triggerPayload,
655
762
  linkedIssueId: run.linkedIssueId,
763
+ linkedChatConversationId: run.linkedChatConversationId,
764
+ startedChatMessageId: run.startedChatMessageId,
765
+ terminalChatMessageId: run.terminalChatMessageId,
766
+ lastChatMessageId: run.lastChatMessageId,
656
767
  coalescedIntoRunId: run.coalescedIntoRunId,
657
768
  failureReason: run.failureReason,
658
769
  completedAt: run.completedAt,
@@ -668,6 +779,7 @@ export function automationService(db, deps = {}) {
668
779
  updatedAt: run.issueUpdatedAt ?? run.updatedAt,
669
780
  }
670
781
  : null,
782
+ linkedChatConversation: linkedChatConversationFromRow(run),
671
783
  trigger: run.triggerId
672
784
  ? {
673
785
  id: run.triggerId,
@@ -679,10 +791,11 @@ export function automationService(db, deps = {}) {
679
791
  findLiveExecutionIssue(row),
680
792
  ]);
681
793
  return {
682
- ...row,
794
+ ...toAutomation(row),
683
795
  project,
684
796
  assignee,
685
797
  parentIssue,
798
+ chatConversation,
686
799
  triggers: triggers,
687
800
  recentRuns,
688
801
  activeIssue,
@@ -696,6 +809,13 @@ export function automationService(db, deps = {}) {
696
809
  await assertGoal(orgId, input.goalId);
697
810
  if (input.parentIssueId)
698
811
  await assertParentIssue(orgId, input.parentIssueId);
812
+ await assertChatOutputDestination({
813
+ orgId,
814
+ outputMode: input.outputMode,
815
+ chatConversationId: input.chatConversationId,
816
+ assigneeAgentId: input.assigneeAgentId,
817
+ allowAssigneeChatMismatch: input.allowAssigneeChatMismatch,
818
+ });
699
819
  const [created] = await db
700
820
  .insert(automations)
701
821
  .values({
@@ -706,6 +826,8 @@ export function automationService(db, deps = {}) {
706
826
  title: input.title,
707
827
  description: input.description ?? null,
708
828
  assigneeAgentId: input.assigneeAgentId,
829
+ outputMode: input.outputMode,
830
+ chatConversationId: input.chatConversationId ?? null,
709
831
  priority: input.priority,
710
832
  status: input.status,
711
833
  concurrencyPolicy: input.concurrencyPolicy,
@@ -716,7 +838,7 @@ export function automationService(db, deps = {}) {
716
838
  updatedByUserId: actor.userId ?? null,
717
839
  })
718
840
  .returning();
719
- return created;
841
+ return toAutomation(created);
720
842
  },
721
843
  update: async (id, patch, actor) => {
722
844
  const existing = await getAutomationById(id);
@@ -724,6 +846,8 @@ export function automationService(db, deps = {}) {
724
846
  return null;
725
847
  const nextProjectId = patch.projectId === undefined ? existing.projectId : patch.projectId;
726
848
  const nextAssigneeAgentId = patch.assigneeAgentId ?? existing.assigneeAgentId;
849
+ const nextOutputMode = patch.outputMode ?? existing.outputMode;
850
+ const nextChatConversationId = patch.chatConversationId === undefined ? existing.chatConversationId : patch.chatConversationId;
727
851
  if (nextProjectId)
728
852
  await assertProject(existing.orgId, nextProjectId);
729
853
  if (patch.assigneeAgentId)
@@ -732,6 +856,13 @@ export function automationService(db, deps = {}) {
732
856
  await assertGoal(existing.orgId, patch.goalId);
733
857
  if (patch.parentIssueId)
734
858
  await assertParentIssue(existing.orgId, patch.parentIssueId);
859
+ await assertChatOutputDestination({
860
+ orgId: existing.orgId,
861
+ outputMode: nextOutputMode,
862
+ chatConversationId: nextChatConversationId,
863
+ assigneeAgentId: nextAssigneeAgentId,
864
+ allowAssigneeChatMismatch: patch.allowAssigneeChatMismatch,
865
+ });
735
866
  const [updated] = await db
736
867
  .update(automations)
737
868
  .set({
@@ -741,6 +872,8 @@ export function automationService(db, deps = {}) {
741
872
  title: patch.title ?? existing.title,
742
873
  description: patch.description === undefined ? existing.description : patch.description,
743
874
  assigneeAgentId: nextAssigneeAgentId,
875
+ outputMode: nextOutputMode,
876
+ chatConversationId: nextOutputMode === "chat_output" ? nextChatConversationId : null,
744
877
  priority: patch.priority ?? existing.priority,
745
878
  status: patch.status ?? existing.status,
746
879
  concurrencyPolicy: patch.concurrencyPolicy ?? existing.concurrencyPolicy,
@@ -751,7 +884,7 @@ export function automationService(db, deps = {}) {
751
884
  })
752
885
  .where(eq(automations.id, id))
753
886
  .returning();
754
- return updated ?? null;
887
+ return updated ? toAutomation(updated) : null;
755
888
  },
756
889
  delete: async (id) => {
757
890
  const existing = await getAutomationById(id);
@@ -768,7 +901,7 @@ export function automationService(db, deps = {}) {
768
901
  }
769
902
  await tx.delete(automations).where(eq(automations.id, id));
770
903
  });
771
- return existing;
904
+ return toAutomation(existing);
772
905
  },
773
906
  createTrigger: async (automationId, input, actor) => {
774
907
  const automation = await getAutomationById(automationId);
@@ -991,6 +1124,10 @@ export function automationService(db, deps = {}) {
991
1124
  idempotencyKey: automationRuns.idempotencyKey,
992
1125
  triggerPayload: automationRuns.triggerPayload,
993
1126
  linkedIssueId: automationRuns.linkedIssueId,
1127
+ linkedChatConversationId: automationRuns.linkedChatConversationId,
1128
+ startedChatMessageId: automationRuns.startedChatMessageId,
1129
+ terminalChatMessageId: automationRuns.terminalChatMessageId,
1130
+ lastChatMessageId: automationRuns.lastChatMessageId,
994
1131
  coalescedIntoRunId: automationRuns.coalescedIntoRunId,
995
1132
  failureReason: automationRuns.failureReason,
996
1133
  completedAt: automationRuns.completedAt,
@@ -1003,10 +1140,15 @@ export function automationService(db, deps = {}) {
1003
1140
  issueStatus: issues.status,
1004
1141
  issuePriority: issues.priority,
1005
1142
  issueUpdatedAt: issues.updatedAt,
1143
+ chatTitle: chatConversations.title,
1144
+ chatStatus: chatConversations.status,
1145
+ chatPreferredAgentId: chatConversations.preferredAgentId,
1146
+ chatLastMessageAt: chatConversations.lastMessageAt,
1006
1147
  })
1007
1148
  .from(automationRuns)
1008
1149
  .leftJoin(automationTriggers, eq(automationRuns.triggerId, automationTriggers.id))
1009
1150
  .leftJoin(issues, eq(automationRuns.linkedIssueId, issues.id))
1151
+ .leftJoin(chatConversations, eq(automationRuns.linkedChatConversationId, chatConversations.id))
1010
1152
  .where(eq(automationRuns.automationId, automationId))
1011
1153
  .orderBy(desc(automationRuns.createdAt))
1012
1154
  .limit(cappedLimit);
@@ -1021,6 +1163,10 @@ export function automationService(db, deps = {}) {
1021
1163
  idempotencyKey: row.idempotencyKey,
1022
1164
  triggerPayload: row.triggerPayload,
1023
1165
  linkedIssueId: row.linkedIssueId,
1166
+ linkedChatConversationId: row.linkedChatConversationId,
1167
+ startedChatMessageId: row.startedChatMessageId,
1168
+ terminalChatMessageId: row.terminalChatMessageId,
1169
+ lastChatMessageId: row.lastChatMessageId,
1024
1170
  coalescedIntoRunId: row.coalescedIntoRunId,
1025
1171
  failureReason: row.failureReason,
1026
1172
  completedAt: row.completedAt,
@@ -1036,6 +1182,7 @@ export function automationService(db, deps = {}) {
1036
1182
  updatedAt: row.issueUpdatedAt ?? row.updatedAt,
1037
1183
  }
1038
1184
  : null,
1185
+ linkedChatConversation: linkedChatConversationFromRow(row),
1039
1186
  trigger: row.triggerId
1040
1187
  ? {
1041
1188
  id: row.triggerId,
@@ -1098,6 +1245,7 @@ export function automationService(db, deps = {}) {
1098
1245
  id: issues.id,
1099
1246
  status: issues.status,
1100
1247
  originKind: issues.originKind,
1248
+ originId: issues.originId,
1101
1249
  originRunId: issues.originRunId,
1102
1250
  })
1103
1251
  .from(issues)
@@ -1105,18 +1253,47 @@ export function automationService(db, deps = {}) {
1105
1253
  .then((rows) => rows[0] ?? null);
1106
1254
  if (!issue || issue.originKind !== "automation_execution" || !issue.originRunId)
1107
1255
  return null;
1256
+ const automation = issue.originId ? await getAutomationById(issue.originId) : null;
1108
1257
  if (issue.status === "done") {
1109
- return finalizeRun(issue.originRunId, {
1258
+ const run = await finalizeRun(issue.originRunId, {
1110
1259
  status: "completed",
1111
1260
  completedAt: new Date(),
1112
1261
  });
1262
+ if (automation) {
1263
+ await postAutomationRunChatEvent({
1264
+ automation,
1265
+ runId: issue.originRunId,
1266
+ status: "completed",
1267
+ source: run?.source ?? "manual",
1268
+ triggerId: run?.triggerId ?? null,
1269
+ issueId: issue.id,
1270
+ terminal: true,
1271
+ });
1272
+ return getAutomationRunById(issue.originRunId);
1273
+ }
1274
+ return run;
1113
1275
  }
1114
1276
  if (issue.status === "blocked" || issue.status === "cancelled") {
1115
- return finalizeRun(issue.originRunId, {
1277
+ const failureReason = `Execution issue moved to ${issue.status}`;
1278
+ const run = await finalizeRun(issue.originRunId, {
1116
1279
  status: "failed",
1117
- failureReason: `Execution issue moved to ${issue.status}`,
1280
+ failureReason,
1118
1281
  completedAt: new Date(),
1119
1282
  });
1283
+ if (automation) {
1284
+ await postAutomationRunChatEvent({
1285
+ automation,
1286
+ runId: issue.originRunId,
1287
+ status: "failed",
1288
+ source: run?.source ?? "manual",
1289
+ triggerId: run?.triggerId ?? null,
1290
+ issueId: issue.id,
1291
+ failureReason,
1292
+ terminal: true,
1293
+ });
1294
+ return getAutomationRunById(issue.originRunId);
1295
+ }
1296
+ return run;
1120
1297
  }
1121
1298
  return null;
1122
1299
  },