@overlordai/server 1.0.144 → 1.0.146

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 (230) hide show
  1. package/database/migrations/014-automations.sql +67 -0
  2. package/dist/adapters/command-parser.utils.d.ts +1 -0
  3. package/dist/adapters/command-parser.utils.d.ts.map +1 -1
  4. package/dist/adapters/command-parser.utils.js +14 -1
  5. package/dist/adapters/command-parser.utils.js.map +1 -1
  6. package/dist/adapters/help-text.d.ts.map +1 -1
  7. package/dist/adapters/help-text.js +2 -1
  8. package/dist/adapters/help-text.js.map +1 -1
  9. package/dist/adapters/nlu.service.d.ts.map +1 -1
  10. package/dist/adapters/nlu.service.js +4 -1
  11. package/dist/adapters/nlu.service.js.map +1 -1
  12. package/dist/app.module.d.ts.map +1 -1
  13. package/dist/app.module.js +2 -0
  14. package/dist/app.module.js.map +1 -1
  15. package/dist/automation/automation-executor.d.ts +23 -0
  16. package/dist/automation/automation-executor.d.ts.map +1 -0
  17. package/dist/automation/automation-executor.js +365 -0
  18. package/dist/automation/automation-executor.js.map +1 -0
  19. package/dist/automation/automation-scheduler.d.ts +21 -0
  20. package/dist/automation/automation-scheduler.d.ts.map +1 -0
  21. package/dist/automation/automation-scheduler.js +124 -0
  22. package/dist/automation/automation-scheduler.js.map +1 -0
  23. package/dist/automation/automation-template.service.d.ts +30 -0
  24. package/dist/automation/automation-template.service.d.ts.map +1 -0
  25. package/dist/automation/automation-template.service.js +66 -0
  26. package/dist/automation/automation-template.service.js.map +1 -0
  27. package/dist/automation/automation-trigger.d.ts +13 -0
  28. package/dist/automation/automation-trigger.d.ts.map +1 -0
  29. package/dist/automation/automation-trigger.js +96 -0
  30. package/dist/automation/automation-trigger.js.map +1 -0
  31. package/dist/automation/automation-validation.d.ts +14 -0
  32. package/dist/automation/automation-validation.d.ts.map +1 -0
  33. package/dist/automation/automation-validation.js +66 -0
  34. package/dist/automation/automation-validation.js.map +1 -0
  35. package/dist/automation/automation.module.d.ts +3 -0
  36. package/dist/automation/automation.module.d.ts.map +1 -0
  37. package/dist/automation/automation.module.js +33 -0
  38. package/dist/automation/automation.module.js.map +1 -0
  39. package/dist/automation/automation.service.d.ts +22 -0
  40. package/dist/automation/automation.service.d.ts.map +1 -0
  41. package/dist/automation/automation.service.js +232 -0
  42. package/dist/automation/automation.service.js.map +1 -0
  43. package/dist/database/database.service.d.ts +8 -0
  44. package/dist/database/database.service.d.ts.map +1 -1
  45. package/dist/database/database.service.js +16 -5
  46. package/dist/database/database.service.js.map +1 -1
  47. package/dist/database/repositories/automation.repository.d.ts +87 -0
  48. package/dist/database/repositories/automation.repository.d.ts.map +1 -0
  49. package/dist/database/repositories/automation.repository.js +531 -0
  50. package/dist/database/repositories/automation.repository.js.map +1 -0
  51. package/dist/database/repositories/task.repository.d.ts +1 -0
  52. package/dist/database/repositories/task.repository.d.ts.map +1 -1
  53. package/dist/database/repositories/task.repository.js +4 -2
  54. package/dist/database/repositories/task.repository.js.map +1 -1
  55. package/dist/database/repository.module.d.ts.map +1 -1
  56. package/dist/database/repository.module.js +2 -0
  57. package/dist/database/repository.module.js.map +1 -1
  58. package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
  59. package/dist/dispatcher/dispatcher.service.js +1 -0
  60. package/dist/dispatcher/dispatcher.service.js.map +1 -1
  61. package/dist/dispatcher/task-creation.service.d.ts +3 -3
  62. package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
  63. package/dist/dispatcher/task-creation.service.js +14 -5
  64. package/dist/dispatcher/task-creation.service.js.map +1 -1
  65. package/dist/events/event-types.d.ts +31 -0
  66. package/dist/events/event-types.d.ts.map +1 -1
  67. package/dist/events/event-types.js +4 -0
  68. package/dist/events/event-types.js.map +1 -1
  69. package/dist/notifier/notification-consumer.d.ts.map +1 -1
  70. package/dist/notifier/notification-consumer.js +65 -1
  71. package/dist/notifier/notification-consumer.js.map +1 -1
  72. package/dist/notifier/notification-event-listener.d.ts +7 -2
  73. package/dist/notifier/notification-event-listener.d.ts.map +1 -1
  74. package/dist/notifier/notification-event-listener.js +56 -2
  75. package/dist/notifier/notification-event-listener.js.map +1 -1
  76. package/dist/notifier/notifier.service.d.ts +4 -1
  77. package/dist/notifier/notifier.service.d.ts.map +1 -1
  78. package/dist/notifier/notifier.service.js +23 -2
  79. package/dist/notifier/notifier.service.js.map +1 -1
  80. package/dist/notifier/template.service.d.ts +1 -1
  81. package/dist/notifier/template.service.d.ts.map +1 -1
  82. package/dist/notifier/template.service.js +14 -4
  83. package/dist/notifier/template.service.js.map +1 -1
  84. package/dist/web/automation.controller.d.ts +74 -0
  85. package/dist/web/automation.controller.d.ts.map +1 -0
  86. package/dist/web/automation.controller.js +539 -0
  87. package/dist/web/automation.controller.js.map +1 -0
  88. package/dist/web/frame-handlers/automation-report.handler.d.ts +10 -0
  89. package/dist/web/frame-handlers/automation-report.handler.d.ts.map +1 -0
  90. package/dist/web/frame-handlers/automation-report.handler.js +15 -0
  91. package/dist/web/frame-handlers/automation-report.handler.js.map +1 -0
  92. package/dist/web/frame-handlers/index.d.ts +1 -0
  93. package/dist/web/frame-handlers/index.d.ts.map +1 -1
  94. package/dist/web/frame-handlers/index.js +3 -1
  95. package/dist/web/frame-handlers/index.js.map +1 -1
  96. package/dist/web/frame-handlers/stage-confirm.handler.d.ts.map +1 -1
  97. package/dist/web/frame-handlers/stage-confirm.handler.js +1 -1
  98. package/dist/web/frame-handlers/stage-confirm.handler.js.map +1 -1
  99. package/dist/web/task.controller.d.ts +3 -0
  100. package/dist/web/task.controller.d.ts.map +1 -1
  101. package/dist/web/web-event.service.d.ts +20 -1
  102. package/dist/web/web-event.service.d.ts.map +1 -1
  103. package/dist/web/web-event.service.js +66 -2
  104. package/dist/web/web-event.service.js.map +1 -1
  105. package/dist/web/web.module.d.ts.map +1 -1
  106. package/dist/web/web.module.js +4 -1
  107. package/dist/web/web.module.js.map +1 -1
  108. package/dist/web/worker-channel.gateway.d.ts +2 -1
  109. package/dist/web/worker-channel.gateway.d.ts.map +1 -1
  110. package/dist/web/worker-channel.gateway.js +5 -2
  111. package/dist/web/worker-channel.gateway.js.map +1 -1
  112. package/package.json +5 -4
  113. package/public/assets/AccessTokensPage-jZ0fW6lX.js +1 -0
  114. package/public/assets/{AdminPage-OHTVG-ck.js → AdminPage-BhEFd__u.js} +1 -1
  115. package/public/assets/{AgentCliPage-BsZmnI3p.js → AgentCliPage-BlwF0Ske.js} +1 -1
  116. package/public/assets/{ApiReferencePage-8yiImnYs.js → ApiReferencePage-DYw-AFRb.js} +1 -1
  117. package/public/assets/{ArchitecturePage-Deswgqy2.js → ArchitecturePage-Bj4s2Tjl.js} +1 -1
  118. package/public/assets/{AuditLogPage-Hn4ivp8Y.js → AuditLogPage-Dw56aHuy.js} +1 -1
  119. package/public/assets/AutomationCreatePage-Dt2pGfgf.js +1 -0
  120. package/public/assets/AutomationDetailPage-DNYkC31X.js +16 -0
  121. package/public/assets/AutomationEditPage-C8IUsSvR.js +1 -0
  122. package/public/assets/AutomationListPage-Bqog--Ae.js +16 -0
  123. package/public/assets/AutomationRunDetailPage-C3PuPibC.js +6 -0
  124. package/public/assets/{BindPlatformPage-DjGHKswB.js → BindPlatformPage-M_2I5Qrq.js} +1 -1
  125. package/public/assets/BotIntegrationPage-CAwevaIk.js +1 -0
  126. package/public/assets/{BotManage-Dss1Y_jv.js → BotManage-DGBezqSD.js} +2 -2
  127. package/public/assets/{BotSetupPage-C_KKFdu3.js → BotSetupPage-C0Fs8ZnS.js} +2 -2
  128. package/public/assets/{ChangelogPage-5btaAfls.js → ChangelogPage-DlB2ibrO.js} +1 -1
  129. package/public/assets/{CliReferencePage--yAuXfNl.js → CliReferencePage-CZfrDLHw.js} +1 -1
  130. package/public/assets/ConfirmStageDialog-Z0pbQqim.js +7 -0
  131. package/public/assets/{DeploymentPage-Qi860C4T.js → DeploymentPage-7vnTwGfh.js} +1 -1
  132. package/public/assets/{DevWorkflowPage-CZks72g2.js → DevWorkflowPage-DuwsvFYh.js} +1 -1
  133. package/public/assets/DeveloperManage-D4RJh1ZW.js +16 -0
  134. package/public/assets/{DeveloperSetupPage-CSs2Mh7c.js → DeveloperSetupPage-BrCi0Lwe.js} +1 -1
  135. package/public/assets/{DocsIndexPage-BmSMwLvO.js → DocsIndexPage-rnTjEz8b.js} +1 -1
  136. package/public/assets/{DocsLayout-CunlDzH9.js → DocsLayout-C6xN_yk0.js} +1 -1
  137. package/public/assets/{DocsPrimitives-Bqnk0mEW.js → DocsPrimitives-IJB6nZ_z.js} +1 -1
  138. package/public/assets/{EditProjectPage-CJAdaxRE.js → EditProjectPage-BPUvr801.js} +2 -2
  139. package/public/assets/{EmptyState-DpRw-xch.js → EmptyState-CW1xfNCv.js} +1 -1
  140. package/public/assets/{EnvVariablesPage-DWD4RzmX.js → EnvVariablesPage-CR4pvBH3.js} +2 -2
  141. package/public/assets/{HomePage-oShWGYcN.js → HomePage-A0kDqIF6.js} +1 -1
  142. package/public/assets/{InfoRow-CTXIPrG6.js → InfoRow-D-vceQHX.js} +1 -1
  143. package/public/assets/{InstallationPage-BgbU06Ei.js → InstallationPage-DQOr1ZdF.js} +1 -1
  144. package/public/assets/{LandingPage-C-s-hSgz.js → LandingPage-B1mQ0b1M.js} +7 -12
  145. package/public/assets/{LocalDevelopmentPage-Cg4FYaCn.js → LocalDevelopmentPage-B3tPpv14.js} +1 -1
  146. package/public/assets/{LoginPage-BhyQxY5d.js → LoginPage-2TJGugqP.js} +1 -1
  147. package/public/assets/{MetricBar-DZOZStDZ.js → MetricBar-BWriVYES.js} +1 -1
  148. package/public/assets/{NotFoundPage-DaeTOzAm.js → NotFoundPage-CL8L-hAH.js} +1 -1
  149. package/public/assets/{OnboardingGuide-DGH0Yfsj.js → OnboardingGuide-Cdz3B-Hy.js} +1 -1
  150. package/public/assets/{PermissionsPage-D4Lqb40x.js → PermissionsPage-BdKxCcLI.js} +1 -1
  151. package/public/assets/{PipelineConfigPage-CAWpyPiY.js → PipelineConfigPage-CYPnPxIe.js} +1 -1
  152. package/public/assets/{PipelineEditorPage-BLDxO49P.js → PipelineEditorPage-Cx5jQ7sn.js} +2 -2
  153. package/public/assets/{PlanPage-UX5QUlvv.js → PlanPage-B8izWg2B.js} +1 -1
  154. package/public/assets/{ProfilePage-B73YqnCd.js → ProfilePage-S_chkZka.js} +1 -1
  155. package/public/assets/{ProjectDetailPage-eNAn85vT.js → ProjectDetailPage-DPjR4K6z.js} +3 -3
  156. package/public/assets/ProjectListPage-B7KDEb5r.js +6 -0
  157. package/public/assets/PtyTerminal-SPgs4fDa.js +38 -0
  158. package/public/assets/{QuickAuth-DSSMYJEC.js → QuickAuth-kStSentC.js} +1 -1
  159. package/public/assets/RemoveMemberConfirmDialog-nrYU_g4X.js +6 -0
  160. package/public/assets/ReviewAggregatePage-BycSqu1a.js +6 -0
  161. package/public/assets/{ReviewPage-BNa6T3xv.js → ReviewPage-CDyr8wXz.js} +1 -1
  162. package/public/assets/{Select-FmuTJbfh.js → Select-B0NXCdTE.js} +1 -1
  163. package/public/assets/{SettingsPage-aSrpn6Ta.js → SettingsPage-BOXtwa2r.js} +1 -1
  164. package/public/assets/{Skeleton-Bo0DEIHn.js → Skeleton-BiHQNXJ9.js} +1 -1
  165. package/public/assets/{SkillPage-BjiQKd7n.js → SkillPage-DBiTVuCH.js} +1 -1
  166. package/public/assets/{TaskDetailPage-BLNjDqnY.js → TaskDetailPage-CTVJwy-t.js} +2 -2
  167. package/public/assets/{TaskGuidePage-C5o7i2D0.js → TaskGuidePage-BsH7MBPf.js} +1 -1
  168. package/public/assets/TaskListPage-pui2im5r.js +1 -0
  169. package/public/assets/{TaskStatusBadge-CD8sO9C_.js → TaskStatusBadge-CeC-9VO9.js} +1 -1
  170. package/public/assets/TerminalHomePage-Bu10hJuQ.js +6 -0
  171. package/public/assets/TokenManage-Bo15S_D_.js +1 -0
  172. package/public/assets/{Tooltip-BKRBwA7o.js → Tooltip-BtLbD3s1.js} +1 -1
  173. package/public/assets/{TotpSetupPage-IVkRIgKh.js → TotpSetupPage-QOB1KoQV.js} +1 -1
  174. package/public/assets/{WorkerDetailPage-nw_gzQ45.js → WorkerDetailPage-BbUUJ-4x.js} +1 -1
  175. package/public/assets/WorkerListPage-Cz97ZJ44.js +6 -0
  176. package/public/assets/{WorkerOperationsPage-Clh8jDGG.js → WorkerOperationsPage-BVb41hZJ.js} +1 -1
  177. package/public/assets/{WorkerSetupGuidePage-C1wXY1wd.js → WorkerSetupGuidePage-Cidrk_C8.js} +1 -1
  178. package/public/assets/{WorkerSetupPage-CTCwHKaC.js → WorkerSetupPage-BEBJC4eO.js} +1 -1
  179. package/public/assets/{agent-type-options-5v4PgZnP.js → agent-type-options-js05RaN7.js} +1 -1
  180. package/public/assets/{arrow-left-CR_n40mK.js → arrow-left-B7mlJm2S.js} +1 -1
  181. package/public/assets/{arrow-right-D-j7nSgI.js → arrow-right-pahP-ey1.js} +1 -1
  182. package/public/assets/{bot--DUOKBmv.js → bot-Utar32Rx.js} +1 -1
  183. package/public/assets/{chevron-down-CDFiGGBG.js → chevron-down-rRjDei6n.js} +1 -1
  184. package/public/assets/{chevron-left-C_lJcnCg.js → chevron-left-Bh3DdiT8.js} +1 -1
  185. package/public/assets/{chevron-right-IZlTWMcO.js → chevron-right-BUIsW0nB.js} +1 -1
  186. package/public/assets/{chevron-up-DSOCVgRW.js → chevron-up-CC4d-5nr.js} +1 -1
  187. package/public/assets/circle-alert-DfjZjHfx.js +6 -0
  188. package/public/assets/clock-CcoV8c6t.js +6 -0
  189. package/public/assets/{copy-2UMMaHKT.js → copy-CVElRaVS.js} +1 -1
  190. package/public/assets/{download-D2NyL1OR.js → download-Cuv6Ei5j.js} +1 -1
  191. package/public/assets/{external-link-B9CWNSMc.js → external-link-Beb0-hR9.js} +1 -1
  192. package/public/assets/{file-text-COzaNu8e.js → file-text-DQb29yBJ.js} +1 -1
  193. package/public/assets/{git-fork-9KuFRmam.js → git-fork-IyYS1SDo.js} +1 -1
  194. package/public/assets/index-CFc6KjWS.js +257 -0
  195. package/public/assets/index-CdJk2QGi.css +1 -0
  196. package/public/assets/{key-DoJm5thS.js → key-C5pNR-B1.js} +1 -1
  197. package/public/assets/{loader-circle-B5SLmhRr.js → loader-circle-BlnkIjik.js} +1 -1
  198. package/public/assets/{pencil-C_niWuAb.js → pencil-C2RlSzkd.js} +1 -1
  199. package/public/assets/{play-Do-8kkck.js → play-CShsFo4_.js} +1 -1
  200. package/public/assets/{plus-C8aSzgHN.js → plus-Awea36q5.js} +1 -1
  201. package/public/assets/{rotate-ccw-BSPzJeCn.js → rotate-ccw-Lsbc1OqV.js} +1 -1
  202. package/public/assets/{scroll-text-DdqU_dT6.js → scroll-text-Dljs30sR.js} +1 -1
  203. package/public/assets/{settings-C8PB6BpE.js → settings-Dagn2Hyc.js} +1 -1
  204. package/public/assets/{skip-forward-CEuvYtQc.js → skip-forward-DGvJRd3l.js} +1 -1
  205. package/public/assets/{status-colors-0U8b2F2t.js → status-colors-BDICDBur.js} +1 -1
  206. package/public/assets/{task-constants-DTDx5Lfp.js → task-constants-Cla1S92u.js} +1 -1
  207. package/public/assets/{task.store-CGgehOLp.js → task.store-C7wSxS0U.js} +1 -1
  208. package/public/assets/timer-DJB-k-YQ.js +6 -0
  209. package/public/assets/{trash-2-tEkzRo6q.js → trash-2-Dbr1-vpY.js} +1 -1
  210. package/public/assets/{useFetch-CJDmNhIT.js → useFetch-BXXQ6s_s.js} +1 -1
  211. package/public/assets/{users-Cs2w_uVo.js → users-CAOqfuvd.js} +1 -1
  212. package/public/assets/{wifi-BCoKY35p.js → wifi-CxjX29U2.js} +1 -1
  213. package/public/assets/{workflow-BLCy8gMf.js → workflow-BAPA9kNh.js} +1 -1
  214. package/public/assets/zap-yBKAVFp4.js +6 -0
  215. package/public/index.html +2 -2
  216. package/public/sw.js +1 -1
  217. package/public/assets/AccessTokensPage-zuZElOFy.js +0 -1
  218. package/public/assets/BotIntegrationPage-58cLGS0T.js +0 -1
  219. package/public/assets/ConfirmStageDialog-BatYNr9r.js +0 -12
  220. package/public/assets/DeveloperManage-7tpVdYUx.js +0 -16
  221. package/public/assets/ProjectListPage-61CMBaxl.js +0 -6
  222. package/public/assets/PtyTerminal-DOgYXCFD.js +0 -38
  223. package/public/assets/RemoveMemberConfirmDialog-MiS_sqor.js +0 -6
  224. package/public/assets/ReviewAggregatePage-LBAVcz2T.js +0 -11
  225. package/public/assets/TaskListPage-26QNdjqP.js +0 -1
  226. package/public/assets/TerminalHomePage-DBhs1WQJ.js +0 -6
  227. package/public/assets/TokenManage-BQ0e_d4e.js +0 -1
  228. package/public/assets/WorkerListPage-CF1x84G-.js +0 -6
  229. package/public/assets/index-DvdpkDlU.js +0 -252
  230. package/public/assets/index-kJfGgL_V.css +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation-template.service.js","sourceRoot":"","sources":["../../src/automation/automation-template.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAoF;AAEpF,mDAAkH;AAClH,0FAAsF;AACtF,mEAAgE;AAEhE,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAqB,CAAa,CAAC;AAC7E,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,kCAAuB,CAAa,CAAC;AACjF,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,qCAA0B,CAAa,CAAC;AAGxE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC,YAA6B,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IAAG,CAAC;IAErE,OAAO,CAAC,KAAsE;QAC5E,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,kBAAkB,CAAC,KAAgF;QACjG,OAAO,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC;IAED,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC,EA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B,CAAC,iCAAiC,CAAC,CAAC;QACzF,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AA3DY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAEkC,4CAAoB;GADtD,yBAAyB,CA2DrC"}
