openloops 0.3.4 → 0.4.0

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 (240) hide show
  1. package/README.md +9 -8
  2. package/dist/clients/llm/llm-client.js +6 -5
  3. package/dist/clients/llm/llm-client.mjs +6 -5
  4. package/dist/clients/llm/llm-types.d.ts +3 -0
  5. package/dist/clients/llm/llm-types.js +15 -0
  6. package/dist/clients/llm/llm-types.mjs +7 -0
  7. package/dist/db/index.d.ts +1 -0
  8. package/dist/db/index.js +3 -1
  9. package/dist/db/index.mjs +1 -0
  10. package/dist/db/indexes/automation-runs.d.ts +2 -0
  11. package/dist/db/indexes/automation-runs.js +33 -0
  12. package/dist/db/indexes/automation-runs.mjs +10 -0
  13. package/dist/db/indexes/automations.d.ts +2 -0
  14. package/dist/db/indexes/{agentic-jobs.js → automations.js} +6 -6
  15. package/dist/db/indexes/{agentic-jobs.mjs → automations.mjs} +2 -2
  16. package/dist/db/indexes/index.js +6 -4
  17. package/dist/db/indexes/index.mjs +6 -4
  18. package/dist/db/indexes/revoked-tokens.d.ts +2 -0
  19. package/dist/db/indexes/{agentic-job-runs.js → revoked-tokens.js} +8 -9
  20. package/dist/db/indexes/revoked-tokens.mjs +8 -0
  21. package/dist/db/migrations/automations.d.ts +12 -0
  22. package/dist/db/migrations/automations.js +70 -0
  23. package/dist/db/migrations/automations.mjs +47 -0
  24. package/dist/harness/agent-loop.d.ts +2 -0
  25. package/dist/harness/agent.d.ts +1 -0
  26. package/dist/harness/agent.js +8 -0
  27. package/dist/harness/agent.mjs +8 -0
  28. package/dist/loops/agi/loop.js +2 -1
  29. package/dist/loops/agi/loop.mjs +2 -1
  30. package/dist/loops/agi/skills/reasoning-engine.js +3 -2
  31. package/dist/loops/agi/skills/reasoning-engine.mjs +3 -2
  32. package/dist/loops/shared/skills/fast-responder.js +2 -2
  33. package/dist/loops/shared/skills/fast-responder.mjs +2 -2
  34. package/dist/services/authentication/entities/index.d.ts +1 -0
  35. package/dist/services/authentication/entities/index.js +22 -0
  36. package/dist/services/authentication/entities/index.mjs +1 -0
  37. package/dist/services/authentication/entities/revoked-token.entity.d.ts +17 -0
  38. package/dist/services/authentication/entities/revoked-token.entity.js +67 -0
  39. package/dist/services/authentication/entities/revoked-token.entity.mjs +44 -0
  40. package/dist/services/authentication/index.d.ts +1 -0
  41. package/dist/services/authentication/index.js +3 -1
  42. package/dist/services/authentication/index.mjs +1 -0
  43. package/dist/services/authentication/module.d.ts +4 -0
  44. package/dist/services/authentication/module.js +16 -2
  45. package/dist/services/authentication/module.mjs +13 -1
  46. package/dist/services/authentication/repositories/index.d.ts +1 -0
  47. package/dist/services/{agentic-jobs → authentication}/repositories/index.js +2 -4
  48. package/dist/services/authentication/repositories/index.mjs +1 -0
  49. package/dist/services/authentication/repositories/revoked-token.repository.d.ts +7 -0
  50. package/dist/services/authentication/repositories/revoked-token.repository.js +55 -0
  51. package/dist/services/authentication/repositories/revoked-token.repository.mjs +26 -0
  52. package/dist/services/authentication/use-cases/is-token-revoked.use-case.d.ts +15 -0
  53. package/dist/services/authentication/use-cases/is-token-revoked.use-case.js +55 -0
  54. package/dist/services/authentication/use-cases/is-token-revoked.use-case.mjs +26 -0
  55. package/dist/services/authentication/use-cases/revoke-token.use-case.d.ts +14 -0
  56. package/dist/services/authentication/use-cases/revoke-token.use-case.js +65 -0
  57. package/dist/services/authentication/use-cases/revoke-token.use-case.mjs +36 -0
  58. package/dist/services/automations/entities/automation-run.entity.d.ts +46 -0
  59. package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.js → automations/entities/automation-run.entity.js} +22 -14
  60. package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.mjs → automations/entities/automation-run.entity.mjs} +18 -10
  61. package/dist/services/automations/entities/automation.entity.d.ts +38 -0
  62. package/dist/services/{agentic-jobs/entities/agentic-job.entity.js → automations/entities/automation.entity.js} +17 -17
  63. package/dist/services/{agentic-jobs/entities/agentic-job.entity.mjs → automations/entities/automation.entity.mjs} +13 -13
  64. package/dist/services/automations/entities/index.d.ts +4 -0
  65. package/dist/services/{agentic-jobs → automations}/entities/index.js +6 -4
  66. package/dist/services/automations/entities/index.mjs +4 -0
  67. package/dist/services/automations/entities/trigger.d.ts +11 -0
  68. package/dist/services/automations/entities/trigger.js +49 -0
  69. package/dist/services/automations/entities/trigger.mjs +26 -0
  70. package/dist/services/automations/index.d.ts +5 -0
  71. package/dist/services/{agentic-jobs → automations}/index.js +9 -7
  72. package/dist/services/automations/index.mjs +5 -0
  73. package/dist/services/automations/module.d.ts +41 -0
  74. package/dist/services/automations/module.js +167 -0
  75. package/dist/services/automations/module.mjs +125 -0
  76. package/dist/services/automations/repositories/automation-run.repository.d.ts +14 -0
  77. package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.js → automations/repositories/automation-run.repository.js} +23 -11
  78. package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.mjs → automations/repositories/automation-run.repository.mjs} +19 -7
  79. package/dist/services/automations/repositories/automation.repository.d.ts +27 -0
  80. package/dist/services/{agentic-jobs/repositories/agentic-job.repository.js → automations/repositories/automation.repository.js} +17 -17
  81. package/dist/services/{agentic-jobs/repositories/agentic-job.repository.mjs → automations/repositories/automation.repository.mjs} +13 -13
  82. package/dist/services/automations/repositories/index.d.ts +2 -0
  83. package/dist/services/automations/repositories/index.js +24 -0
  84. package/dist/services/automations/repositories/index.mjs +2 -0
  85. package/dist/services/automations/runner/automation-runner.d.ts +49 -0
  86. package/dist/services/{agentic-jobs/runner/agentic-job-runner.js → automations/runner/automation-runner.js} +55 -45
  87. package/dist/services/{agentic-jobs/runner/agentic-job-runner.mjs → automations/runner/automation-runner.mjs} +50 -40
  88. package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.d.ts → automations/use-cases/attach-automation-run-chat.use-case.d.ts} +6 -6
  89. package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.js → automations/use-cases/attach-automation-run-chat.use-case.js} +14 -14
  90. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.mjs +29 -0
  91. package/dist/services/automations/use-cases/claim-due-automations.use-case.d.ts +28 -0
  92. package/dist/services/{agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.js → automations/use-cases/claim-due-automations.use-case.js} +32 -43
  93. package/dist/services/automations/use-cases/claim-due-automations.use-case.mjs +70 -0
  94. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.d.ts +27 -0
  95. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.js +106 -0
  96. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.mjs +77 -0
  97. package/dist/services/automations/use-cases/create-automation.use-case.d.ts +14 -0
  98. package/dist/services/{agentic-jobs/use-cases/create-agentic-job.use-case.js → automations/use-cases/create-automation.use-case.js} +24 -25
  99. package/dist/services/automations/use-cases/create-automation.use-case.mjs +43 -0
  100. package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.d.ts → automations/use-cases/delete-automation.use-case.d.ts} +6 -6
  101. package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.js → automations/use-cases/delete-automation.use-case.js} +17 -17
  102. package/dist/services/automations/use-cases/delete-automation.use-case.mjs +36 -0
  103. package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.d.ts → automations/use-cases/finish-automation-run.use-case.d.ts} +8 -8
  104. package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.js → automations/use-cases/finish-automation-run.use-case.js} +20 -20
  105. package/dist/services/automations/use-cases/finish-automation-run.use-case.mjs +46 -0
  106. package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.d.ts → automations/use-cases/get-automation-by-id.use-case.d.ts} +6 -6
  107. package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.js → automations/use-cases/get-automation-by-id.use-case.js} +13 -13
  108. package/dist/services/automations/use-cases/get-automation-by-id.use-case.mjs +26 -0
  109. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.d.ts +17 -0
  110. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.js +59 -0
  111. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.mjs +30 -0
  112. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.d.ts → automations/use-cases/list-automation-runs-by-automation.use-case.d.ts} +7 -7
  113. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.js → automations/use-cases/list-automation-runs-by-automation.use-case.js} +15 -15
  114. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.mjs +28 -0
  115. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.d.ts → automations/use-cases/list-automation-runs-by-user.use-case.d.ts} +7 -7
  116. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.js → automations/use-cases/list-automation-runs-by-user.use-case.js} +14 -14
  117. package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.mjs → automations/use-cases/list-automation-runs-by-user.use-case.mjs} +11 -11
  118. package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.d.ts → automations/use-cases/list-automations-by-user.use-case.d.ts} +6 -6
  119. package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.js → automations/use-cases/list-automations-by-user.use-case.js} +14 -14
  120. package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.mjs → automations/use-cases/list-automations-by-user.use-case.mjs} +11 -11
  121. package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.d.ts → automations/use-cases/preview-automation-runs.use-case.d.ts} +1 -1
  122. package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.js → automations/use-cases/preview-automation-runs.use-case.js} +8 -8
  123. package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.mjs → automations/use-cases/preview-automation-runs.use-case.mjs} +4 -4
  124. package/dist/services/automations/use-cases/receive-automation-event.use-case.d.ts +23 -0
  125. package/dist/services/automations/use-cases/receive-automation-event.use-case.js +97 -0
  126. package/dist/services/automations/use-cases/receive-automation-event.use-case.mjs +68 -0
  127. package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.d.ts → automations/use-cases/renew-automation-lease.use-case.d.ts} +5 -5
  128. package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.js → automations/use-cases/renew-automation-lease.use-case.js} +15 -15
  129. package/dist/services/automations/use-cases/renew-automation-lease.use-case.mjs +29 -0
  130. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.d.ts +16 -0
  131. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.js +65 -0
  132. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.mjs +36 -0
  133. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.d.ts +14 -0
  134. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.js +63 -0
  135. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.mjs +34 -0
  136. package/dist/services/automations/use-cases/start-automation-run.use-case.d.ts +21 -0
  137. package/dist/services/{agentic-jobs/use-cases/start-agentic-job-run.use-case.js → automations/use-cases/start-automation-run.use-case.js} +24 -24
  138. package/dist/services/automations/use-cases/start-automation-run.use-case.mjs +38 -0
  139. package/dist/services/automations/use-cases/sync-automation-run.use-case.d.ts +20 -0
  140. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.js → automations/use-cases/sync-automation-run.use-case.js} +23 -23
  141. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.mjs → automations/use-cases/sync-automation-run.use-case.mjs} +21 -21
  142. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.d.ts → automations/use-cases/sync-automation-runs.use-case.d.ts} +5 -5
  143. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.js → automations/use-cases/sync-automation-runs.use-case.js} +16 -16
  144. package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.mjs → automations/use-cases/sync-automation-runs.use-case.mjs} +13 -13
  145. package/dist/services/automations/use-cases/update-automation.use-case.d.ts +15 -0
  146. package/dist/services/{agentic-jobs/use-cases/update-agentic-job.use-case.js → automations/use-cases/update-automation.use-case.js} +27 -27
  147. package/dist/services/automations/use-cases/update-automation.use-case.mjs +54 -0
  148. package/dist/services/automations/utils/automation-event-error.d.ts +6 -0
  149. package/dist/services/automations/utils/automation-event-error.js +37 -0
  150. package/dist/services/automations/utils/automation-event-error.mjs +14 -0
  151. package/dist/services/automations/utils/automation-fields.d.ts +14 -0
  152. package/dist/services/{agentic-jobs/utils/job-fields.js → automations/utils/automation-fields.js} +8 -10
  153. package/dist/services/{agentic-jobs/utils/job-fields.mjs → automations/utils/automation-fields.mjs} +4 -6
  154. package/dist/services/automations/utils/event-message.d.ts +1 -0
  155. package/dist/services/automations/utils/event-message.js +37 -0
  156. package/dist/services/automations/utils/event-message.mjs +14 -0
  157. package/dist/services/automations/utils/event-token.d.ts +18 -0
  158. package/dist/services/automations/utils/event-token.js +78 -0
  159. package/dist/services/automations/utils/event-token.mjs +43 -0
  160. package/dist/services/automations/utils/open-run.d.ts +14 -0
  161. package/dist/services/{agentic-jobs → automations}/utils/open-run.js +10 -8
  162. package/dist/services/automations/utils/open-run.mjs +26 -0
  163. package/dist/services/automations/utils/previous-run.d.ts +4 -0
  164. package/dist/services/automations/utils/previous-run.js +42 -0
  165. package/dist/services/automations/utils/previous-run.mjs +19 -0
  166. package/dist/services/{agentic-jobs → automations}/utils/settings.d.ts +1 -0
  167. package/dist/services/{agentic-jobs → automations}/utils/settings.js +6 -2
  168. package/dist/services/automations/utils/settings.mjs +13 -0
  169. package/dist/services/chats/entities/chat-settings.entity.d.ts +5 -1
  170. package/dist/services/chats/entities/chat-settings.entity.js +10 -3
  171. package/dist/services/chats/entities/chat-settings.entity.mjs +10 -3
  172. package/dist/skills/skill.d.ts +2 -1
  173. package/dist/skills/skill.js +4 -3
  174. package/dist/skills/skill.mjs +4 -3
  175. package/docs/README.md +1 -1
  176. package/docs/agent.md +3 -2
  177. package/docs/authentication.md +18 -1
  178. package/docs/automations.md +341 -0
  179. package/docs/chats.md +1 -1
  180. package/docs/configuration.md +8 -7
  181. package/docs/harness.md +1 -1
  182. package/docs/integration-guide.md +22 -18
  183. package/docs/llms.txt +1 -1
  184. package/docs/mcp-servers.md +1 -1
  185. package/docs/skills.md +1 -1
  186. package/examples/{agentic-jobs/create-agentic-job.ts → automations/create-automation.ts} +10 -7
  187. package/examples/automations/create-event-automation.ts +24 -0
  188. package/examples/{agentic-jobs/list-agentic-job-runs.ts → automations/list-automation-runs.ts} +8 -8
  189. package/examples/automations/list-automations.ts +25 -0
  190. package/examples/{agentic-jobs/preview-agentic-job-runs.ts → automations/preview-automation-runs.ts} +2 -2
  191. package/examples/automations/receive-automation-event.ts +26 -0
  192. package/examples/automations/revoke-automation-event-token.ts +25 -0
  193. package/examples/{agentic-jobs/run-agentic-job-now.ts → automations/run-automation-now.ts} +3 -3
  194. package/examples/{agentic-jobs/run-agentic-job-worker.ts → automations/run-automation-worker.ts} +6 -6
  195. package/examples/{agentic-jobs/update-agentic-job.ts → automations/update-automation.ts} +10 -10
  196. package/package.json +14 -13
  197. package/dist/db/indexes/agentic-job-runs.d.ts +0 -2
  198. package/dist/db/indexes/agentic-job-runs.mjs +0 -9
  199. package/dist/db/indexes/agentic-jobs.d.ts +0 -2
  200. package/dist/services/agentic-jobs/entities/agentic-job-run.entity.d.ts +0 -42
  201. package/dist/services/agentic-jobs/entities/agentic-job.entity.d.ts +0 -39
  202. package/dist/services/agentic-jobs/entities/index.d.ts +0 -3
  203. package/dist/services/agentic-jobs/entities/index.mjs +0 -3
  204. package/dist/services/agentic-jobs/index.d.ts +0 -4
  205. package/dist/services/agentic-jobs/index.mjs +0 -4
  206. package/dist/services/agentic-jobs/module.d.ts +0 -31
  207. package/dist/services/agentic-jobs/module.js +0 -132
  208. package/dist/services/agentic-jobs/module.mjs +0 -95
  209. package/dist/services/agentic-jobs/repositories/agentic-job-run.repository.d.ts +0 -11
  210. package/dist/services/agentic-jobs/repositories/agentic-job.repository.d.ts +0 -27
  211. package/dist/services/agentic-jobs/repositories/index.d.ts +0 -2
  212. package/dist/services/agentic-jobs/repositories/index.mjs +0 -2
  213. package/dist/services/agentic-jobs/runner/agentic-job-runner.d.ts +0 -48
  214. package/dist/services/agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.mjs +0 -29
  215. package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.d.ts +0 -29
  216. package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.mjs +0 -81
  217. package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.d.ts +0 -14
  218. package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.mjs +0 -44
  219. package/dist/services/agentic-jobs/use-cases/delete-agentic-job.use-case.mjs +0 -36
  220. package/dist/services/agentic-jobs/use-cases/finish-agentic-job-run.use-case.mjs +0 -46
  221. package/dist/services/agentic-jobs/use-cases/get-agentic-job-by-id.use-case.mjs +0 -26
  222. package/dist/services/agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.mjs +0 -28
  223. package/dist/services/agentic-jobs/use-cases/renew-agentic-job-lease.use-case.mjs +0 -29
  224. package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.d.ts +0 -21
  225. package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.mjs +0 -38
  226. package/dist/services/agentic-jobs/use-cases/sync-agentic-job-run.use-case.d.ts +0 -20
  227. package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.d.ts +0 -15
  228. package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.mjs +0 -54
  229. package/dist/services/agentic-jobs/utils/job-fields.d.ts +0 -14
  230. package/dist/services/agentic-jobs/utils/open-run.d.ts +0 -12
  231. package/dist/services/agentic-jobs/utils/open-run.mjs +0 -24
  232. package/dist/services/agentic-jobs/utils/settings.mjs +0 -10
  233. package/docs/agentic-jobs.md +0 -217
  234. package/examples/agentic-jobs/list-agentic-jobs.ts +0 -25
  235. /package/dist/services/{agentic-jobs → automations}/entities/recurrence.d.ts +0 -0
  236. /package/dist/services/{agentic-jobs → automations}/entities/recurrence.js +0 -0
  237. /package/dist/services/{agentic-jobs → automations}/entities/recurrence.mjs +0 -0
  238. /package/dist/services/{agentic-jobs → automations}/utils/next-run.d.ts +0 -0
  239. /package/dist/services/{agentic-jobs → automations}/utils/next-run.js +0 -0
  240. /package/dist/services/{agentic-jobs → automations}/utils/next-run.mjs +0 -0