@@ -0,0 +1,13 @@
1
+ import { AutomationRepository } from '../database/repositories/automation.repository';
2
+ import { TaskRepository } from '../database/repositories/task.repository';
3
+ import { AutomationExecutor } from './automation-executor';
4
+ import { type TaskStatusChangedPayload } from '../events/event-types';
5
+ export declare class AutomationTrigger {
6
+ private readonly automationRepo;
7
+ private readonly taskRepo;
8
+ private readonly executor;
9
+ private readonly logger;
10
+ constructor(automationRepo: AutomationRepository, taskRepo: TaskRepository, executor: AutomationExecutor);
11
+ onTaskStatusChanged(payload: TaskStatusChangedPayload): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=automation-trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation-trigger.d.ts","sourceRoot":"","sources":["../../src/automation/automation-trigger.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAgB,KAAK,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEpF,qBACa,iBAAiB;IAI1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAL3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;gBAG1C,cAAc,EAAE,oBAAoB,EACpC,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,kBAAkB;IAIzC,mBAAmB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CAsD5E"}
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var AutomationTrigger_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AutomationTrigger = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const event_emitter_1 = require("@nestjs/event-emitter");
16
+ const protocol_1 = require("@overlordai/protocol");
17
+ const automation_repository_1 = require("../database/repositories/automation.repository");
18
+ const task_repository_1 = require("../database/repositories/task.repository");
19
+ const automation_executor_1 = require("./automation-executor");
20
+ const event_types_1 = require("../events/event-types");
21
+ let AutomationTrigger = AutomationTrigger_1 = class AutomationTrigger {
22
+ constructor(automationRepo, taskRepo, executor) {
23
+ this.automationRepo = automationRepo;
24
+ this.taskRepo = taskRepo;
25
+ this.executor = executor;
26
+ this.logger = new common_1.Logger(AutomationTrigger_1.name);
27
+ }
28
+ async onTaskStatusChanged(payload) {
29
+ try {
30
+ // 1. Anti-loop guard: Tasks created by automations have a non-null
31
+ // `automationRunId`. We must skip them to prevent infinite cycles
32
+ // where an automation's output task triggers the same (or another)
33
+ // automation, which would create yet another task, and so on.
34
+ const task = this.taskRepo.findById(payload.taskId);
35
+ if (!task || task.automationRunId != null)
36
+ return;
37
+ // 2. Only handle terminal statuses that match supported events
38
+ const eventMap = {
39
+ [protocol_1.TaskStatus.COMPLETED]: 'COMPLETED',
40
+ [protocol_1.TaskStatus.FAILED]: 'FAILED',
41
+ [protocol_1.TaskStatus.CANCELLED]: 'CANCELLED',
42
+ };
43
+ const eventName = eventMap[payload.status];
44
+ if (!eventName)
45
+ return;
46
+ // 3. Find all enabled task_event automations for the task's project
47
+ const automations = this.automationRepo.findEnabledTaskEvent(task.projectKey);
48
+ for (const automation of automations) {
49
+ try {
50
+ // Safety: skip automations from other projects (should not happen with SQL filter, but defensive)
51
+ if (task.projectKey !== automation.projectKey)
52
+ continue;
53
+ const config = automation.triggerConfig;
54
+ // Defensive: ensure config.event is a string before comparing
55
+ if (typeof config.event !== 'string' || config.event !== eventName)
56
+ continue;
57
+ // Match filter: projectKey and taskMode
58
+ const filter = config.filter;
59
+ if (filter?.projectKey && filter.projectKey !== task.projectKey)
60
+ continue;
61
+ if (filter?.taskMode && filter.taskMode !== task.taskMode)
62
+ continue;
63
+ // Execute automation
64
+ await this.executor.execute(automation, {
65
+ trigger: 'task_event',
66
+ event: eventName,
67
+ sourceTaskId: task.id,
68
+ sourceProjectKey: task.projectKey,
69
+ sourceTaskMode: task.taskMode,
70
+ });
71
+ this.logger.log(`Task event triggered automation #${automation.id} from task #${task.id}`);
72
+ }
73
+ catch (err) {
74
+ this.logger.error(`Error triggering automation #${automation.id}: ${err}`);
75
+ }
76
+ }
77
+ }
78
+ catch (err) {
79
+ this.logger.error(`Error in AutomationTrigger.onTaskStatusChanged: ${err}`);
80
+ }
81
+ }
82
+ };
83
+ exports.AutomationTrigger = AutomationTrigger;
84
+ __decorate([
85
+ (0, event_emitter_1.OnEvent)(event_types_1.DomainEvents.TASK_STATUS_CHANGED),
86
+ __metadata("design:type", Function),
87
+ __metadata("design:paramtypes", [Object]),
88
+ __metadata("design:returntype", Promise)
89
+ ], AutomationTrigger.prototype, "onTaskStatusChanged", null);
90
+ exports.AutomationTrigger = AutomationTrigger = AutomationTrigger_1 = __decorate([
91
+ (0, common_1.Injectable)(),
92
+ __metadata("design:paramtypes", [automation_repository_1.AutomationRepository,
93
+ task_repository_1.TaskRepository,
94
+ automation_executor_1.AutomationExecutor])
95
+ ], AutomationTrigger);
96
+ //# sourceMappingURL=automation-trigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation-trigger.js","sourceRoot":"","sources":["../../src/automation/automation-trigger.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yDAAgD;AAChD,mDAAkD;AAClD,0FAAsF;AACtF,8EAA0E;AAC1E,+DAA2D;AAC3D,uDAAoF;AAG7E,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAG5B,YACmB,cAAoC,EACpC,QAAwB,EACxB,QAA4B;QAF5B,mBAAc,GAAd,cAAc,CAAsB;QACpC,aAAQ,GAAR,QAAQ,CAAgB;QACxB,aAAQ,GAAR,QAAQ,CAAoB;QAL9B,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAM1D,CAAC;IAGE,AAAN,KAAK,CAAC,mBAAmB,CAAC,OAAiC;QACzD,IAAI,CAAC;YACH,mEAAmE;YACnE,qEAAqE;YACrE,sEAAsE;YACtE,iEAAiE;YACjE,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACpD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,eAAe,IAAI,IAAI;gBAAE,OAAO;YAElD,+DAA+D;YAC/D,MAAM,QAAQ,GAA2B;gBACvC,CAAC,qBAAU,CAAC,SAAS,CAAC,EAAE,WAAW;gBACnC,CAAC,qBAAU,CAAC,MAAM,CAAC,EAAE,QAAQ;gBAC7B,CAAC,qBAAU,CAAC,SAAS,CAAC,EAAE,WAAW;aACpC,CAAC;YACF,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,CAAC,SAAS;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AC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mDAAmD,GAAG,EAAE,CAAC,CAAC;QAC9E,CAAC;IACH,CAAC;CACF,CAAA;AAhEY,8CAAiB;AAUtB;IADL,IAAA,uBAAO,EAAC,0BAAY,CAAC,mBAAmB,CAAC;;;;4DAsDzC;4BA/DU,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAKwB,4CAAoB;QAC1B,gCAAc;QACd,wCAAkB;GANpC,iBAAiB,CAgE7B"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Validate the cron expression using cron-parser.
3
+ * Throws BadRequestException if the expression is invalid.
4
+ */
5
+ export declare function validateCronExpression(expression: string): void;
6
+ /**
7
+ * Validate triggerConfig structure based on trigger type.
8
+ * - For 'cron': must have a `cron` string, optional `timezone` IANA string.
9
+ * - For 'task_event': must have `event` as COMPLETED/FAILED/CANCELLED, optional `filter` object.
10
+ * - For 'manual': no required config fields.
11
+ * - Unknown triggerType values are rejected.
12
+ */
13
+ export declare function validateTriggerConfig(triggerType: string, triggerConfig: Record<string, unknown>): void;
14
+ //# sourceMappingURL=automation-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation-validation.d.ts","sourceRoot":"","sources":["../../src/automation/automation-validation.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAM/D;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACrC,IAAI,CAoCN"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.validateCronExpression = validateCronExpression;
7
+ exports.validateTriggerConfig = validateTriggerConfig;
8
+ const common_1 = require("@nestjs/common");
9
+ const protocol_1 = require("@overlordai/protocol");
10
+ const cron_parser_1 = __importDefault(require("cron-parser"));
11
+ const VALID_TASK_EVENTS = ['COMPLETED', 'FAILED', 'CANCELLED'];
12
+ const KNOWN_TRIGGER_TYPES = Object.values(protocol_1.AutomationTriggerType);
13
+ /**
14
+ * Validate the cron expression using cron-parser.
15
+ * Throws BadRequestException if the expression is invalid.
16
+ */
17
+ function validateCronExpression(expression) {
18
+ try {
19
+ cron_parser_1.default.parseExpression(expression);
20
+ }
21
+ catch {
22
+ throw new common_1.BadRequestException(`Invalid cron expression: '${expression}'`);
23
+ }
24
+ }
25
+ /**
26
+ * Validate triggerConfig structure based on trigger type.
27
+ * - For 'cron': must have a `cron` string, optional `timezone` IANA string.
28
+ * - For 'task_event': must have `event` as COMPLETED/FAILED/CANCELLED, optional `filter` object.
29
+ * - For 'manual': no required config fields.
30
+ * - Unknown triggerType values are rejected.
31
+ */
32
+ function validateTriggerConfig(triggerType, triggerConfig) {
33
+ if (triggerType === protocol_1.AutomationTriggerType.CRON) {
34
+ const cron = triggerConfig.cron;
35
+ if (typeof cron !== 'string' || cron.trim().length === 0) {
36
+ throw new common_1.BadRequestException('triggerConfig.cron is required for cron trigger type');
37
+ }
38
+ validateCronExpression(cron);
39
+ if (triggerConfig.timezone !== undefined) {
40
+ if (typeof triggerConfig.timezone !== 'string' || !triggerConfig.timezone.trim()) {
41
+ throw new common_1.BadRequestException('triggerConfig.timezone must be a non-empty string');
42
+ }
43
+ try {
44
+ Intl.DateTimeFormat(undefined, { timeZone: triggerConfig.timezone });
45
+ }
46
+ catch {
47
+ throw new common_1.BadRequestException(`triggerConfig.timezone '${triggerConfig.timezone}' is not a valid IANA timezone`);
48
+ }
49
+ }
50
+ }
51
+ else if (triggerType === protocol_1.AutomationTriggerType.TASK_EVENT) {
52
+ const event = triggerConfig.event;
53
+ if (typeof event !== 'string' || !VALID_TASK_EVENTS.includes(event)) {
54
+ throw new common_1.BadRequestException(`triggerConfig.event must be one of: ${VALID_TASK_EVENTS.join(', ')}`);
55
+ }
56
+ if (triggerConfig.filter !== undefined) {
57
+ if (typeof triggerConfig.filter !== 'object' || triggerConfig.filter === null || Array.isArray(triggerConfig.filter)) {
58
+ throw new common_1.BadRequestException('triggerConfig.filter must be an object');
59
+ }
60
+ }
61
+ }
62
+ else if (!KNOWN_TRIGGER_TYPES.includes(triggerType)) {
63
+ throw new common_1.BadRequestException(`Unknown triggerType '${triggerType}'`);
64
+ }
65
+ }
66
+ //# sourceMappingURL=automation-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation-validation.js","sourceRoot":"","sources":["../../src/automation/automation-validation.ts"],"names":[],"mappings":";;;;;AAWA,wDAMC;AASD,sDAuCC;AAjED,2CAAqD;AACrD,mDAA6D;AAC7D,8DAAqC;AAErC,MAAM,iBAAiB,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AACxE,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAqB,CAAa,CAAC;AAE7E;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,UAAkB;IACvD,IAAI,CAAC;QACH,qBAAU,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,4BAAmB,CAAC,6BAA6B,UAAU,GAAG,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,WAAmB,EACnB,aAAsC;IAEtC,IAAI,WAAW,KAAK,gCAAqB,CAAC,IAAI,EAAE,CAAC;QAC/C,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;QAChC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzD,MA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C,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,4BAAmB,CAAC,wBAAwB,WAAW,GAAG,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare class AutomationModule {
2
+ }
3
+ //# sourceMappingURL=automation.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.module.d.ts","sourceRoot":"","sources":["../../src/automation/automation.module.ts"],"names":[],"mappings":"AAQA,qBAWa,gBAAgB;CAAG"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AutomationModule = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ const automation_service_1 = require("./automation.service");
12
+ const automation_scheduler_1 = require("./automation-scheduler");
13
+ const automation_trigger_1 = require("./automation-trigger");
14
+ const automation_executor_1 = require("./automation-executor");
15
+ const automation_template_service_1 = require("./automation-template.service");
16
+ const dispatcher_module_1 = require("../dispatcher/dispatcher.module");
17
+ let AutomationModule = class AutomationModule {
18
+ };
19
+ exports.AutomationModule = AutomationModule;
20
+ exports.AutomationModule = AutomationModule = __decorate([
21
+ (0, common_1.Module)({
22
+ imports: [dispatcher_module_1.DispatcherModule],
23
+ providers: [
24
+ automation_service_1.AutomationService,
25
+ automation_scheduler_1.AutomationScheduler,
26
+ automation_trigger_1.AutomationTrigger,
27
+ automation_executor_1.AutomationExecutor,
28
+ automation_template_service_1.AutomationTemplateService,
29
+ ],
30
+ exports: [automation_service_1.AutomationService, automation_template_service_1.AutomationTemplateService, automation_executor_1.AutomationExecutor],
31
+ })
32
+ ], AutomationModule);
33
+ //# sourceMappingURL=automation.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.module.js","sourceRoot":"","sources":["../../src/automation/automation.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6DAAyD;AACzD,iEAA6D;AAC7D,6DAAyD;AACzD,+DAA2D;AAC3D,+EAA0E;AAC1E,uEAAmE;AAa5D,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,4CAAgB;2BAAhB,gBAAgB;IAX5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,oCAAgB,CAAC;QAC3B,SAAS,EAAE;YACT,sCAAiB;YACjB,0CAAmB;YACnB,sCAAiB;YACjB,wCAAkB;YAClB,uDAAyB;SAC1B;QACD,OAAO,EAAE,CAAC,sCAAiB,EAAE,uDAAyB,EAAE,wCAAkB,CAAC;KAC5E,CAAC;GACW,gBAAgB,CAAG"}
@@ -0,0 +1,22 @@
1
+ import type { Automation, AutomationRun, CreateAutomationRequest, UpdateAutomationRequest, ListAutomationsQuery } from '@overlordai/protocol';
2
+ import { AutomationRepository } from '../database/repositories/automation.repository';
3
+ import { ProjectRepository } from '../database/repositories/project.repository';
4
+ import { AutomationScheduler } from './automation-scheduler';
5
+ import { AutomationExecutor } from './automation-executor';
6
+ export declare class AutomationService {
7
+ private readonly automationRepo;
8
+ private readonly projectRepo;
9
+ private readonly scheduler;
10
+ private readonly executor;
11
+ private readonly logger;
12
+ constructor(automationRepo: AutomationRepository, projectRepo: ProjectRepository, scheduler: AutomationScheduler, executor: AutomationExecutor);
13
+ create(request: CreateAutomationRequest, createdBy: number): Promise<Automation>;
14
+ update(id: number, request: UpdateAutomationRequest): Promise<Automation>;
15
+ delete(id: number): Promise<void>;
16
+ enable(id: number): Promise<Automation>;
17
+ disable(id: number): Promise<Automation>;
18
+ trigger(id: number): Promise<AutomationRun>;
19
+ findById(id: number): Automation | null;
20
+ findByProject(projectKey: string, query?: ListAutomationsQuery): Automation[];
21
+ }
22
+ //# sourceMappingURL=automation.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.service.d.ts","sourceRoot":"","sources":["../../src/automation/automation.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAsB,uBAAuB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAElK,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAM3D,qBACa,iBAAiB;IAI1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAN3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;gBAG1C,cAAc,EAAE,oBAAoB,EACpC,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB;IAGzC,MAAM,CAAC,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA0DhF,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC;IA0FzE,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAoBvC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAcxC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAOjD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAIvC,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,oBAAoB,GAAG,UAAU,EAAE;CAI9E"}
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var AutomationService_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AutomationService = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const protocol_1 = require("@overlordai/protocol");
16
+ const automation_repository_1 = require("../database/repositories/automation.repository");
17
+ const project_repository_1 = require("../database/repositories/project.repository");
18
+ const automation_scheduler_1 = require("./automation-scheduler");
19
+ const automation_executor_1 = require("./automation-executor");
20
+ const automation_validation_1 = require("./automation-validation");
21
+ const VALID_TRIGGER_TYPES = Object.values(protocol_1.AutomationTriggerType);
22
+ const VALID_EXECUTION_MODES = Object.values(protocol_1.AutomationExecutionMode);
23
+ let AutomationService = AutomationService_1 = class AutomationService {
24
+ constructor(automationRepo, projectRepo, scheduler, executor) {
25
+ this.automationRepo = automationRepo;
26
+ this.projectRepo = projectRepo;
27
+ this.scheduler = scheduler;
28
+ this.executor = executor;
29
+ this.logger = new common_1.Logger(AutomationService_1.name);
30
+ }
31
+ async create(request, createdBy) {
32
+ // Validate project exists
33
+ const project = this.projectRepo.findByKey(request.projectKey);
34
+ if (!project) {
35
+ throw new common_1.NotFoundException(`Project '${request.projectKey}' not found`);
36
+ }
37
+ // Validate enum values
38
+ if (!VALID_TRIGGER_TYPES.includes(request.triggerType)) {
39
+ throw new common_1.BadRequestException(`Invalid triggerType '${request.triggerType}'. Must be one of: ${VALID_TRIGGER_TYPES.join(', ')}`);
40
+ }
41
+ if (!VALID_EXECUTION_MODES.includes(request.executionMode)) {
42
+ throw new common_1.BadRequestException(`Invalid executionMode '${request.executionMode}'. Must be one of: ${VALID_EXECUTION_MODES.join(', ')}`);
43
+ }
44
+ // Validate triggerConfig structure based on triggerType
45
+ (0, automation_validation_1.validateTriggerConfig)(request.triggerType, request.triggerConfig);
46
+ // Validate template exists if templateId is provided
47
+ if (request.templateId != null) {
48
+ const template = this.automationRepo.findTemplateById(request.templateId);
49
+ if (!template) {
50
+ throw new common_1.BadRequestException(`Template #${request.templateId} not found`);
51
+ }
52
+ }
53
+ const automation = this.automationRepo.create({
54
+ projectKey: request.projectKey,
55
+ name: request.name,
56
+ description: request.description,
57
+ triggerType: request.triggerType,
58
+ triggerConfig: request.triggerConfig,
59
+ executionMode: request.executionMode,
60
+ taskConfig: (request.taskConfig ?? {}),
61
+ templateId: request.templateId,
62
+ createdBy,
63
+ enabled: true,
64
+ });
65
+ // Register cron job if applicable — rollback on failure
66
+ if (automation.triggerType === protocol_1.AutomationTriggerType.CRON && automation.enabled) {
67
+ const config = automation.triggerConfig;
68
+ try {
69
+ await this.scheduler.registerJob(automation.id, config);
70
+ }
71
+ catch (err) {
72
+ this.automationRepo.delete(automation.id);
73
+ throw err;
74
+ }
75
+ }
76
+ this.logger.log(`Automation #${automation.id} created by developer #${createdBy}`);
77
+ return automation;
78
+ }
79
+ async update(id, request) {
80
+ const existing = this.automationRepo.findById(id);
81
+ if (!existing)
82
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
83
+ // Validate enum values if provided
84
+ if (request.triggerType !== undefined && !VALID_TRIGGER_TYPES.includes(request.triggerType)) {
85
+ throw new common_1.BadRequestException(`Invalid triggerType '${request.triggerType}'. Must be one of: ${VALID_TRIGGER_TYPES.join(', ')}`);
86
+ }
87
+ if (request.executionMode !== undefined && !VALID_EXECUTION_MODES.includes(request.executionMode)) {
88
+ throw new common_1.BadRequestException(`Invalid executionMode '${request.executionMode}'. Must be one of: ${VALID_EXECUTION_MODES.join(', ')}`);
89
+ }
90
+ // Validate triggerConfig if either triggerType or triggerConfig is being updated
91
+ const effectiveTriggerType = request.triggerType ?? existing.triggerType;
92
+ if (request.triggerConfig !== undefined) {
93
+ (0, automation_validation_1.validateTriggerConfig)(effectiveTriggerType, request.triggerConfig);
94
+ }
95
+ else if (request.triggerType !== undefined && request.triggerType !== existing.triggerType) {
96
+ // triggerType changed but triggerConfig not provided — validate existing config against new type
97
+ (0, automation_validation_1.validateTriggerConfig)(request.triggerType, existing.triggerConfig);
98
+ }
99
+ const oldTriggerType = existing.triggerType;
100
+ const newTriggerType = request.triggerType ?? oldTriggerType;
101
+ // Option C: do all scheduling changes FIRST, then persist to DB only on success.
102
+ // This ensures the DB is never left in a state where triggerConfig changed but
103
+ // the cron schedule did not (or vice versa).
104
+ if (existing.enabled) {
105
+ const isLeavingCron = oldTriggerType === protocol_1.AutomationTriggerType.CRON && newTriggerType !== protocol_1.AutomationTriggerType.CRON;
106
+ const isEnteringCron = newTriggerType === protocol_1.AutomationTriggerType.CRON;
107
+ const isUpdatingCron = oldTriggerType === protocol_1.AutomationTriggerType.CRON && newTriggerType === protocol_1.AutomationTriggerType.CRON;
108
+ const cronConfigChanged = isUpdatingCron && (request.triggerConfig !== undefined || request.triggerType !== undefined);
109
+ if (isLeavingCron) {
110
+ // Switching away from cron — remove old job. MUST succeed before DB update,
111
+ // otherwise the old cron keeps firing while DB says it's no longer cron.
112
+ await this.scheduler.removeJob(id);
113
+ }
114
+ else if (cronConfigChanged) {
115
+ // Updating the cron schedule — remove old repeatable FIRST, then register new.
116
+ // BullMQ repeatables are keyed by (name + pattern), so adding a new pattern
117
+ // without removing the old one leaves BOTH schedules active.
118
+ const newConfig = (request.triggerConfig ?? existing.triggerConfig);
119
+ const oldConfig = existing.triggerConfig;
120
+ await this.scheduler.removeJob(id);
121
+ try {
122
+ await this.scheduler.registerJob(id, newConfig);
123
+ }
124
+ catch (err) {
125
+ // New schedule failed — restore the old one so the automation keeps running.
126
+ this.logger.warn(`Automation #${id}: registerJob failed after removeJob, restoring old schedule`);
127
+ try {
128
+ await this.scheduler.registerJob(id, oldConfig);
129
+ }
130
+ catch (restoreErr) {
131
+ // Restoration also failed — the automation has no active cron job.
132
+ // onModuleInit reconciliation will re-register from DB on next restart.
133
+ this.logger.error(`Automation #${id}: failed to restore old cron schedule — will self-heal on restart: ${restoreErr instanceof Error ? restoreErr.message : String(restoreErr)}`);
134
+ }
135
+ throw err;
136
+ }
137
+ }
138
+ else if (isEnteringCron) {
139
+ // Entering cron from another trigger type — just register.
140
+ const newConfig = (request.triggerConfig ?? existing.triggerConfig);
141
+ await this.scheduler.registerJob(id, newConfig);
142
+ }
143
+ }
144
+ const data = {};
145
+ if (request.name !== undefined)
146
+ data.name = request.name;
147
+ if (request.description !== undefined)
148
+ data.description = request.description;
149
+ if (request.triggerType !== undefined)
150
+ data.triggerType = request.triggerType;
151
+ if (request.triggerConfig !== undefined)
152
+ data.triggerConfig = request.triggerConfig;
153
+ if (request.executionMode !== undefined)
154
+ data.executionMode = request.executionMode;
155
+ if (request.taskConfig !== undefined)
156
+ data.taskConfig = request.taskConfig;
157
+ // Clear nextRunAt when switching away from cron trigger type
158
+ if (request.triggerType !== undefined && oldTriggerType === protocol_1.AutomationTriggerType.CRON && newTriggerType !== protocol_1.AutomationTriggerType.CRON) {
159
+ data.nextRunAt = null;
160
+ }
161
+ const updated = this.automationRepo.update(id, data);
162
+ if (!updated)
163
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
164
+ return updated;
165
+ }
166
+ async delete(id) {
167
+ const existing = this.automationRepo.findById(id);
168
+ if (!existing)
169
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
170
+ const activeRun = this.automationRepo.findActiveRun(id);
171
+ if (activeRun) {
172
+ throw new common_1.ConflictException('Cannot delete automation with active runs. Cancel active runs first.');
173
+ }
174
+ if (existing.enabled && existing.triggerType === protocol_1.AutomationTriggerType.CRON) {
175
+ await this.scheduler.removeJob(id);
176
+ }
177
+ this.automationRepo.delete(id);
178
+ this.logger.log(`Automation #${id} deleted`);
179
+ }
180
+ async enable(id) {
181
+ const automation = this.automationRepo.findById(id);
182
+ if (!automation)
183
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
184
+ const updated = this.automationRepo.update(id, { enabled: true });
185
+ if (!updated)
186
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
187
+ if (updated.triggerType === protocol_1.AutomationTriggerType.CRON) {
188
+ const config = updated.triggerConfig;
189
+ try {
190
+ await this.scheduler.registerJob(id, config);
191
+ }
192
+ catch (err) {
193
+ this.automationRepo.update(id, { enabled: false });
194
+ throw err;
195
+ }
196
+ }
197
+ return updated;
198
+ }
199
+ async disable(id) {
200
+ const automation = this.automationRepo.findById(id);
201
+ if (!automation)
202
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
203
+ if (automation.triggerType === protocol_1.AutomationTriggerType.CRON) {
204
+ await this.scheduler.removeJob(id);
205
+ }
206
+ const updated = this.automationRepo.update(id, { enabled: false, nextRunAt: null });
207
+ if (!updated)
208
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
209
+ return updated;
210
+ }
211
+ async trigger(id) {
212
+ const automation = this.automationRepo.findById(id);
213
+ if (!automation)
214
+ throw new common_1.NotFoundException(`Automation #${id} not found`);
215
+ return this.executor.execute(automation, { trigger: 'manual', triggeredAt: new Date().toISOString() });
216
+ }
217
+ findById(id) {
218
+ return this.automationRepo.findById(id);
219
+ }
220
+ findByProject(projectKey, query) {
221
+ return this.automationRepo.findByProject(projectKey, query);
222
+ }
223
+ };
224
+ exports.AutomationService = AutomationService;
225
+ exports.AutomationService = AutomationService = AutomationService_1 = __decorate([
226
+ (0, common_1.Injectable)(),
227
+ __metadata("design:paramtypes", [automation_repository_1.AutomationRepository,
228
+ project_repository_1.ProjectRepository,
229
+ automation_scheduler_1.AutomationScheduler,
230
+ automation_executor_1.AutomationExecutor])
231
+ ], AutomationService);
232
+ //# sourceMappingURL=automation.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"automation.service.js","sourceRoot":"","sources":["../../src/automation/automation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA+G;AAE/G,mDAAsF;AACtF,0FAAsF;AACtF,oFAAgF;AAChF,iEAA6D;AAC7D,+DAA2D;AAC3D,mEAAwF;AAExF,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAqB,CAAa,CAAC;AAC7E,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC,kCAAuB,CAAa,CAAC;AAG1E,IAAM,iBAAiB,yBAAvB,MAAM,iBAAiB;IAG5B,YACmB,cAAoC,EACpC,WAA8B,EAC9B,SAA8B,EAC9B,QAA4B;QAH5B,mBAAc,GAAd,cAAc,CAAsB;QACpC,gBAAW,GAAX,WAAW,CAAmB;QAC9B,cAAS,GAAT,SAAS,CAAqB;QAC9B,aAAQ,GAAR,QAAQ,CAAoB;QAN9B,WAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAO1D,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,OAAgC,EAAE,SAAiB;QAC9D,0BAA0B;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;Q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,EAAU;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,aAAa,CAAC,UAAkB,EAAE,KAA4B;QAC5D,OAAO,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC9D,CAAC;CAEF,CAAA;AAhOY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAKwB,4CAAoB;QACvB,sCAAiB;QACnB,0CAAmB;QACpB,wCAAkB;GAPpC,iBAAiB,CAgO7B"}
@@ -4,6 +4,14 @@ export declare class DatabaseService implements OnModuleInit, BeforeApplicationS
4
4
  private readonly logger;