@@ -23,8 +23,8 @@ The package has no controllers: the authorization of every endpoint is the respo
23
23
 
24
24
  The use cases trust the `currentUser` you pass and the ids you give them.
25
25
 
26
- - Functions that list by user (`listChatsByUser`, `listMcpServersByUser`, `listAgenticJobsByUser`, `listAgenticJobRunsByUser`) only return records of that user.
27
- - Functions that take an **id** (`getChatById`, `updateChat`, `deleteChat`, `getMcpServerById`, `updateMcpServer`, `deleteMcpServer`, `decideMcpServerTrust`, `getAgenticJobById`, `updateAgenticJob`, `deleteAgenticJob`, `listAgenticJobRunsByJob`, `runner.runNow`) **do not check who owns the record**.
26
+ - Functions that list by user (`listChatsByUser`, `listMcpServersByUser`, `listAutomationsByUser`, `listAutomationRunsByUser`) only return records of that user.
27
+ - Functions that take an **id** (`getChatById`, `updateChat`, `deleteChat`, `getMcpServerById`, `updateMcpServer`, `deleteMcpServer`, `decideMcpServerTrust`, `getAutomationById`, `updateAutomation`, `deleteAutomation`, `listAutomationRunsByAutomation`, `runner.runNow`) **do not check who owns the record**. The use cases that issue, revoke or rotate the tokens of an automation do check that the user is the owner or an admin.
28
28
 
29
29
  So, before calling any of the second kind, load the record and check that `ownerId` is the user of the request. Do it in one place, a middleware or a helper, and never pass an id from a request straight to a use case.
30
30
 
@@ -42,9 +42,11 @@ Also note that `getChatById` returns `{}` in `data` when the chat does not exist
42
42
  | Approve or block an MCP server from a screen | `decideMcpServerTrust` |
43
43
  | Usage of a chat or of an answer | `getLLMUsageByChat`, `getLLMUsageByMessage` |
44
44
  | Usage statistics of a user | `getLLMUsageStats` |
45
- | Create the schedule of an agent | `createAgenticJob`, `updateAgenticJob`, `listAgenticJobsByUser`, `getAgenticJobById`, `deleteAgenticJob`, `previewAgenticJobRuns` |
46
- | History of scheduled runs | `listAgenticJobRunsByJob`, `listAgenticJobRunsByUser` |
47
- | "Run now" | `runner.runNow({ jobId })` |
45
+ | Create the schedule or the event trigger of an agent | `createAutomation`, `updateAutomation`, `listAutomationsByUser`, `getAutomationById`, `deleteAutomation`, `previewAutomationRuns` |
46
+ | Receive an event from another system | `receiveAutomationEvent`, public endpoint, authenticated only by the token of the automation |
47
+ | Tokens of an event automation | `issueAutomationEventToken`, `revokeAutomationEventToken`, `rotateAutomationEventTokens` |
48
+ | History of runs | `listAutomationRunsByAutomation`, `listAutomationRunsByUser` |
49
+ | "Run now" | `runner.runNow({ automationId })` |
48
50
  | Sign in, users | `login`, `createUser`, `getUserById`, `updateUser`, `deleteUser` |