5
5
  private db;
6
6
  private checkpointInterval;
7
+ /**
8
+ * Initialize the database in the constructor (not onModuleInit) so it's
9
+ * available during dependency injection, before any onModuleInit hooks run.
10
+ * NestJS does not guarantee onModuleInit ordering across modules, so services
11
+ * like SchedulerService and Reconciler that depend on TaskRepository could
12
+ * otherwise call getDb() before the DB is opened.
13
+ */
14
+ constructor();
7
15
  onModuleInit(): void;
8
16
  getDb(): Database.Database;
9
17
  walCheckpoint(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"database.service.d.ts","sourceRoot":"","sources":["../../src/database/database.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EAGzB,YAAY,EACb,MAAM,gBAAgB,CAAC;AAIxB,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAItC,qBACa,eAAgB,YAAW,YAAY,EAAE,yBAAyB;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,EAAE,CAAqB;IAC/B,OAAO,CAAC,kBAAkB,CAAkC;IAE5D,YAAY,IAAI,IAAI;IAkCpB,KAAK,IAAI,QAAQ,CAAC,QAAQ;IAI1B,aAAa,IAAI,IAAI;IAarB,KAAK,IAAI,IAAI;IAOb,yBAAyB,IAAI,IAAI;CAKlC"}
1
+ {"version":3,"file":"database.service.d.ts","sourceRoot":"","sources":["../../src/database/database.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EAGzB,YAAY,EACb,MAAM,gBAAgB,CAAC;AAIxB,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAItC,qBACa,eAAgB,YAAW,YAAY,EAAE,yBAAyB;IAC7E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,EAAE,CAAqB;IAC/B,OAAO,CAAC,kBAAkB,CAAkC;IAE5D;;;;;;OAMG;;IA4BH,YAAY,IAAI,IAAI;IASpB,KAAK,IAAI,QAAQ,CAAC,QAAQ;IAI1B,aAAa,IAAI,IAAI;IAarB,KAAK,IAAI,IAAI;IAOb,yBAAyB,IAAI,IAAI;CAKlC"}
@@ -38,6 +38,9 @@ var __importStar = (this && this.__importStar) || (function () {
38
38
  return result;
39
39
  };
40
40
  })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
41
44
  var __importDefault = (this && this.__importDefault) || function (mod) {
42
45
  return (mod && mod.__esModule) ? mod : { "default": mod };
43
46
  };
@@ -52,11 +55,15 @@ const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
52
55
  const migration_runner_1 = require("./migration-runner");
53
56
  const protocol_1 = require("@overlordai/protocol");
54
57
  let DatabaseService = DatabaseService_1 = class DatabaseService {
58
+ /**
59
+ * Initialize the database in the constructor (not onModuleInit) so it's
60
+ * available during dependency injection, before any onModuleInit hooks run.
61
+ * NestJS does not guarantee onModuleInit ordering across modules, so services
62
+ * like SchedulerService and Reconciler that depend on TaskRepository could
63
+ * otherwise call getDb() before the DB is opened.
64
+ */
55
65
  constructor() {
56
66
  this.logger = new common_1.Logger(DatabaseService_1.name);
57
- }
58
- onModuleInit() {
59
- // Default DB path: ~/.overlord/data/overlord.db (works for both monorepo and global install)
60
67
  const defaultDbPath = path.join(os.homedir(), '.overlord', 'data', 'overlord.db');
61
68
  const dbPath = process.env.DB_PATH || defaultDbPath;
62
69
  const dbDir = path.dirname(dbPath);
@@ -79,7 +86,10 @@ let DatabaseService = DatabaseService_1 = class DatabaseService {
79
86
  const runner = new migration_runner_1.MigrationRunner();
80
87
  runner.run(this.db);
81
88
  this.logger.log('Database migrations complete');
82
- // WAL checkpoint every hour
89
+ }
90
+ onModuleInit() {
91
+ // WAL checkpoint every hour (timer started in onModuleInit to keep
92
+ // constructor side-effect-free for intervals)
83
93
  this.checkpointInterval = setInterval(() => this.walCheckpoint(), 60 * 60 * 1000);
84
94
  }
85
95
  getDb() {
@@ -110,6 +120,7 @@ let DatabaseService = DatabaseService_1 = class DatabaseService {
110
120
  };
111
121
  exports.DatabaseService = DatabaseService;
112
122
  exports.DatabaseService = DatabaseService = DatabaseService_1 = __decorate([
113
- (0, common_1.Injectable)()
123
+ (0, common_1.Injectable)(),
124
+ __metadata("design:paramtypes", [])
114
125
  ], DatabaseService);
115
126
  //# sourceMappingURL=database.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"database.service.js","sourceRoot":"","sources":["../../src/database/database.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAKwB;AACxB,4CAA8B;AAC9B,4CAA8B;AAC9B,gDAAkC;AAClC,oEAAsC;AACtC,yDAAqD;AAErD,mDAAuD;AAEhD,IAAM,eAAe,uBAArB,MAAM,eAAe;IAArB;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAmE7D,CAAC;IA/DC,YAAY;QACV,6FAA6F;QAC7F,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;QAClF,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IA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E,GAAG,IAAI,CACf,CAAC;IACJ,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI;YAAE,OAAO;QAC3B,IAAI,CAAC;YACH,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;YAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACf,uBAAuB,EACvB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAC/C,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,yBAAyB;QACvB,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACvC,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;CACF,CAAA;AApEY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;GACA,eAAe,CAoE3B"}
1
+ {"version":3,"file":"database.service.js","sourceRoot":"","sources":["../../src/database/database.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAKwB;AACxB,4CAA8B;AAC9B,4CAA8B;AAC9B,gDAAkC;AAClC,oEAAsC;AACtC,yDAAqD;AAErD,mDAAuD;AAEhD,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