49
51
 
50
52
  ## Running the agent for a message
@@ -95,28 +97,29 @@ Your users register their own servers, and every server must be approved before
95
97
 
96
98
  **Do not send `headers` or `history` of an MCP server to the client as they are.** `headers` hold credentials and `history` holds the full manifests. Mask the header values and send only what the screen needs, such as the name, `trust`, `status`, `lastError` and the hash of the latest manifest.
97
99
 
98
- ## Scheduled agents (agentic jobs)
100
+ ## Automations (scheduled and by event)
99
101
 
100
- Two parts, as described in [agentic jobs](agentic-jobs.md):
102
+ Three parts, as described in [automations](automations.md):
101
103
 
102
- 1. Endpoints that create and manage jobs and read their runs, from the table above.
103
- 2. A worker process that you start once, with the options of the agent your jobs should use:
104
+ 1. Endpoints that create and manage automations and read their runs, from the table above.
105
+ 2. If you use event triggers, one public endpoint that calls `receiveAutomationEvent` with the token of the `Authorization` header. It answers 202 without running the agent, and it is the only call that does not need a `CurrentUser`.
106
+ 3. A worker process that you start once, with the options of the agent your automations should use:
104
107
 
105
108
  ```typescript
106
- import { createAgenticJobRunner } from 'openloops/agentic-jobs'
109
+ import { createAutomationRunner } from 'openloops/automations'
107
110
 
108
- const runner = createAgenticJobRunner({
111
+ const runner = createAutomationRunner({
109
112
  agent: { tools: yourTools, guards: yourGuards },
110
- onRunFinished: async ({ job, run }) => { /* notify the owner */ },
113
+ onRunFinished: async ({ automation, run }) => { /* notify the owner */ },
111
114
  })
112
115
 
113
116
  runner.start()
114
117
  ```
115
118
 
116
- - It is safe to start the worker in several instances: a due job is taken by one of them.
119
+ - It is safe to start the worker in several instances: a due automation or a queued event is taken by one of them.
117
120
  - Stop it with `runner.stop()` when the process receives `SIGTERM`.
118
- - Create the indexes with `ensureIndexes` from `openloops/db`, see [configuration](configuration.md#indexes). The ones of the jobs are listed in [agentic jobs](agentic-jobs.md#indexes).
119
- - A job that needs the user (a destructive tool, an unapproved server, a question) pauses its run, and the user answers in the chat of that run. Show those runs, which you can list with `listAgenticJobRunsByUser({ status: 'paused' })`.
121
+ - Create the indexes with `ensureIndexes` from `openloops/db`, see [configuration](configuration.md#indexes). The ones of the automations are listed in [automations](automations.md#indexes).
122
+ - An automation that needs the user (a destructive tool, an unapproved server, a question) pauses its run, and the user answers in the chat of that run. Show those runs, which you can list with `listAutomationRunsByUser({ status: 'paused' })`.
120
123
 
121
124
  ## Security checklist
122
125
 
@@ -126,14 +129,15 @@ runner.start()
126
129
  - Mark your own destructive tools with `destructive: true`. The agent asks for confirmation before running them. Do not rely on a tool being treated as destructive by default, because it is not.
127
130
  - Use `strictMode: true` in the agent when the tools of an MCP server must be reviewed by the user on every change.
128
131
  - Keep API keys and the secrets of [configuration](configuration.md) out of the code. Values can be stored encrypted with the `ENC:` prefix.
129
- - Set limits on how many scheduled jobs and how often they run in your own layer, since `openloops` does not limit them yet.
132
+ - Set limits on how many automations and how often they run in your own layer, since `openloops` does not limit them yet.
130
133
 
131
134
  ## Common mistakes
132
135
 
133
136
  - Sharing one `Agent` between concurrent requests.
134
137
  - Waiting for `agent.run` inside a request with a short timeout.
135
- - Passing `chatId`, `jobId` or `mcpServerId` from the client without checking the owner.
138
+ - Passing `chatId`, `automationId` or `mcpServerId` from the client without checking the owner.
136
139
  - Treating `error` as an exception that is thrown. It is returned.
137
140
  - Forgetting that a run in `awaiting_user_confirmation` is waiting for the next message of the user, and that the next message is the answer.
138
- - Starting the scheduled jobs worker without creating its indexes.
141
+ - Starting the automations worker without creating its indexes.
142
+ - Exposing the endpoint of events without logging the rejected ones, or sending the token in the URL instead of the `Authorization` header.
139
143
  - Running the package on a real database without calling `ensureIndexes`.
package/docs/llms.txt CHANGED
@@ -26,7 +26,7 @@ Start with the integration guide, then read only the pages you need. All pages a
26
26
  ## Connect and schedule
27
27
 
28
28
  - [MCP servers](mcp-servers.md): registering servers, the trust flow, approving and blocking, internal servers of your own
29
- - [Agentic jobs](agentic-jobs.md): scheduled agent runs, recurrence, history and the runner
29
+ - [Automations](automations.md): agent runs by schedule or by event, tokens, queue, history and the runner
30
30
 
31
31
  ## Users and cost
32
32
 
@@ -179,7 +179,7 @@ await agent.run({
179
179
  - If a server of the user has the same name as an internal one, the one of the user is ignored for that run, so nobody can impersonate an internal server.
180
180
  - The tools are named `<name>__<tool>`, like any other MCP tool.
181
181
 
182
- In an agentic job there is no session of the user, so there is no token of theirs. See [agentic jobs](agentic-jobs.md#internal-mcp-servers-in-a-job).
182
+ In an automation there is no session of the user, so there is no token of theirs. See [automations](automations.md#internal-mcp-servers-in-a-automation).
183
183
 
184
184
  ## Tools of MCP servers
185
185
 
package/docs/skills.md CHANGED
@@ -44,7 +44,7 @@ export const myResponder = new Skill<ResponseSchema>({
44
44
  | `version` | no | Recorded in the metadata of every call. Bump it whenever the prompt changes. |
45
45
  | `description` | no | What the skill is for. |
46
46
  | `temperature` | no | Sampling temperature. Defaults to `0.7`. |
47
- | `thinking` | no | How much the model thinks before it answers: `off`, `low`, `medium` or `high`. Thinking costs time and output tokens, so a skill that only classifies or answers briefly can set it low. When it is left out the provider default applies, which is high for the Claude models. The bundled `fast_responder` uses `low`. |
47
+ | `thinking` | no | How much the model thinks before it answers: `off`, `low`, `medium` or `high`. Thinking costs time and output tokens, so a skill that only classifies or answers briefly can set it low. When it is left out it is `low`. Set `high` only for a skill that needs to reason at length, because it is slower and costs more. The bundled `fast_responder` uses `low` and the `reasoning_engine` uses `medium`. |
48
48
  | `systemRole` | no | Default `true`: the instructions travel as a system message. |
49
49
  | `mode` | no | How the model is called when tools are given. Defaults to `plain_chat`. |
50
50
 
@@ -1,24 +1,27 @@
1
1
  import { Logger } from 'openloops/common'
2
2
  import { CurrentUser } from 'openloops/base'
3
- import { createAgenticJob } from 'openloops/agentic-jobs'
3
+ import { createAutomation } from 'openloops/automations'
4
4
 
5
- async function createJob () {
5
+ async function createSchedule () {
6
6
  const logger = new Logger()
7
7
  const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
8
8
 
9
- const result = await createAgenticJob({
9
+ const result = await createAutomation({
10
10
  payload: {
11
11
  name: 'Morning report',
12
12
  instructions: 'Summarize the news about the bitcoin price and keep the summary short',
13
- recurrence: { type: 'weekly', days: [1, 2, 3, 4, 5], time: '08:00' },
14
- timezone: 'America/Lima',
13
+ trigger: {
14
+ type: 'schedule',
15
+ recurrence: { type: 'weekly', days: [1, 2, 3, 4, 5], time: '08:00' },
16
+ timezone: 'America/Lima',
17
+ },
15
18
  modelProvider: 'anthropic',
16
19
  modelName: 'claude-haiku-5-5',
17
20
  },
18
21
  currentUser,
19
22
  })
20
23
 
21
- logger.info({ id: result.data._id, nextRunAt: result.data.nextRunAt }, '[Demo] Created agentic job')
24
+ logger.info({ id: result.data._id, nextRunAt: result.data.nextRunAt }, '[Demo] Created automation')
22
25
  }
23
26
 
24
- createJob()
27
+ createSchedule()
@@ -0,0 +1,24 @@
1
+ import { Logger } from 'openloops/common'
2
+ import { CurrentUser } from 'openloops/base'
3
+ import { createAutomation, issueAutomationEventToken } from 'openloops/automations'
4
+
5
+ async function createEventAutomation () {
6
+ const logger = new Logger()
7
+ const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
8
+
9
+ const created = await createAutomation({
10
+ payload: {
11
+ name: 'Cost anomaly analysis',
12
+ instructions: 'Find the cause of the cost alert in AWS and send a short summary to the channel #costs',
13
+ trigger: { type: 'event' },
14
+ },
15
+ currentUser,
16
+ })
17
+
18
+ const id = String(created.data._id)
19
+ const issued = await issueAutomationEventToken({ id, expiresIn: '90d', currentUser })
20
+
21
+ logger.info({ id, token: issued.data.token, expiresAt: issued.data.expiresAt }, '[Demo] Created automation, send events to it with this token')
22
+ }
23
+
24
+ createEventAutomation()
@@ -1,28 +1,28 @@
1
1
  import { Logger } from 'openloops/common'
2
2
  import { CurrentUser } from 'openloops/base'
3
- import { listAgenticJobRunsByJob, listAgenticJobRunsByUser } from 'openloops/agentic-jobs'
3
+ import { listAutomationRunsByAutomation, listAutomationRunsByUser } from 'openloops/automations'
4
4
 
5
- async function listRunsOfAJob () {
5
+ async function listRunsOfAnAutomation () {
6
6
  const logger = new Logger()
7
7
 
8
- const result = await listAgenticJobRunsByJob({
9
- jobId: '6ad0c9a6d3ea4199c9b7ba10',
8
+ const result = await listAutomationRunsByAutomation({
9
+ automationId: '6ad0c9a6d3ea4199c9b7ba10',
10
10
  options: { page: 1, limit: 20 },
11
11
  })
12
12
 
13
- logger.info(result.data.map(run => ({ status: run.status, startedAt: run.startedAt, chatId: run.chatId, error: run.error })), '[Demo] Runs of the job')
13
+ logger.info(result.data.map(run => ({ status: run.status, startedAt: run.startedAt, chatId: run.chatId, error: run.error })), '[Demo] Runs of the automation')
14
14
  }
15
15
 
16
16
  async function listRunsThatNeedAttention () {
17
17
  const logger = new Logger()
18
18
  const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
19
19
 
20
- const paused = await listAgenticJobRunsByUser({ status: 'paused', currentUser })
21
- const failed = await listAgenticJobRunsByUser({ status: 'failed', currentUser })
20
+ const paused = await listAutomationRunsByUser({ status: 'paused', currentUser })
21
+ const failed = await listAutomationRunsByUser({ status: 'failed', currentUser })
22
22
 
23
23
  logger.info({ paused: paused.data.length, failed: failed.data.length }, '[Demo] Runs that need attention')
24
24
  }
25
25
 
26
- listRunsOfAJob()
26
+ listRunsOfAnAutomation()
27
27
 
28
28
  // listRunsThatNeedAttention()
@@ -0,0 +1,25 @@
1
+ import { Logger } from 'openloops/common'
2
+ import { CurrentUser } from 'openloops/base'
3
+ import { listAutomationsByUser } from 'openloops/automations'
4
+
5
+ async function listAutomations () {
6
+ const logger = new Logger()
7
+ const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
8
+
9
+ const result = await listAutomationsByUser({
10
+ options: {
11
+ page: 1,
12
+ limit: 20,
13
+ },
14
+ currentUser,
15
+ })
16
+
17
+ logger.info(result.data.map(automation => ({
18
+ name: automation.name,
19
+ enabled: automation.enabled,
20
+ nextRunAt: automation.nextRunAt,
21
+ lastRunStatus: automation.lastRunStatus,
22
+ })), '[Demo] Automations')
23
+ }
24
+
25
+ listAutomations()
@@ -1,10 +1,10 @@
1
1
  import { Logger } from 'openloops/common'
2
- import { previewAgenticJobRuns } from 'openloops/agentic-jobs'
2
+ import { previewAutomationRuns } from 'openloops/automations'
3
3
 
4
4
  async function previewRuns () {
5
5
  const logger = new Logger()
6
6
 
7
- const result = await previewAgenticJobRuns({
7
+ const result = await previewAutomationRuns({
8
8
  recurrence: { type: 'monthly', day: 'last', time: '18:00' },
9
9
  timezone: 'America/Lima',
10
10
  count: 5,
@@ -0,0 +1,26 @@
1
+ import { Logger } from 'openloops/common'
2
+ import { AutomationEventError, receiveAutomationEvent } from 'openloops/automations'
3
+
4
+ async function receive (automationId: string, authorization: string, body: unknown, idempotencyKey?: string) {
5
+ const logger = new Logger()
6
+
7
+ try {
8
+ const { data } = await receiveAutomationEvent({
9
+ automationId,
10
+ token: authorization.replace(/^Bearer /, ''),
11
+ payload: body,
12
+ idempotencyKey,
13
+ })
14
+
15
+ logger.info({ status: data.status, runId: data.run._id }, '[Demo] Event received, answer 202')
16
+ } catch (error) {
17
+ if (error instanceof AutomationEventError) {
18
+ logger.warn({ reason: error.reason, statusCode: error.statusCode }, '[Demo] Event rejected')
19
+ return
20
+ }
21
+
22
+ throw error
23
+ }
24
+ }
25
+
26
+ receive('6ad0c9a6d3ea4199c9b7ba10', 'Bearer eyJ...', { alarm: 'CostAnomaly', amount: 1200 }, 'alarm-2026-10-30-1')
@@ -0,0 +1,25 @@
1
+ import { Logger } from 'openloops/common'
2
+ import { CurrentUser } from 'openloops/base'
3
+ import { revokeAutomationEventToken, rotateAutomationEventTokens } from 'openloops/automations'
4
+
5
+ async function revokeLeakedToken () {
6
+ const logger = new Logger()
7
+ const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
8
+
9
+ const result = await revokeAutomationEventToken({ id: '6ad0c9a6d3ea4199c9b7ba10', token: 'eyJ...', currentUser })
10
+
11
+ logger.info({ jti: result.data.jti }, '[Demo] That token no longer works, the others still do')
12
+ }
13
+
14
+ async function rotateAll () {
15
+ const logger = new Logger()
16
+ const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
17
+
18
+ const result = await rotateAutomationEventTokens({ id: '6ad0c9a6d3ea4199c9b7ba10', currentUser })
19
+
20
+ logger.info({ trigger: result.data.trigger }, '[Demo] Every token issued before stopped working, issue a new one')
21
+ }
22
+
23
+ revokeLeakedToken()
24
+
25
+ // rotateAll()
@@ -1,15 +1,15 @@
1
1
  import { Logger } from 'openloops/common'
2
- import { createAgenticJobRunner } from 'openloops/agentic-jobs'
2
+ import { createAutomationRunner } from 'openloops/automations'
3
3
  import { webSearchTool } from 'openloops/tools'
4
4
 
5
5
  async function runNow () {
6
6
  const logger = new Logger()
7
7
 
8
- const runner = createAgenticJobRunner({
8
+ const runner = createAutomationRunner({
9
9
  agent: { tools: [webSearchTool] },
10
10
  })
11
11
 
12
- const { run } = await runner.runNow({ jobId: '6ad0c9a6d3ea4199c9b7ba10' })
12
+ const { run } = await runner.runNow({ automationId: '6ad0c9a6d3ea4199c9b7ba10' })
13
13
 
14
14
  logger.info({ runId: run._id, status: run.status }, '[Demo] The run started in the background')
15
15
 
@@ -1,5 +1,5 @@
1
1
  import { Logger } from 'openloops/common'
2
- import { createAgenticJobRunner } from 'openloops/agentic-jobs'
2
+ import { createAutomationRunner } from 'openloops/automations'
3
3
  import { webSearchTool } from 'openloops/tools'
4
4
  import { inputGuards } from 'openloops/guardrails'
5
5
 
@@ -8,16 +8,16 @@ async function notifyOwner (message: string) {
8
8
  logger.info({ message }, '[Notification Service] Sending notification to the owner...')
9
9
  }
10
10
 
11
- const runner = createAgenticJobRunner({
11
+ const runner = createAutomationRunner({
12
12
  agent: {
13
13
  tools: [webSearchTool],
14
14
  guards: [inputGuards.blockCard],
15
15
  maxIterations: 30,
16
16
  },
17
- onRunFinished: async ({ job, run }) => {
18
- if (run.status === 'failed') await notifyOwner(`The job "${job.name}" failed: ${run.error?.message}`)
19
- if (run.status === 'paused') await notifyOwner(`The job "${job.name}" is waiting for you`)
20
- if (run.status === 'skipped') await notifyOwner(`The job "${job.name}" was skipped: ${run.skipReason}`)
17
+ onRunFinished: async ({ automation, run }) => {
18
+ if (run.status === 'failed') await notifyOwner(`The automation "${automation.name}" failed: ${run.error?.message}`)
19
+ if (run.status === 'paused') await notifyOwner(`The automation "${automation.name}" is waiting for you`)
20
+ if (run.status === 'skipped') await notifyOwner(`The automation "${automation.name}" was skipped: ${run.skipReason}`)
21
21
  },
22
22
  })
23
23
 
@@ -1,36 +1,36 @@
1
1
  import { Logger } from 'openloops/common'
2
2
  import { CurrentUser } from 'openloops/base'
3
- import { updateAgenticJob } from 'openloops/agentic-jobs'
3
+ import { updateAutomation } from 'openloops/automations'
4
4
 
5
- async function pauseJob () {
5
+ async function pause () {
6
6
  const logger = new Logger()
7
7
  const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
8
8
 
9
- const result = await updateAgenticJob({
9
+ const result = await updateAutomation({
10
10
  id: '6ad0c9a6d3ea4199c9b7ba10',
11
11
  payload: { enabled: false },
12
12
  currentUser,
13
13
  })
14
14
 
15
- logger.info({ enabled: result.data.enabled }, '[Demo] The job is off')
15
+ logger.info({ enabled: result.data.enabled }, '[Demo] The automation is off')
16
16
  }
17
17
 
18
- async function resumeJob () {
18
+ async function resume () {
19
19
  const logger = new Logger()
20
20
  const currentUser = await CurrentUser.asyncFromDB('6ab56894eb20887d1ef7942c')
21
21
 
22
- const result = await updateAgenticJob({
22
+ const result = await updateAutomation({
23
23
  id: '6ad0c9a6d3ea4199c9b7ba10',
24
24
  payload: {
25
25
  enabled: true,
26
- recurrence: { type: 'daily', time: '07:30' },
26
+ trigger: { recurrence: { type: 'daily', time: '07:30' } },
27
27
  },
28
28
  currentUser,
29
29
  })
30
30
 
31
- logger.info({ nextRunAt: result.data.nextRunAt }, '[Demo] The job is on again')
31
+ logger.info({ nextRunAt: result.data.nextRunAt }, '[Demo] The automation is on again')
32
32
  }
33
33
 
34
- pauseJob()
34
+ pause()
35
35
 
36
- // resumeJob()
36
+ // resume()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openloops",
3
- "version": "0.3.4",
4
- "description": "Open source harness for AI agents: a TypeScript runtime with persistence, tools, MCP trust, approvals and autonomous jobs, where the loop is pluggable",
3
+ "version": "0.4.0",
4
+ "description": "Open source harness for AI agents: a TypeScript runtime with persistence, tools, MCP trust, approvals and autonomous automations, where the loop is pluggable",
5
5
  "author": {
6
6
  "name": "Jose Barcos",
7
7
  "email": "jose@openloops.xyz",
@@ -63,9 +63,9 @@
63
63
  "types": "./dist/services/mcp-servers/index.d.ts",
64
64
  "default": "./dist/services/mcp-servers/index.js"
65
65
  },
66
- "./agentic-jobs": {
67
- "types": "./dist/services/agentic-jobs/index.d.ts",
68
- "default": "./dist/services/agentic-jobs/index.js"
66
+ "./automations": {
67
+ "types": "./dist/services/automations/index.d.ts",
68
+ "default": "./dist/services/automations/index.js"
69
69
  },
70
70
  "./users": {
71
71
  "types": "./dist/services/users/index.d.ts",
@@ -90,6 +90,7 @@
90
90
  "test": "jest",
91
91
  "test:watch": "jest --watch",
92
92
  "test:coverage": "jest --coverage",
93
+ "migrate:automations": "ts-node scripts/migrate-automations.ts",
93
94
  "eval": "ts-node --project evals/tsconfig.json evals/run.ts",
94
95
  "eval:models": "ts-node --project evals/tsconfig.json evals/run.ts models",
95
96
  "eval:skills": "ts-node --project evals/tsconfig.json evals/run.ts skills",
@@ -100,17 +101,17 @@
100
101
  "eval:list": "ts-node --project evals/tsconfig.json evals/run.ts list"
101
102
  },
102
103
  "dependencies": {
103
- "@earendil-works/pi-ai": "^1.3.0",
104
- "@modelcontextprotocol/sdk": "^1.32.1",
105
- "@sentry/node": "^11.8.0",
104
+ "@earendil-works/pi-ai": "^1.4.0",
105
+ "@modelcontextprotocol/sdk": "^1.32.2",
106
+ "@sentry/node": "^11.10.0",
106
107
  "bcryptjs": "^3.0.3",
107
- "croner": "^10.0.1",
108
+ "croner": "^11.0.0",
108
109
  "cryptr": "^6.4.0",
109
- "dotenv": "^18.0.8",
110
+ "dotenv": "^18.0.9",
110
111
  "iso-data": "^0.1.0",
111
112
  "jsonwebtoken": "^9.0.3",
112
113
  "langfuse": "^3.39.2",
113
- "mongodb": "^7.7.0",
114
+ "mongodb": "^7.8.0",
114
115
  "pino": "^10.4.0",
115
116
  "pino-pretty": "^13.2.0",
116
117
  "reflect-metadata": "^0.2.2",
@@ -119,11 +120,11 @@
119
120
  },
120
121
  "devDependencies": {
121
122
  "@types/jest": "^30.0.0",
122
- "@types/node": "^26.6.5",
123
+ "@types/node": "^26.6.6",
123
124
  "@types/sanitize-html": "^2.16.2",
124
125
  "jest": "^30.5.2",
125
126
  "ts-jest": "^29.4.15",
126
- "tsc-alias": "^1.9.7",
127
+ "tsc-alias": "^1.9.9",
127
128
  "tsconfig-paths": "^4.2.0",
128
129
  "tsup": "^9.0.0",
129
130
  "typescript": "^6.0.3"
@@ -1,2 +0,0 @@
1
- import { IndexDescription } from 'mongodb';
2
- export declare const agenticJobRuns: IndexDescription[];
@@ -1,9 +0,0 @@
1
- import "../../chunk-CF3WOMB3.mjs";
2
- const agenticJobRuns = [
3
- { key: { jobId: 1, createdAt: -1 } },
4
- { key: { ownerId: 1, createdAt: -1 } },
5
- { key: { status: 1, createdAt: 1 } }
6
- ];
7
- export {
8
- agenticJobRuns
9
- };
@@ -1,2 +0,0 @@
1
- import { IndexDescription } from 'mongodb';
2
- export declare const agenticJobs: IndexDescription[];
@@ -1,42 +0,0 @@
1
- import { ObjectId } from 'mongodb';
2
- import { BaseEntity, BaseEntityProps } from '../../../common/base/base.entity.js';
3
- export type AgenticJobRunStatus = 'running' | 'completed' | 'paused' | 'failed' | 'skipped';
4
- export type AgenticJobRunTrigger = 'schedule' | 'manual';
5
- export interface AgenticJobRunError {
6
- code?: string;
7
- message: string;
8
- }
9
- export interface AgenticJobRunProps extends BaseEntityProps {
10
- jobId?: string | ObjectId;
11
- chatId?: string | ObjectId;
12
- trigger?: AgenticJobRunTrigger;
13
- status?: AgenticJobRunStatus;
14
- scheduledFor?: string | Date;
15
- startedAt?: string | Date;
16
- finishedAt?: string | Date;
17
- instructions?: string;
18
- modelProvider?: string;
19
- modelName?: string;
20
- error?: AgenticJobRunError;
21
- skipReason?: string;
22
- workerId?: string;
23
- }
24
- export declare class AgenticJobRun extends BaseEntity {
25
- private readonly props;
26
- jobId?: ObjectId | undefined;
27
- chatId?: ObjectId | undefined;
28
- trigger?: AgenticJobRunTrigger | undefined;
29
- status?: AgenticJobRunStatus | undefined;
30
- scheduledFor?: Date | undefined;
31
- startedAt?: Date | undefined;
32
- finishedAt?: Date | undefined;
33
- instructions?: string | undefined;
34
- modelProvider?: string | undefined;
35
- modelName?: string | undefined;
36
- error?: AgenticJobRunError | undefined;
37
- skipReason?: string | undefined;
38
- workerId?: string | undefined;
39
- static fromJSON(props: AgenticJobRunProps): AgenticJobRun;
40
- constructor(props: AgenticJobRunProps, jobId?: ObjectId | undefined, chatId?: ObjectId | undefined, trigger?: AgenticJobRunTrigger | undefined, status?: AgenticJobRunStatus | undefined, scheduledFor?: Date | undefined, startedAt?: Date | undefined, finishedAt?: Date | undefined, instructions?: string | undefined, modelProvider?: string | undefined, modelName?: string | undefined, error?: AgenticJobRunError | undefined, skipReason?: string | undefined, workerId?: string | undefined);
41
- toJSON(): AgenticJobRunProps;
42
- }
@@ -1,39 +0,0 @@
1
- import { ObjectId } from 'mongodb';
2
- import { BaseEntity, BaseEntityProps } from '../../../common/base/base.entity.js';
3
- import { Recurrence } from './recurrence';
4
- import type { AgenticJobRunStatus } from './agentic-job-run.entity';
5
- export interface AgenticJobProps extends BaseEntityProps {
6
- name?: string;
7
- instructions?: string;
8
- enabled?: boolean;
9
- recurrence?: Recurrence;
10
- timezone?: string;
11
- modelProvider?: string;
12
- modelName?: string;
13
- nextRunAt?: string | Date | null;
14
- lastRunAt?: string | Date | null;
15
- lastRunStatus?: AgenticJobRunStatus;
16
- lockedBy?: string | null;
17
- lockedUntil?: string | Date | null;
18
- activeRunId?: string | ObjectId | null;
19
- }
20
- export declare class AgenticJob extends BaseEntity {
21
- private readonly props;
22
- name?: string | undefined;
23
- instructions?: string | undefined;
24
- enabled?: boolean | undefined;
25
- recurrence?: Recurrence | undefined;
26
- timezone?: string | undefined;
27
- modelProvider?: string | undefined;
28
- modelName?: string | undefined;
29
- nextRunAt?: Date | undefined;
30
- lastRunAt?: Date | undefined;
31
- lastRunStatus?: AgenticJobRunStatus | undefined;
32
- lockedBy?: string | undefined;
33
- lockedUntil?: Date | undefined;
34
- activeRunId?: ObjectId | undefined;
35
- static fromJSON(props: AgenticJobProps): AgenticJob;
36
- constructor(props: AgenticJobProps, name?: string | undefined, instructions?: string | undefined, enabled?: boolean | undefined, recurrence?: Recurrence | undefined, timezone?: string | undefined, modelProvider?: string | undefined, modelName?: string | undefined, nextRunAt?: Date | undefined, lastRunAt?: Date | undefined, lastRunStatus?: AgenticJobRunStatus | undefined, lockedBy?: string | undefined, lockedUntil?: Date | undefined, activeRunId?: ObjectId | undefined);
37
- toJSON(): AgenticJobProps;
38
- scheduleNextRun(from?: Date): this;
39
- }
@@ -1,3 +0,0 @@
1
- export * from './recurrence';
2
- export * from './agentic-job.entity';
3
- export * from './agentic-job-run.entity';
@@ -1,3 +0,0 @@
1
- export * from "./recurrence";
2
- export * from "./agentic-job.entity";
3
- export * from "./agentic-job-run.entity";
@@ -1,4 +0,0 @@
1
- export * from './module';
2
- export * from './entities';
3
- export * from './repositories';
4
- export * from './runner/agentic-job-runner';
@@ -1,4 +0,0 @@
1
- export * from "./module";
2
- export * from "./entities";
3
- export * from "./repositories";
4
- export * from "./runner/agentic-job-runner";
@@ -1,31 +0,0 @@
1
- import 'reflect-metadata';
2
- import { Params as CParams, Output as COutput } from './use-cases/create-agentic-job.use-case';
3
- import { Params as UParams, Output as UOutput } from './use-cases/update-agentic-job.use-case';
4
- import { Params as GParams, Output as GOutput } from './use-cases/get-agentic-job-by-id.use-case';
5
- import { Params as LParams, Output as LOutput } from './use-cases/list-agentic-jobs-by-user.use-case';
6
- import { Params as DParams, Output as DOutput } from './use-cases/delete-agentic-job.use-case';
7
- import { Params as PParams, Output as POutput } from './use-cases/preview-agentic-job-runs.use-case';
8
- import { Params as RJParams, Output as RJOutput } from './use-cases/list-agentic-job-runs-by-job.use-case';
9
- import { Params as RUParams, Output as RUOutput } from './use-cases/list-agentic-job-runs-by-user.use-case';
10
- import { Params as CDParams, Output as CDOutput } from './use-cases/claim-due-agentic-jobs.use-case';
11
- import { Params as SRParams, Output as SROutput } from './use-cases/start-agentic-job-run.use-case';
12
- import { Params as FRParams, Output as FROutput } from './use-cases/finish-agentic-job-run.use-case';
13
- import { Params as SYParams, Output as SYOutput } from './use-cases/sync-agentic-job-run.use-case';
14
- import { Params as SYSParams, Output as SYSOutput } from './use-cases/sync-agentic-job-runs.use-case';
15
- import { Params as ACParams, Output as ACOutput } from './use-cases/attach-agentic-job-run-chat.use-case';
16
- import { Params as RLParams, Output as RLOutput } from './use-cases/renew-agentic-job-lease.use-case';
17
- export declare function createAgenticJob(props: CParams): Promise<COutput>;
18
- export declare function updateAgenticJob(props: UParams): Promise<UOutput>;
19
- export declare function getAgenticJobById(props: GParams): Promise<GOutput>;
20
- export declare function listAgenticJobsByUser(props: LParams): Promise<LOutput>;
21
- export declare function deleteAgenticJob(props: DParams): Promise<DOutput>;
22
- export declare function previewAgenticJobRuns(props: PParams): Promise<POutput>;
23
- export declare function listAgenticJobRunsByJob(props: RJParams): Promise<RJOutput>;
24
- export declare function listAgenticJobRunsByUser(props: RUParams): Promise<RUOutput>;
25
- export declare function claimDueAgenticJobs(props: CDParams): Promise<CDOutput>;
26
- export declare function startAgenticJobRun(props: SRParams): Promise<SROutput>;
27
- export declare function finishAgenticJobRun(props: FRParams): Promise<FROutput>;
28
- export declare function syncAgenticJobRun(props: SYParams): Promise<SYOutput>;
29
- export declare function syncAgenticJobRuns(props?: SYSParams): Promise<SYSOutput>;
30
- export declare function attachAgenticJobRunChat(props: ACParams): Promise<ACOutput>;
31
- export declare function renewAgenticJobLease(props: RLParams): Promise<RLOutput>;