openloops 0.10.3 → 0.11.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 (612) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +11 -17
  3. package/dist/clients/llm/llm-client.d.ts +2 -2
  4. package/dist/clients/llm/llm-client.js +17 -18
  5. package/dist/clients/llm/llm-client.mjs +12 -13
  6. package/dist/clients/llm/llm-types.d.ts +2 -2
  7. package/dist/clients/llm/model-resolution.js +4 -5
  8. package/dist/clients/llm/model-resolution.mjs +1 -2
  9. package/dist/clients/serper/serper-client.js +3 -4
  10. package/dist/clients/serper/serper-client.mjs +1 -2
  11. package/dist/clients/slack/slack-client.js +2 -2
  12. package/dist/clients/slack/slack-client.mjs +1 -1
  13. package/dist/common/utils/number-setting.js +2 -2
  14. package/dist/common/utils/number-setting.mjs +1 -1
  15. package/dist/db/indexes/index.js +1 -5
  16. package/dist/db/indexes/index.mjs +1 -5
  17. package/dist/guardrails/guard.d.ts +4 -4
  18. package/dist/harness/actor-profile.d.ts +2 -0
  19. package/dist/{common/error/error-reporter.js → harness/actor-profile.js} +10 -13
  20. package/dist/harness/actor-profile.mjs +9 -0
  21. package/dist/harness/agent-loop.d.ts +4 -5
  22. package/dist/harness/agent.d.ts +7 -7
  23. package/dist/harness/agent.js +46 -46
  24. package/dist/harness/agent.mjs +44 -44
  25. package/dist/harness/default-model.d.ts +20 -0
  26. package/dist/harness/default-model.js +72 -0
  27. package/dist/harness/default-model.mjs +46 -0
  28. package/dist/harness/index.d.ts +2 -0
  29. package/dist/harness/index.js +8 -1
  30. package/dist/harness/index.mjs +5 -1
  31. package/dist/harness/tool-pipeline.d.ts +1 -1
  32. package/dist/harness/tool-pipeline.js +3 -3
  33. package/dist/harness/tool-pipeline.mjs +1 -1
  34. package/dist/harness/usage-limit.d.ts +2 -2
  35. package/dist/harness/usage-limit.js +5 -3
  36. package/dist/harness/usage-limit.mjs +5 -3
  37. package/dist/harness/workspace.d.ts +3 -3
  38. package/dist/harness/workspace.js +8 -8
  39. package/dist/harness/workspace.mjs +8 -8
  40. package/dist/services/automations/entities/automation-run.entity.d.ts +1 -1
  41. package/dist/services/automations/entities/automation-run.entity.js +4 -4
  42. package/dist/services/automations/entities/automation-run.entity.mjs +1 -1
  43. package/dist/services/automations/entities/automation.entity.d.ts +1 -1
  44. package/dist/services/automations/entities/automation.entity.js +3 -3
  45. package/dist/services/automations/entities/automation.entity.mjs +1 -1
  46. package/dist/services/automations/repositories/automation-run.repository.d.ts +1 -1
  47. package/dist/services/automations/repositories/automation-run.repository.js +5 -6
  48. package/dist/services/automations/repositories/automation-run.repository.mjs +2 -3
  49. package/dist/services/automations/repositories/automation.repository.d.ts +1 -1
  50. package/dist/services/automations/repositories/automation.repository.js +5 -6
  51. package/dist/services/automations/repositories/automation.repository.mjs +2 -3
  52. package/dist/services/automations/runner/automation-runner.d.ts +4 -4
  53. package/dist/services/automations/runner/automation-runner.js +16 -15
  54. package/dist/services/automations/runner/automation-runner.mjs +11 -10
  55. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.d.ts +1 -1
  56. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.js +2 -2
  57. package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.mjs +1 -1
  58. package/dist/services/automations/use-cases/claim-due-automations.use-case.d.ts +1 -1
  59. package/dist/services/automations/use-cases/claim-due-automations.use-case.js +3 -4
  60. package/dist/services/automations/use-cases/claim-due-automations.use-case.mjs +1 -2
  61. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.d.ts +1 -1
  62. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.js +2 -2
  63. package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.mjs +1 -1
  64. package/dist/services/automations/use-cases/create-automation.use-case.d.ts +1 -1
  65. package/dist/services/automations/use-cases/create-automation.use-case.js +8 -8
  66. package/dist/services/automations/use-cases/create-automation.use-case.mjs +5 -5
  67. package/dist/services/automations/use-cases/delete-automation.use-case.d.ts +1 -1
  68. package/dist/services/automations/use-cases/delete-automation.use-case.js +8 -8
  69. package/dist/services/automations/use-cases/delete-automation.use-case.mjs +5 -5
  70. package/dist/services/automations/use-cases/finish-automation-run.use-case.d.ts +1 -1
  71. package/dist/services/automations/use-cases/finish-automation-run.use-case.js +2 -2
  72. package/dist/services/automations/use-cases/finish-automation-run.use-case.mjs +1 -1
  73. package/dist/services/automations/use-cases/get-automation-by-id.use-case.d.ts +1 -1
  74. package/dist/services/automations/use-cases/get-automation-by-id.use-case.js +7 -7
  75. package/dist/services/automations/use-cases/get-automation-by-id.use-case.mjs +4 -4
  76. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.d.ts +1 -1
  77. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.js +7 -7
  78. package/dist/services/automations/use-cases/issue-automation-event-token.use-case.mjs +4 -4
  79. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.d.ts +2 -2
  80. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.js +7 -7
  81. package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.mjs +4 -4
  82. package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.d.ts +2 -2
  83. package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.js +9 -9
  84. package/dist/services/automations/use-cases/list-automation-runs-by-user.use-case.mjs +6 -6
  85. package/dist/services/automations/use-cases/list-automations-by-user.use-case.d.ts +2 -2
  86. package/dist/services/automations/use-cases/list-automations-by-user.use-case.js +9 -9
  87. package/dist/services/automations/use-cases/list-automations-by-user.use-case.mjs +6 -6
  88. package/dist/services/automations/use-cases/preview-automation-runs.use-case.d.ts +1 -1
  89. package/dist/services/automations/use-cases/preview-automation-runs.use-case.js +2 -2
  90. package/dist/services/automations/use-cases/preview-automation-runs.use-case.mjs +1 -1
  91. package/dist/services/automations/use-cases/receive-automation-event.use-case.d.ts +1 -1
  92. package/dist/services/automations/use-cases/receive-automation-event.use-case.js +3 -3
  93. package/dist/services/automations/use-cases/receive-automation-event.use-case.mjs +2 -2
  94. package/dist/services/automations/use-cases/renew-automation-lease.use-case.d.ts +1 -1
  95. package/dist/services/automations/use-cases/renew-automation-lease.use-case.js +2 -2
  96. package/dist/services/automations/use-cases/renew-automation-lease.use-case.mjs +1 -1
  97. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.d.ts +1 -1
  98. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.js +10 -11
  99. package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.mjs +7 -8
  100. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.d.ts +1 -1
  101. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.js +7 -7
  102. package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.mjs +4 -4
  103. package/dist/services/automations/use-cases/start-automation-run.use-case.d.ts +1 -1
  104. package/dist/services/automations/use-cases/start-automation-run.use-case.js +5 -5
  105. package/dist/services/automations/use-cases/start-automation-run.use-case.mjs +4 -4
  106. package/dist/services/automations/use-cases/sync-automation-run.use-case.d.ts +1 -1
  107. package/dist/services/automations/use-cases/sync-automation-run.use-case.js +2 -2
  108. package/dist/services/automations/use-cases/sync-automation-run.use-case.mjs +1 -1
  109. package/dist/services/automations/use-cases/sync-automation-runs.use-case.d.ts +1 -1
  110. package/dist/services/automations/use-cases/sync-automation-runs.use-case.js +2 -2
  111. package/dist/services/automations/use-cases/sync-automation-runs.use-case.mjs +1 -1
  112. package/dist/services/automations/use-cases/update-automation.use-case.d.ts +1 -1
  113. package/dist/services/automations/use-cases/update-automation.use-case.js +8 -9
  114. package/dist/services/automations/use-cases/update-automation.use-case.mjs +4 -5
  115. package/dist/services/automations/utils/event-token.d.ts +1 -0
  116. package/dist/services/automations/utils/event-token.js +9 -6
  117. package/dist/services/automations/utils/event-token.mjs +3 -1
  118. package/dist/services/automations/utils/open-run.d.ts +1 -1
  119. package/dist/services/automations/utils/runner-scope.d.ts +1 -1
  120. package/dist/services/automations/utils/runner-scope.js +3 -3
  121. package/dist/services/automations/utils/runner-scope.mjs +1 -1
  122. package/dist/services/chats/entities/chat-message.entity.d.ts +1 -1
  123. package/dist/services/chats/entities/chat-message.entity.js +3 -3
  124. package/dist/services/chats/entities/chat-message.entity.mjs +1 -1
  125. package/dist/services/chats/entities/chat.entity.d.ts +1 -1
  126. package/dist/services/chats/entities/chat.entity.js +4 -4
  127. package/dist/services/chats/entities/chat.entity.mjs +1 -1
  128. package/dist/services/chats/repositories/chat.repository.d.ts +1 -1
  129. package/dist/services/chats/repositories/chat.repository.js +5 -6
  130. package/dist/services/chats/repositories/chat.repository.mjs +2 -3
  131. package/dist/services/chats/use-cases/create-chat.use-case.d.ts +1 -1
  132. package/dist/services/chats/use-cases/create-chat.use-case.js +7 -7
  133. package/dist/services/chats/use-cases/create-chat.use-case.mjs +4 -4
  134. package/dist/services/chats/use-cases/delete-chat.use-case.d.ts +1 -1
  135. package/dist/services/chats/use-cases/delete-chat.use-case.js +8 -8
  136. package/dist/services/chats/use-cases/delete-chat.use-case.mjs +5 -5
  137. package/dist/services/chats/use-cases/get-chat-by-id.use-case.d.ts +2 -2
  138. package/dist/services/chats/use-cases/get-chat-by-id.use-case.js +7 -7
  139. package/dist/services/chats/use-cases/get-chat-by-id.use-case.mjs +4 -4
  140. package/dist/services/chats/use-cases/interrupt-execution.use-case.d.ts +1 -1
  141. package/dist/services/chats/use-cases/interrupt-execution.use-case.js +7 -7
  142. package/dist/services/chats/use-cases/interrupt-execution.use-case.mjs +4 -4
  143. package/dist/services/chats/use-cases/list-chats-by-props.use-case.d.ts +2 -2
  144. package/dist/services/chats/use-cases/list-chats-by-props.use-case.js +7 -7
  145. package/dist/services/chats/use-cases/list-chats-by-props.use-case.mjs +4 -4
  146. package/dist/services/chats/use-cases/list-chats-by-user.use-case.d.ts +2 -2
  147. package/dist/services/chats/use-cases/list-chats-by-user.use-case.js +8 -8
  148. package/dist/services/chats/use-cases/list-chats-by-user.use-case.mjs +5 -5
  149. package/dist/services/chats/use-cases/update-chat.use-case.d.ts +1 -1
  150. package/dist/services/chats/use-cases/update-chat.use-case.js +7 -7
  151. package/dist/services/chats/use-cases/update-chat.use-case.mjs +4 -4
  152. package/dist/services/llmcalls/entities/llmcall.entity.d.ts +1 -1
  153. package/dist/services/llmcalls/entities/llmcall.entity.js +4 -4
  154. package/dist/services/llmcalls/entities/llmcall.entity.mjs +1 -1
  155. package/dist/services/llmcalls/repositories/llmcall.repository.d.ts +1 -1
  156. package/dist/services/llmcalls/repositories/llmcall.repository.js +5 -6
  157. package/dist/services/llmcalls/repositories/llmcall.repository.mjs +2 -3
  158. package/dist/services/llmcalls/use-cases/create-llmcall.use-case.d.ts +1 -1
  159. package/dist/services/llmcalls/use-cases/create-llmcall.use-case.js +7 -7
  160. package/dist/services/llmcalls/use-cases/create-llmcall.use-case.mjs +4 -4
  161. package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.d.ts +1 -1
  162. package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.js +8 -8
  163. package/dist/services/llmcalls/use-cases/delete-llmcall.use-case.mjs +5 -5
  164. package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.d.ts +1 -1
  165. package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.js +9 -9
  166. package/dist/services/llmcalls/use-cases/get-llm-usage-by-chat.use-case.mjs +6 -6
  167. package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.d.ts +1 -1
  168. package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.js +9 -9
  169. package/dist/services/llmcalls/use-cases/get-llm-usage-by-message.use-case.mjs +6 -6
  170. package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.d.ts +2 -2
  171. package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.js +12 -10
  172. package/dist/services/llmcalls/use-cases/get-llm-usage-stats.use-case.mjs +9 -7
  173. package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.d.ts +1 -1
  174. package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.js +7 -7
  175. package/dist/services/llmcalls/use-cases/get-llmcall-by-id.use-case.mjs +4 -4
  176. package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.d.ts +2 -2
  177. package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.js +5 -5
  178. package/dist/services/llmcalls/use-cases/list-llmcalls-by-props.use-case.mjs +4 -4
  179. package/dist/services/llmcalls/use-cases/update-llmcall.use-case.d.ts +1 -1
  180. package/dist/services/llmcalls/use-cases/update-llmcall.use-case.js +7 -7
  181. package/dist/services/llmcalls/use-cases/update-llmcall.use-case.mjs +4 -4
  182. package/dist/services/mcp-servers/admin/admin-params.d.ts +5 -0
  183. package/dist/{common/logger/index.js → services/mcp-servers/admin/admin-params.js} +2 -8
  184. package/dist/services/mcp-servers/admin/admin-params.mjs +0 -0
  185. package/dist/services/mcp-servers/admin/use-cases/create-internal-mcp.use-case.d.ts +3 -2
  186. package/dist/services/mcp-servers/admin/use-cases/create-internal-mcp.use-case.js +7 -7
  187. package/dist/services/mcp-servers/admin/use-cases/create-internal-mcp.use-case.mjs +4 -4
  188. package/dist/services/mcp-servers/admin/use-cases/delete-internal-mcp.use-case.d.ts +3 -2
  189. package/dist/services/mcp-servers/admin/use-cases/delete-internal-mcp.use-case.js +7 -7
  190. package/dist/services/mcp-servers/admin/use-cases/delete-internal-mcp.use-case.mjs +4 -4
  191. package/dist/services/mcp-servers/admin/use-cases/get-internal-mcp-by-id.use-case.d.ts +3 -2
  192. package/dist/services/mcp-servers/admin/use-cases/get-internal-mcp-by-id.use-case.js +7 -7
  193. package/dist/services/mcp-servers/admin/use-cases/get-internal-mcp-by-id.use-case.mjs +4 -4
  194. package/dist/services/mcp-servers/admin/use-cases/list-internal-mcps.use-case.d.ts +4 -3
  195. package/dist/services/mcp-servers/admin/use-cases/list-internal-mcps.use-case.js +7 -7
  196. package/dist/services/mcp-servers/admin/use-cases/list-internal-mcps.use-case.mjs +4 -4
  197. package/dist/services/mcp-servers/admin/use-cases/update-internal-mcp.use-case.d.ts +3 -2
  198. package/dist/services/mcp-servers/admin/use-cases/update-internal-mcp.use-case.js +8 -9
  199. package/dist/services/mcp-servers/admin/use-cases/update-internal-mcp.use-case.mjs +4 -5
  200. package/dist/services/mcp-servers/entities/mcpserver.entity.d.ts +1 -1
  201. package/dist/services/mcp-servers/entities/mcpserver.entity.js +2 -2
  202. package/dist/services/mcp-servers/entities/mcpserver.entity.mjs +1 -1
  203. package/dist/services/mcp-servers/repositories/mcpserver.repository.d.ts +1 -1
  204. package/dist/services/mcp-servers/repositories/mcpserver.repository.js +6 -7
  205. package/dist/services/mcp-servers/repositories/mcpserver.repository.mjs +2 -3
  206. package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.d.ts +1 -1
  207. package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.js +8 -8
  208. package/dist/services/mcp-servers/use-cases/create-mcpserver.use-case.mjs +5 -5
  209. package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.d.ts +1 -1
  210. package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.js +7 -7
  211. package/dist/services/mcp-servers/use-cases/decide-mcpserver-trust.use-case.mjs +4 -4
  212. package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.d.ts +1 -1
  213. package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.js +8 -8
  214. package/dist/services/mcp-servers/use-cases/delete-mcpserver.use-case.mjs +5 -5
  215. package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.d.ts +1 -1
  216. package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.js +7 -7
  217. package/dist/services/mcp-servers/use-cases/get-mcpserver-by-id.use-case.mjs +4 -4
  218. package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.d.ts +1 -1
  219. package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.js +8 -8
  220. package/dist/services/mcp-servers/use-cases/list-all-mcpservers-by-user.use-case.mjs +5 -5
  221. package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.d.ts +2 -2
  222. package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.js +8 -8
  223. package/dist/services/mcp-servers/use-cases/list-mcpservers-by-user.use-case.mjs +5 -5
  224. package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.d.ts +1 -1
  225. package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.js +9 -10
  226. package/dist/services/mcp-servers/use-cases/update-mcpserver.use-case.mjs +5 -6
  227. package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.d.ts +1 -1
  228. package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.js +9 -10
  229. package/dist/services/mcp-servers/use-cases/verify-mcpserver-connection.use-case.mjs +4 -5
  230. package/dist/services/tasks/entities/agent-action.entity.d.ts +1 -1
  231. package/dist/services/tasks/entities/agent-action.entity.js +6 -7
  232. package/dist/services/tasks/entities/agent-action.entity.mjs +1 -2
  233. package/dist/services/tasks/entities/agent-task.entity.d.ts +1 -1
  234. package/dist/services/tasks/entities/agent-task.entity.js +4 -4
  235. package/dist/services/tasks/entities/agent-task.entity.mjs +1 -1
  236. package/dist/services/tasks/repositories/agent-action.repository.d.ts +1 -1
  237. package/dist/services/tasks/repositories/agent-action.repository.js +5 -6
  238. package/dist/services/tasks/repositories/agent-action.repository.mjs +2 -3
  239. package/dist/services/tasks/repositories/agent-task.repository.d.ts +1 -1
  240. package/dist/services/tasks/repositories/agent-task.repository.js +5 -6
  241. package/dist/services/tasks/repositories/agent-task.repository.mjs +2 -3
  242. package/dist/services/tasks/use-cases/create-agent-action.use-case.d.ts +1 -1
  243. package/dist/services/tasks/use-cases/create-agent-action.use-case.js +7 -7
  244. package/dist/services/tasks/use-cases/create-agent-action.use-case.mjs +4 -4
  245. package/dist/services/tasks/use-cases/create-agent-task.use-case.d.ts +1 -1
  246. package/dist/services/tasks/use-cases/create-agent-task.use-case.js +7 -7
  247. package/dist/services/tasks/use-cases/create-agent-task.use-case.mjs +4 -4
  248. package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.d.ts +1 -1
  249. package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.js +7 -7
  250. package/dist/services/tasks/use-cases/get-agent-task-by-id.use-case.mjs +4 -4
  251. package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.d.ts +2 -2
  252. package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.js +9 -10
  253. package/dist/services/tasks/use-cases/list-agent-actions-by-task.use-case.mjs +6 -7
  254. package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.d.ts +2 -2
  255. package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.js +9 -10
  256. package/dist/services/tasks/use-cases/list-agent-tasks-by-chat.use-case.mjs +6 -7
  257. package/dist/services/tasks/use-cases/update-agent-action.use-case.d.ts +1 -1
  258. package/dist/services/tasks/use-cases/update-agent-action.use-case.js +7 -7
  259. package/dist/services/tasks/use-cases/update-agent-action.use-case.mjs +4 -4
  260. package/dist/services/tasks/use-cases/update-agent-task.use-case.d.ts +1 -1
  261. package/dist/services/tasks/use-cases/update-agent-task.use-case.js +7 -7
  262. package/dist/services/tasks/use-cases/update-agent-task.use-case.mjs +4 -4
  263. package/dist/services/traces/entities/agent-trace-entry.entity.d.ts +1 -1
  264. package/dist/services/traces/entities/agent-trace-entry.entity.js +6 -6
  265. package/dist/services/traces/entities/agent-trace-entry.entity.mjs +1 -1
  266. package/dist/services/traces/repositories/agent-trace.repository.d.ts +1 -1
  267. package/dist/services/traces/repositories/agent-trace.repository.js +4 -4
  268. package/dist/services/traces/repositories/agent-trace.repository.mjs +2 -2
  269. package/dist/services/traces/use-cases/create-agent-traces.use-case.d.ts +1 -1
  270. package/dist/services/traces/use-cases/create-agent-traces.use-case.js +7 -7
  271. package/dist/services/traces/use-cases/create-agent-traces.use-case.mjs +4 -4
  272. package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.d.ts +2 -2
  273. package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.js +12 -13
  274. package/dist/services/traces/use-cases/list-agent-traces-by-chat.use-case.mjs +6 -7
  275. package/dist/services/workspaces/entities/workspace-item.entity.d.ts +1 -1
  276. package/dist/services/workspaces/entities/workspace-item.entity.js +5 -5
  277. package/dist/services/workspaces/entities/workspace-item.entity.mjs +1 -1
  278. package/dist/services/workspaces/repositories/workspace-item.repository.d.ts +1 -1
  279. package/dist/services/workspaces/repositories/workspace-item.repository.js +5 -6
  280. package/dist/services/workspaces/repositories/workspace-item.repository.mjs +2 -3
  281. package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.d.ts +1 -1
  282. package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.js +11 -12
  283. package/dist/services/workspaces/use-cases/delete-workspace-item.use-case.mjs +6 -7
  284. package/dist/services/workspaces/use-cases/get-workspace-item.use-case.d.ts +1 -1
  285. package/dist/services/workspaces/use-cases/get-workspace-item.use-case.js +11 -12
  286. package/dist/services/workspaces/use-cases/get-workspace-item.use-case.mjs +6 -7
  287. package/dist/services/workspaces/use-cases/list-workspace-items.use-case.d.ts +2 -2
  288. package/dist/services/workspaces/use-cases/list-workspace-items.use-case.js +11 -12
  289. package/dist/services/workspaces/use-cases/list-workspace-items.use-case.mjs +6 -7
  290. package/dist/services/workspaces/use-cases/save-workspace-item.use-case.d.ts +1 -1
  291. package/dist/services/workspaces/use-cases/save-workspace-item.use-case.js +10 -11
  292. package/dist/services/workspaces/use-cases/save-workspace-item.use-case.mjs +6 -7
  293. package/dist/services/workspaces/use-cases/search-workspace-items.use-case.d.ts +2 -2
  294. package/dist/services/workspaces/use-cases/search-workspace-items.use-case.js +11 -12
  295. package/dist/services/workspaces/use-cases/search-workspace-items.use-case.mjs +6 -7
  296. package/dist/skills/runtime-context.d.ts +3 -3
  297. package/dist/skills/runtime-context.js +24 -21
  298. package/dist/skills/runtime-context.mjs +24 -21
  299. package/dist/skills/skill.d.ts +3 -3
  300. package/dist/skills/skill.js +5 -5
  301. package/dist/skills/skill.mjs +4 -4
  302. package/dist/tools/core/call-ai/call-ai.tool.js +2 -2
  303. package/dist/tools/core/call-ai/call-ai.tool.mjs +2 -2
  304. package/dist/tools/core/web-search/web-search.tool.js +1 -1
  305. package/dist/tools/core/web-search/web-search.tool.mjs +1 -1
  306. package/dist/tools/tool.d.ts +2 -2
  307. package/dist/tools/tool.js +1 -1
  308. package/dist/tools/tool.mjs +1 -1
  309. package/docs/README.md +1 -1
  310. package/docs/agent.md +10 -10
  311. package/docs/authentication.md +15 -114
  312. package/docs/authorization.md +18 -18
  313. package/docs/automations.md +28 -28
  314. package/docs/chats.md +14 -14
  315. package/docs/configuration.md +14 -15
  316. package/docs/error-reporting.md +6 -6
  317. package/docs/guardrails.md +1 -1
  318. package/docs/integration-guide.md +12 -12
  319. package/docs/loops.md +2 -2
  320. package/docs/mcp-servers.md +15 -15
  321. package/docs/skills.md +1 -1
  322. package/docs/tools.md +2 -2
  323. package/docs/usage.md +5 -5
  324. package/docs/users.md +18 -91
  325. package/examples/automations/create-automation.ts +4 -4
  326. package/examples/automations/create-event-automation.ts +5 -5
  327. package/examples/automations/list-automation-runs.ts +7 -7
  328. package/examples/automations/list-automations.ts +4 -4
  329. package/examples/automations/preview-automation-runs.ts +1 -1
  330. package/examples/automations/receive-automation-event.ts +1 -1
  331. package/examples/automations/revoke-automation-event-token.ts +6 -6
  332. package/examples/automations/run-automation-now.ts +4 -4
  333. package/examples/automations/run-automation-worker.ts +1 -1
  334. package/examples/automations/update-automation.ts +6 -6
  335. package/examples/chats/delete-chat.ts +6 -6
  336. package/examples/chats/get-chat-by-id.ts +6 -6
  337. package/examples/chats/list-autonomous-chats.ts +4 -4
  338. package/examples/chats/list-chats.ts +4 -4
  339. package/examples/chats/search-chats.ts +5 -5
  340. package/examples/errors/error-reporting.ts +6 -6
  341. package/examples/loops/custom-loop.ts +5 -5
  342. package/examples/mcps/create-mcp.ts +4 -4
  343. package/examples/mcps/decide-mcp.ts +7 -7
  344. package/examples/mcps/delete-mcp.ts +6 -6
  345. package/examples/mcps/get-mcp-by-id.ts +4 -4
  346. package/examples/mcps/internal-mcp-admin.ts +8 -8
  347. package/examples/mcps/internal-mcp.ts +5 -5
  348. package/examples/mcps/list-all-mcps.ts +4 -4
  349. package/examples/mcps/list-user-mcps.ts +4 -4
  350. package/examples/mcps/update-mcp.ts +4 -4
  351. package/examples/mcps/verify-mcp.ts +4 -4
  352. package/examples/run-agent/interrupt-agent.ts +5 -5
  353. package/examples/run-agent/run-agent-autonomous.ts +5 -5
  354. package/examples/run-agent/run-agent-multi-tenant.ts +10 -11
  355. package/examples/run-agent/run-agent-strict-mode.ts +5 -5
  356. package/examples/run-agent/run-agent-with-confirmation.ts +6 -6
  357. package/examples/run-agent/run-agent-with-fallback-model.ts +5 -5
  358. package/examples/run-agent/run-agent-with-fetch-url.ts +5 -5
  359. package/examples/run-agent/run-agent-with-guards.ts +5 -5
  360. package/examples/run-agent/run-agent-with-hooks.ts +5 -5
  361. package/examples/run-agent/run-agent-with-identity.ts +5 -5
  362. package/examples/run-agent/run-agent-with-model.ts +5 -5
  363. package/examples/run-agent/run-agent-with-slack.ts +5 -5
  364. package/examples/run-agent/run-agent-with-tools.ts +5 -5
  365. package/examples/run-agent/run-agent-with-usage-limit-stop.ts +5 -5
  366. package/examples/run-agent/run-agent-with-usage-limit.ts +5 -5
  367. package/examples/tools/basic-tool.ts +1 -1
  368. package/examples/tools/web-search-tool.ts +1 -1
  369. package/examples/usage/get-chat-usage.ts +4 -4
  370. package/examples/usage/get-message-usage.ts +4 -4
  371. package/examples/usage/get-usage-stats-by-range.ts +4 -4
  372. package/examples/usage/get-usage-stats.ts +4 -4
  373. package/examples/users/set-default-model.ts +12 -21
  374. package/package.json +5 -20
  375. package/dist/common/base/base.app.d.ts +0 -12
  376. package/dist/common/base/base.app.js +0 -57
  377. package/dist/common/base/base.app.mjs +0 -33
  378. package/dist/common/base/base.entity.d.ts +0 -38
  379. package/dist/common/base/base.entity.js +0 -100
  380. package/dist/common/base/base.entity.mjs +0 -76
  381. package/dist/common/base/base.use-case.d.ts +0 -11
  382. package/dist/common/base/base.use-case.js +0 -30
  383. package/dist/common/base/base.use-case.mjs +0 -6
  384. package/dist/common/base/current-session.d.ts +0 -129
  385. package/dist/common/base/current-session.js +0 -123
  386. package/dist/common/base/current-session.mjs +0 -98
  387. package/dist/common/base/current-user.d.ts +0 -16
  388. package/dist/common/base/current-user.js +0 -85
  389. package/dist/common/base/current-user.mjs +0 -61
  390. package/dist/common/base/index.d.ts +0 -3
  391. package/dist/common/base/index.js +0 -26
  392. package/dist/common/base/index.mjs +0 -3
  393. package/dist/common/base/share.d.ts +0 -12
  394. package/dist/common/base/share.js +0 -45
  395. package/dist/common/base/share.mjs +0 -20
  396. package/dist/common/base/utils/index.d.ts +0 -2
  397. package/dist/common/base/utils/index.js +0 -24
  398. package/dist/common/base/utils/index.mjs +0 -2
  399. package/dist/common/base/utils/is-plain-object.d.ts +0 -1
  400. package/dist/common/base/utils/is-plain-object.js +0 -32
  401. package/dist/common/base/utils/is-plain-object.mjs +0 -8
  402. package/dist/common/base/utils/to-patch.d.ts +0 -9
  403. package/dist/common/base/utils/to-patch.js +0 -46
  404. package/dist/common/base/utils/to-patch.mjs +0 -21
  405. package/dist/common/error/error-reporter.d.ts +0 -11
  406. package/dist/common/error/error-reporter.mjs +0 -11
  407. package/dist/common/error/http-error.d.ts +0 -11
  408. package/dist/common/error/http-error.js +0 -37
  409. package/dist/common/error/http-error.mjs +0 -13
  410. package/dist/common/error/index.d.ts +0 -3
  411. package/dist/common/error/index.js +0 -26
  412. package/dist/common/error/index.mjs +0 -3
  413. package/dist/common/error/reportError.d.ts +0 -2
  414. package/dist/common/error/reportError.js +0 -61
  415. package/dist/common/error/reportError.mjs +0 -37
  416. package/dist/common/error/sentry-client.d.ts +0 -10
  417. package/dist/common/error/sentry-client.js +0 -82
  418. package/dist/common/error/sentry-client.mjs +0 -57
  419. package/dist/common/index.d.ts +0 -6
  420. package/dist/common/index.js +0 -37
  421. package/dist/common/index.mjs +0 -9
  422. package/dist/common/logger/index.d.ts +0 -1
  423. package/dist/common/logger/index.mjs +0 -1
  424. package/dist/common/logger/pino.d.ts +0 -12
  425. package/dist/common/logger/pino.js +0 -79
  426. package/dist/common/logger/pino.mjs +0 -44
  427. package/dist/common/repositories/index.d.ts +0 -3
  428. package/dist/common/repositories/index.js +0 -26
  429. package/dist/common/repositories/index.mjs +0 -3
  430. package/dist/common/repositories/mongo-db.client.d.ts +0 -11
  431. package/dist/common/repositories/mongo-db.client.js +0 -83
  432. package/dist/common/repositories/mongo-db.client.mjs +0 -60
  433. package/dist/common/repositories/mongo-db.repository.d.ts +0 -130
  434. package/dist/common/repositories/mongo-db.repository.js +0 -357
  435. package/dist/common/repositories/mongo-db.repository.mjs +0 -332
  436. package/dist/common/repositories/scope.d.ts +0 -19
  437. package/dist/common/repositories/scope.js +0 -63
  438. package/dist/common/repositories/scope.mjs +0 -39
  439. package/dist/common/utils/config-context.d.ts +0 -3
  440. package/dist/common/utils/config-context.js +0 -33
  441. package/dist/common/utils/config-context.mjs +0 -8
  442. package/dist/common/utils/database-name.d.ts +0 -2
  443. package/dist/common/utils/database-name.js +0 -32
  444. package/dist/common/utils/database-name.mjs +0 -7
  445. package/dist/common/utils/secret-manager.d.ts +0 -17
  446. package/dist/common/utils/secret-manager.js +0 -124
  447. package/dist/common/utils/secret-manager.mjs +0 -89
  448. package/dist/db/indexes/refresh-tokens.d.ts +0 -2
  449. package/dist/db/indexes/refresh-tokens.js +0 -33
  450. package/dist/db/indexes/refresh-tokens.mjs +0 -9
  451. package/dist/db/indexes/revoked-tokens.d.ts +0 -2
  452. package/dist/db/indexes/revoked-tokens.js +0 -31
  453. package/dist/db/indexes/revoked-tokens.mjs +0 -7
  454. package/dist/services/authentication/entities/index.d.ts +0 -2
  455. package/dist/services/authentication/entities/index.js +0 -24
  456. package/dist/services/authentication/entities/index.mjs +0 -2
  457. package/dist/services/authentication/entities/refresh-token.entity.d.ts +0 -25
  458. package/dist/services/authentication/entities/refresh-token.entity.js +0 -75
  459. package/dist/services/authentication/entities/refresh-token.entity.mjs +0 -51
  460. package/dist/services/authentication/entities/revoked-token.entity.d.ts +0 -17
  461. package/dist/services/authentication/entities/revoked-token.entity.js +0 -67
  462. package/dist/services/authentication/entities/revoked-token.entity.mjs +0 -43
  463. package/dist/services/authentication/helpers/auth-config.d.ts +0 -9
  464. package/dist/services/authentication/helpers/auth-config.js +0 -36
  465. package/dist/services/authentication/helpers/auth-config.mjs +0 -12
  466. package/dist/services/authentication/helpers/session-tokens.d.ts +0 -16
  467. package/dist/services/authentication/helpers/session-tokens.js +0 -60
  468. package/dist/services/authentication/helpers/session-tokens.mjs +0 -35
  469. package/dist/services/authentication/helpers/tokens.d.ts +0 -43
  470. package/dist/services/authentication/helpers/tokens.js +0 -113
  471. package/dist/services/authentication/helpers/tokens.mjs +0 -71
  472. package/dist/services/authentication/index.d.ts +0 -5
  473. package/dist/services/authentication/index.js +0 -47
  474. package/dist/services/authentication/index.mjs +0 -13
  475. package/dist/services/authentication/module.d.ts +0 -16
  476. package/dist/services/authentication/module.js +0 -81
  477. package/dist/services/authentication/module.mjs +0 -50
  478. package/dist/services/authentication/repositories/index.d.ts +0 -2
  479. package/dist/services/authentication/repositories/index.js +0 -24
  480. package/dist/services/authentication/repositories/index.mjs +0 -2
  481. package/dist/services/authentication/repositories/refresh-token.repository.d.ts +0 -10
  482. package/dist/services/authentication/repositories/refresh-token.repository.js +0 -60
  483. package/dist/services/authentication/repositories/refresh-token.repository.mjs +0 -36
  484. package/dist/services/authentication/repositories/revoked-token.repository.d.ts +0 -7
  485. package/dist/services/authentication/repositories/revoked-token.repository.js +0 -44
  486. package/dist/services/authentication/repositories/revoked-token.repository.mjs +0 -20
  487. package/dist/services/authentication/use-cases/claim-refresh-token.use-case.d.ts +0 -12
  488. package/dist/services/authentication/use-cases/claim-refresh-token.use-case.js +0 -40
  489. package/dist/services/authentication/use-cases/claim-refresh-token.use-case.mjs +0 -16
  490. package/dist/services/authentication/use-cases/create-refresh-token.use-case.d.ts +0 -11
  491. package/dist/services/authentication/use-cases/create-refresh-token.use-case.js +0 -43
  492. package/dist/services/authentication/use-cases/create-refresh-token.use-case.mjs +0 -19
  493. package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.d.ts +0 -11
  494. package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.js +0 -40
  495. package/dist/services/authentication/use-cases/find-refresh-token-by-hash.use-case.mjs +0 -16
  496. package/dist/services/authentication/use-cases/is-token-revoked.use-case.d.ts +0 -13
  497. package/dist/services/authentication/use-cases/is-token-revoked.use-case.js +0 -42
  498. package/dist/services/authentication/use-cases/is-token-revoked.use-case.mjs +0 -18
  499. package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.d.ts +0 -18
  500. package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.js +0 -49
  501. package/dist/services/authentication/use-cases/issue-password-reset-token.use-case.mjs +0 -25
  502. package/dist/services/authentication/use-cases/issue-session.use-case.d.ts +0 -13
  503. package/dist/services/authentication/use-cases/issue-session.use-case.js +0 -48
  504. package/dist/services/authentication/use-cases/issue-session.use-case.mjs +0 -24
  505. package/dist/services/authentication/use-cases/login.use-case.d.ts +0 -20
  506. package/dist/services/authentication/use-cases/login.use-case.js +0 -54
  507. package/dist/services/authentication/use-cases/login.use-case.mjs +0 -30
  508. package/dist/services/authentication/use-cases/logout.use-case.d.ts +0 -14
  509. package/dist/services/authentication/use-cases/logout.use-case.js +0 -48
  510. package/dist/services/authentication/use-cases/logout.use-case.mjs +0 -24
  511. package/dist/services/authentication/use-cases/refresh.use-case.d.ts +0 -23
  512. package/dist/services/authentication/use-cases/refresh.use-case.js +0 -84
  513. package/dist/services/authentication/use-cases/refresh.use-case.mjs +0 -60
  514. package/dist/services/authentication/use-cases/reset-password.use-case.d.ts +0 -15
  515. package/dist/services/authentication/use-cases/reset-password.use-case.js +0 -61
  516. package/dist/services/authentication/use-cases/reset-password.use-case.mjs +0 -37
  517. package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.d.ts +0 -11
  518. package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.js +0 -40
  519. package/dist/services/authentication/use-cases/revoke-refresh-token-family.use-case.mjs +0 -16
  520. package/dist/services/authentication/use-cases/revoke-token.use-case.d.ts +0 -12
  521. package/dist/services/authentication/use-cases/revoke-token.use-case.js +0 -52
  522. package/dist/services/authentication/use-cases/revoke-token.use-case.mjs +0 -28
  523. package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.d.ts +0 -13
  524. package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.js +0 -40
  525. package/dist/services/authentication/use-cases/revoke-user-refresh-tokens.use-case.mjs +0 -16
  526. package/dist/services/users/entities/index.d.ts +0 -1
  527. package/dist/services/users/entities/index.js +0 -22
  528. package/dist/services/users/entities/index.mjs +0 -1
  529. package/dist/services/users/entities/user-acquisition.d.ts +0 -12
  530. package/dist/services/users/entities/user-acquisition.js +0 -42
  531. package/dist/services/users/entities/user-acquisition.mjs +0 -18
  532. package/dist/services/users/entities/user-country.d.ts +0 -11
  533. package/dist/services/users/entities/user-country.js +0 -44
  534. package/dist/services/users/entities/user-country.mjs +0 -20
  535. package/dist/services/users/entities/user-currency.d.ts +0 -13
  536. package/dist/services/users/entities/user-currency.js +0 -44
  537. package/dist/services/users/entities/user-currency.mjs +0 -20
  538. package/dist/services/users/entities/user-default-model.d.ts +0 -11
  539. package/dist/services/users/entities/user-default-model.js +0 -42
  540. package/dist/services/users/entities/user-default-model.mjs +0 -18
  541. package/dist/services/users/entities/user-email.value-object.d.ts +0 -6
  542. package/dist/services/users/entities/user-email.value-object.js +0 -43
  543. package/dist/services/users/entities/user-email.value-object.mjs +0 -19
  544. package/dist/services/users/entities/user-language.d.ts +0 -11
  545. package/dist/services/users/entities/user-language.js +0 -44
  546. package/dist/services/users/entities/user-language.mjs +0 -20
  547. package/dist/services/users/entities/user-marketing.d.ts +0 -9
  548. package/dist/services/users/entities/user-marketing.js +0 -40
  549. package/dist/services/users/entities/user-marketing.mjs +0 -16
  550. package/dist/services/users/entities/user-notification-preferences.d.ts +0 -11
  551. package/dist/services/users/entities/user-notification-preferences.js +0 -41
  552. package/dist/services/users/entities/user-notification-preferences.mjs +0 -17
  553. package/dist/services/users/entities/user-password.value-object.d.ts +0 -8
  554. package/dist/services/users/entities/user-password.value-object.js +0 -69
  555. package/dist/services/users/entities/user-password.value-object.mjs +0 -35
  556. package/dist/services/users/entities/user-permissions.d.ts +0 -21
  557. package/dist/services/users/entities/user-permissions.js +0 -59
  558. package/dist/services/users/entities/user-permissions.mjs +0 -35
  559. package/dist/services/users/entities/user-preferences.d.ts +0 -28
  560. package/dist/services/users/entities/user-preferences.js +0 -74
  561. package/dist/services/users/entities/user-preferences.mjs +0 -50
  562. package/dist/services/users/entities/user-report-preferences.d.ts +0 -16
  563. package/dist/services/users/entities/user-report-preferences.js +0 -56
  564. package/dist/services/users/entities/user-report-preferences.mjs +0 -32
  565. package/dist/services/users/entities/user-report-schedule.d.ts +0 -11
  566. package/dist/services/users/entities/user-report-schedule.js +0 -41
  567. package/dist/services/users/entities/user-report-schedule.mjs +0 -17
  568. package/dist/services/users/entities/user-timezone.d.ts +0 -11
  569. package/dist/services/users/entities/user-timezone.js +0 -44
  570. package/dist/services/users/entities/user-timezone.mjs +0 -20
  571. package/dist/services/users/entities/user.entity.d.ts +0 -42
  572. package/dist/services/users/entities/user.entity.js +0 -117
  573. package/dist/services/users/entities/user.entity.mjs +0 -92
  574. package/dist/services/users/index.d.ts +0 -3
  575. package/dist/services/users/index.js +0 -26
  576. package/dist/services/users/index.mjs +0 -3
  577. package/dist/services/users/module.d.ts +0 -12
  578. package/dist/services/users/module.js +0 -67
  579. package/dist/services/users/module.mjs +0 -38
  580. package/dist/services/users/repositories/index.d.ts +0 -1
  581. package/dist/services/users/repositories/index.js +0 -22
  582. package/dist/services/users/repositories/index.mjs +0 -1
  583. package/dist/services/users/repositories/user.repository.d.ts +0 -18
  584. package/dist/services/users/repositories/user.repository.js +0 -88
  585. package/dist/services/users/repositories/user.repository.mjs +0 -64
  586. package/dist/services/users/use-cases/change-password.use-case.d.ts +0 -15
  587. package/dist/services/users/use-cases/change-password.use-case.js +0 -52
  588. package/dist/services/users/use-cases/change-password.use-case.mjs +0 -28
  589. package/dist/services/users/use-cases/create-user.use-case.d.ts +0 -12
  590. package/dist/services/users/use-cases/create-user.use-case.js +0 -49
  591. package/dist/services/users/use-cases/create-user.use-case.mjs +0 -25
  592. package/dist/services/users/use-cases/delete-user.use-case.d.ts +0 -16
  593. package/dist/services/users/use-cases/delete-user.use-case.js +0 -48
  594. package/dist/services/users/use-cases/delete-user.use-case.mjs +0 -24
  595. package/dist/services/users/use-cases/get-user-by-id.use-case.d.ts +0 -12
  596. package/dist/services/users/use-cases/get-user-by-id.use-case.js +0 -43
  597. package/dist/services/users/use-cases/get-user-by-id.use-case.mjs +0 -19
  598. package/dist/services/users/use-cases/list-users-by-props.use-case.d.ts +0 -17
  599. package/dist/services/users/use-cases/list-users-by-props.use-case.js +0 -42
  600. package/dist/services/users/use-cases/list-users-by-props.use-case.mjs +0 -18
  601. package/dist/services/users/use-cases/update-user.use-case.d.ts +0 -13
  602. package/dist/services/users/use-cases/update-user.use-case.js +0 -53
  603. package/dist/services/users/use-cases/update-user.use-case.mjs +0 -29
  604. package/dist/services/users/utils/default-model.d.ts +0 -6
  605. package/dist/services/users/utils/default-model.js +0 -38
  606. package/dist/services/users/utils/default-model.mjs +0 -14
  607. package/examples/authentication/login.ts +0 -22
  608. package/examples/users/create-user.ts +0 -25
  609. package/examples/users/delete-user.ts +0 -42
  610. package/examples/users/get-user-by-id.ts +0 -21
  611. package/examples/users/list-users.ts +0 -22
  612. package/examples/users/update-user.ts +0 -25
@@ -38,7 +38,7 @@ const result = await createAutomation({
38
38
  modelProvider: 'anthropic',
39
39
  modelName: 'claude-haiku-5-5',
40
40
  },
41
- currentUser,
41
+ actor,
42
42
  })
43
43
 
44
44
  result.triggers.schedule.nextRunAt
@@ -72,7 +72,7 @@ await createAutomation({
72
72
  event: {},
73
73
  },
74
74
  },
75
- currentUser,
75
+ actor,
76
76
  })
77
77
  ```
78
78
 
@@ -117,19 +117,19 @@ It returns the next dates (at most 20) without saving anything, so a screen can
117
117
  ## Managing automations
118
118
 
119
119
  ```typescript
120
- await updateAutomation({ id, payload: { triggers: { schedule: { enabled: false } } }, currentUser })
120
+ await updateAutomation({ id, payload: { triggers: { schedule: { enabled: false } } }, actor })
121
121
 
122
- await updateAutomation({ id, payload: { triggers: { event: { enabled: true } } }, currentUser })
122
+ await updateAutomation({ id, payload: { triggers: { event: { enabled: true } } }, actor })
123
123
 
124
- await updateAutomation({ id, payload: { triggers: { event: {} } }, currentUser })
124
+ await updateAutomation({ id, payload: { triggers: { event: {} } }, actor })
125
125
 
126
- await updateAutomation({ id, payload: { triggers: { event: null } }, currentUser })
126
+ await updateAutomation({ id, payload: { triggers: { event: null } }, actor })
127
127
 
128
- const automation = await getAutomationById({ id, currentUser })
128
+ const automation = await getAutomationById({ id, actor })
129
129
 
130
- const automations = await listAutomationsByUser({ options: { page: 1, limit: 10 }, currentUser })
130
+ const automations = await listAutomationsByUser({ options: { page: 1, limit: 10 }, actor })
131
131
 
132
- await deleteAutomation({ id, currentUser })
132
+ await deleteAutomation({ id, actor })
133
133
  ```
134
134
 
135
135
  - **The triggers are merged key by key.** Send only the trigger that changes, and inside it only the fields that change. What you do not send is kept. To pause the whole automation, turn off both triggers.
@@ -153,10 +153,10 @@ const automation = await createAutomation({
153
153
  instructions: 'Find the cause of the cost alert in AWS and send a summary to the channel #costs',
154
154
  triggers: { event: {} },
155
155
  },
156
- currentUser,
156
+ actor,
157
157
  })
158
158
 
159
- const data = await issueAutomationEventToken({ id: String(automation._id), expiresIn: '90d', currentUser })
159
+ const data = await issueAutomationEventToken({ id: String(automation._id), expiresIn: '90d', actor })
160
160
 
161
161
  data.token
162
162
  data.expiresAt
@@ -217,7 +217,7 @@ The token is a JWT signed with `JWT_SECRET`. It is not stored: the owner can ask
217
217
 
218
218
  | Claim | Value |
219
219
  | --- | --- |
220
- | `iss` | `openloops`, like every token of the package (see [authentication](authentication.md#the-tokens)). |
220
+ | `iss` | The issuer of your solution (`openloops` with `appName: 'openloops'`), like every token of the package (see [authentication](authentication.md#the-tokens)). |
221
221
  | `aud` | `automation-event`. A session token of a user is refused, and this one does not log anybody in. |
222
222
  | `sub` | The id of the automation. It must be the one of the URL. |
223
223
  | `v` | The `eventTokenVersion` of the automation when the token was issued. |
@@ -228,17 +228,17 @@ The `eventTokenVersion` is a field of the automation, not of the event trigger,
228
228
 
229
229
  | Operation | What it does | Changes `eventTokenVersion` | Effect on the tokens already issued |
230
230
  | --- | --- | --- | --- |
231
- | `issueAutomationEventToken({ id, expiresIn?, currentUser })` | Signs a new token with the current `eventTokenVersion` and a new `jti`. It does not store it and it does not write the automation. | No | None. Every token issued before keeps working, so you can have one per system that sends events. |
232
- | `revokeAutomationEventToken({ id, token, currentUser })` | Saves the `jti` of the token you pass in `revoked_tokens`. | No | Only that token stops working. The rest are valid. |
233
- | `rotateAutomationEventTokens({ id, currentUser })` | Adds 1 to `eventTokenVersion` and saves the automation. It does not return a token. | Yes | Every token issued before stops working, because its `v` is not the current version any more. Issue a new one afterwards. |
231
+ | `issueAutomationEventToken({ id, expiresIn?, actor })` | Signs a new token with the current `eventTokenVersion` and a new `jti`. It does not store it and it does not write the automation. | No | None. Every token issued before keeps working, so you can have one per system that sends events. |
232
+ | `revokeAutomationEventToken({ id, token, actor })` | Saves the `jti` of the token you pass in `revoked_tokens`. | No | Only that token stops working. The rest are valid. |
233
+ | `rotateAutomationEventTokens({ id, actor })` | Adds 1 to `eventTokenVersion` and saves the automation. It does not return a token. | Yes | Every token issued before stops working, because its `v` is not the current version any more. Issue a new one afterwards. |
234
234
 
235
235
  So issuing again does **not** replace the previous token. To "regenerate" a token and kill the old ones, rotate first and then issue. The three are only for the owner of the automation or an admin, and the event trigger must exist: without it they fail with an error.
236
236
 
237
237
  Four ways to take a token out of use:
238
238
 
239
239
  - **Let it expire,** if it was issued with `expiresIn`. A token that expires stops working without notice, and the refused events create no run, so watch the `expired` reasons in your logs.
240
- - **Revoke one token.** If a token leaked, pass it to `revokeAutomationEventToken({ id, token, currentUser })`. Its `jti` goes to the collection `revoked_tokens` and only that token stops working. The entry is deleted by itself when the token would have expired. The tokens are not stored, so there is no list to choose from: you need the leaked token in your hands.
241
- - **Rotate.** `rotateAutomationEventTokens({ id, currentUser })` increases the version and **every** token issued before stops working. Use it when you do not have the leaked token, or you want to start again. Issue the new token afterwards.
240
+ - **Revoke one token.** If a token leaked, pass it to `revokeAutomationEventToken({ id, token, actor })`. Its `jti` goes to the collection `revoked_tokens` and only that token stops working. The entry is deleted by itself when the token would have expired. The tokens are not stored, so there is no list to choose from: you need the leaked token in your hands.
241
+ - **Rotate.** `rotateAutomationEventTokens({ id, actor })` increases the version and **every** token issued before stops working. Use it when you do not have the leaked token, or you want to start again. Issue the new token afterwards.
242
242
  - **Turn the event trigger off.** Its events are refused with the reason `disabled`, and the tokens work again when it is turned on. If you remove the event trigger instead, the tokens are refused with the reason `invalid` until an event is added again, see [managing automations](#managing-automations).
243
243
 
244
244
  A revoked token is checked after its signature, so an invalid token never reaches the database.
@@ -248,9 +248,9 @@ A revoked token is checked after its signature, so an invalid token never reache
248
248
  Every execution is a run.
249
249
 
250
250
  ```typescript
251
- const byAutomation = await listAutomationRunsByAutomation({ automationId, status: 'paused', options: { page: 1, limit: 20 }, currentUser })
251
+ const byAutomation = await listAutomationRunsByAutomation({ automationId, status: 'paused', options: { page: 1, limit: 20 }, actor })
252
252
 
253
- const byUser = await listAutomationRunsByUser({ status: 'failed', currentUser })
253
+ const byUser = await listAutomationRunsByUser({ status: 'failed', actor })
254
254
  ```
255
255
 
256
256
  | Field | Meaning |
@@ -305,7 +305,7 @@ The runner does not share anything with the agent you build for your chat. If yo
305
305
 
306
306
  | Option | Default | What it does |
307
307
  | --- | --- | --- |
308
- | `agent` | `{}` (no tools, no guards) | The options of the `Agent` used for every run: tools, guards, `maxIterations`, `strictMode`, `identity`... It can be a function `({ automation, currentUser }) => options` when they depend on the automation or on the user. The loop is `AgiLoop` unless you set `loop`. A custom loop must support autonomous mode (`harness.executionMode`). |
308
+ | `agent` | `{}` (no tools, no guards) | The options of the `Agent` used for every run: tools, guards, `maxIterations`, `strictMode`, `identity`... It can be a function `({ automation, actor }) => options` when they depend on the automation or on the user. The loop is `AgiLoop` unless you set `loop`. A custom loop must support autonomous mode (`harness.executionMode`). |
309
309
  | `intervalMs` | `60000` | How often it checks. Also set with `AUTOMATIONS_POLL_INTERVAL_MS`. `runner.wake()` makes it check now. |
310
310
  | `leaseMs` | `600000` | How long an automation stays locked while it runs, renewed while the run lasts. Also set with `AUTOMATIONS_LEASE_MS`. |
311
311
  | `maxConcurrentRuns` | `3` | How many runs a runner executes at once. |
@@ -353,10 +353,10 @@ const runner = createAutomationRunner({
353
353
  ### Running by hand
354
354
 
355
355
  ```typescript
356
- const { run } = await runner.runNow({ automationId, currentUser })
356
+ const { run } = await runner.runNow({ automationId, actor })
357
357
  ```
358
358
 
359
- It starts the run at once, only if the automation is of `currentUser`, and returns while it keeps running in the background. It does not change the next scheduled run. It is refused if the automation is already running. Any process that has a runner can call it, it does not need to be the one that called `start()`.
359
+ It starts the run at once, only if the automation is of `actor`, and returns while it keeps running in the background. It does not change the next scheduled run. It is refused if the automation is already running. Any process that has a runner can call it, it does not need to be the one that called `start()`.
360
360
 
361
361
  ### Several instances
362
362
 
@@ -409,7 +409,7 @@ Before 0.4.0 this module was called `agentic-jobs`. The old names are not kept a
409
409
  recurrence: { type: 'daily', time: '08:00' },
410
410
  timezone: 'America/New_York',
411
411
  },
412
- currentUser,
412
+ actor,
413
413
  })
414
414
  ```
415
415
 
@@ -427,7 +427,7 @@ Before 0.4.0 this module was called `agentic-jobs`. The old names are not kept a
427
427
  },
428
428
  },
429
429
  },
430
- currentUser,
430
+ actor,
431
431
  })
432
432
  ```
433
433
 
@@ -460,10 +460,10 @@ Version 0.5.0 lets an automation have a schedule and an event at the same time.
460
460
  enabled: true,
461
461
  trigger: { type: 'schedule', recurrence: { type: 'daily', time: '08:00' }, timezone: 'America/New_York' },
462
462
  },
463
- currentUser,
463
+ actor,
464
464
  })
465
465
 
466
- await createAutomation({ payload: { name: 'Alarms', instructions: 'Analyze the alarm', trigger: { type: 'event' } }, currentUser })
466
+ await createAutomation({ payload: { name: 'Alarms', instructions: 'Analyze the alarm', trigger: { type: 'event' } }, actor })
467
467
  ```
468
468
 
469
469
  Now:
@@ -475,10 +475,10 @@ Version 0.5.0 lets an automation have a schedule and an event at the same time.
475
475
  instructions: 'Summarize my open tickets',
476
476
  triggers: { schedule: { enabled: true, recurrence: { type: 'daily', time: '08:00' }, timezone: 'America/New_York' } },
477
477
  },
478
- currentUser,
478
+ actor,
479
479
  })
480
480
 
481
- await createAutomation({ payload: { name: 'Alarms', instructions: 'Analyze the alarm', triggers: { event: {} } }, currentUser })
481
+ await createAutomation({ payload: { name: 'Alarms', instructions: 'Analyze the alarm', triggers: { event: {} } }, actor })
482
482
  ```
483
483
 
484
484
  Sending `trigger` or `enabled` in the payload of `createAutomation` or `updateAutomation` fails with an error that says where the field went, so nothing is ignored silently.
package/docs/chats.md CHANGED
@@ -34,28 +34,28 @@ Messages with `excludeFromContext` are shown in the history but never sent to th
34
34
  ```typescript
35
35
  const result = await listChatsByUser({
36
36
  options: { page: 1, limit: 10 },
37
- currentUser,
37
+ actor,
38
38
  })
39
39
  ```
40
40
 
41
41
  Sorted by last update, newest first. Defaults to page 1 and 10 chats. The result has `items` and `hasMore`, which is `true` when there is a next page.
42
42
 
43
43
  ```typescript
44
- const autonomous = await listChatsByUser({ executionMode: 'autonomous', currentUser })
44
+ const autonomous = await listChatsByUser({ executionMode: 'autonomous', actor })
45
45
 
46
- const interactive = await listChatsByUser({ executionMode: 'interactive', currentUser })
46
+ const interactive = await listChatsByUser({ executionMode: 'interactive', actor })
47
47
  ```
48
48
 
49
49
  `executionMode` is optional. `autonomous` returns the chats that were created by an autonomous run and `interactive` returns the rest, including the chats saved before the mode existed. Combine it with `state.status` to show the autonomous runs that need attention: `awaiting_user_confirmation` or `awaiting_user_input` mean the run is paused until the user answers in the chat, and `failed` means it failed.
50
50
 
51
51
  ```typescript
52
- const found = await listChatsByUser({ search: 'netflix', currentUser })
52
+ const found = await listChatsByUser({ search: 'netflix', actor })
53
53
  ```
54
54
 
55
55
  `search` is optional. It returns the chats whose title or at least one message contains the text, ignoring case, in the same order and with the same pagination. The text is matched literally, so characters such as `(` or `.` have no special meaning. It reads the messages without an index, which is fine for the chats of one user. An empty text is ignored.
56
56
 
57
57
  ```typescript
58
- const history = await listChatsByUser({ search: 'netflix', select: { title: 1, updatedAt: 1 }, currentUser })
58
+ const history = await listChatsByUser({ search: 'netflix', select: { title: 1, updatedAt: 1 }, actor })
59
59
  ```
60
60
 
61
61
  `select` is optional and limits the fields that come back, as in `getChatById`. Without it every chat comes complete, with all its messages. A history list only needs a few fields, and `_id` always comes. `search` does not depend on `select`: it still looks in the messages when they are not returned, and the chat that the user picks is loaded with `getChatById`. A history without messages cannot show the first message of a chat that has no title, so [migrate the old chats](#migrating-to-080).
@@ -65,9 +65,9 @@ const history = await listChatsByUser({ search: 'netflix', select: { title: 1, u
65
65
  In an interactive run the first node, `fast_responder`, writes a title for a chat that has none: at most 50 characters, in the language of the first message. The loop saves it on one line, without tags and cut to 80 characters, and never replaces a title that already exists. If the model returns nothing usable the chat stays without a title and the next message asks again. An autonomous run skips that node, so set the title yourself when you create its chat if you want one.
66
66
 
67
67
  ```typescript
68
- await updateChat({ id: chatId, payload: { title: 'Trip to Lisbon' }, currentUser })
68
+ await updateChat({ id: chatId, payload: { title: 'Trip to Lisbon' }, actor })
69
69
 
70
- await updateChat({ id: chatId, payload: { settings: { notifyOnCompletion: true } }, unset: { title: '' }, currentUser })
70
+ await updateChat({ id: chatId, payload: { settings: { notifyOnCompletion: true } }, unset: { title: '' }, actor })
71
71
  ```
72
72
 
73
73
  The first call renames the chat, and the agent keeps that title from then on. The second removes the title, so the next message gets a new one.
@@ -95,9 +95,9 @@ The changelog also lists two smaller changes of this version: `sanitizeString` n
95
95
  ## Getting one chat
96
96
 
97
97
  ```typescript
98
- const result = await getChatById({ id: chatId, currentUser })
98
+ const result = await getChatById({ id: chatId, actor })
99
99
 
100
- const state = await getChatById({ id: chatId, select: { state: 1 }, currentUser })
100
+ const state = await getChatById({ id: chatId, select: { state: 1 }, actor })
101
101
  ```
102
102
 
103
103
  `select` limits the fields that come back, which is handy for polling the status of a long run.
@@ -105,9 +105,9 @@ const state = await getChatById({ id: chatId, select: { state: 1 }, currentUser
105
105
  ## Creating and updating
106
106
 
107
107
  ```typescript
108
- const created = await createChat({ payload: { settings: { loopName: 'agi' } }, currentUser })
108
+ const created = await createChat({ payload: { settings: { loopName: 'agi' } }, actor })
109
109
 
110
- await updateChat({ id: chatId, payload: { settings: { modelProvider: 'anthropic', modelName: 'claude-haiku-5-5' } }, currentUser })
110
+ await updateChat({ id: chatId, payload: { settings: { modelProvider: 'anthropic', modelName: 'claude-haiku-5-5' } }, actor })
111
111
  ```
112
112
 
113
113
  You rarely need `createChat`: `agent.run` creates the chat when you omit `chatId`.
@@ -115,9 +115,9 @@ You rarely need `createChat`: `agent.run` creates the chat when you omit `chatId
115
115
  ## Deleting a chat
116
116
 
117
117
  ```typescript
118
- await deleteChat({ id: chatId, currentUser })
118
+ await deleteChat({ id: chatId, actor })
119
119
 
120
- await deleteChat({ id: chatId, hardDelete: true, currentUser })
120
+ await deleteChat({ id: chatId, hardDelete: true, actor })
121
121
  ```
122
122
 
123
123
  The first one is a soft delete. A hard delete is for admins only.
@@ -127,7 +127,7 @@ The first one is a soft delete. A hard delete is for admins only.
127
127
  ```typescript
128
128
  import { Agent } from 'openloops/core'
129
129
 
130
- await Agent.interruptExecution(chatId, currentUser)
130
+ await Agent.interruptExecution(chatId, actor)
131
131
  ```
132
132
 
133
133
  See [agent](agent.md#stopping-a-running-turn).
@@ -1,14 +1,13 @@
1
1
  # Configuration
2
2
 
3
- `openloops` reads its configuration from environment variables. Copy `.env.example` and fill in what you use.
3
+ `openloops` reads its configuration from environment variables, through `nanosaas`. Call `configure({ appName: 'openloops' })` once when your process starts (the package never calls it for you): `appName` gives the prefix of the variables below (`OPENLOOPS_`), the default database and the issuer of the tokens. Nothing loads `.env` for you. Copy `.env.example` and fill in what you use.
4
4
 
5
5
  | Variable | Required | What it is for |
6
6
  | --- | --- | --- |
7
7
  | `OPENLOOPS_DB_URI` | yes | MongoDB connection string. |
8
8
  | `OPENLOOPS_DB_NAME` | no | Database name. Defaults to `openloops`. |
9
9
  | `OPENLOOPS_MONGO_MAX_POOL_SIZE` | no | Most connections each process keeps open to MongoDB. Defaults to `3`, which suits serverless functions, where every instance handles one request at a time. Raise it for a long-running server. |
10
- | `SECRET_MANAGER_KEY` | yes | Key used to decrypt values that start with `ENC:`. The library throws when it loads without it. |
11
- | `SECRET_MANAGER_KEY_V<N>` | only if you use `ENC:v<N>:` values | Key of version `N` of the [versioned encrypted values](#encrypted-values). |
10
+ | `OPENLOOPS_ENCRYPTION_KEY_V<N>` | only if you use `ENC:v2:` values | Master key of version `N` of the [encrypted values](#encrypted-values), random and 32 characters or more. |
12
11
  | `ANTHROPIC_API_KEY` | for the default model | API key of the default provider, `anthropic`. |
13
12
  | `OPENAI_API_KEY`, `GEMINI_API_KEY` | for those providers | API keys of the other providers you choose per chat. |
14
13
  | `JWT_SECRET` | for `login` and for event automations | Secret that signs the tokens of the sessions, of the reset of a password and of [event automations](automations.md#the-token). See [authentication](authentication.md). |
@@ -26,33 +25,33 @@
26
25
 
27
26
  ## Encrypted values
28
27
 
29
- Any value can be stored encrypted. It is decrypted when it is read.
30
-
31
- - `ENC:<payload>` is decrypted with `SECRET_MANAGER_KEY`.
32
- - `ENC:v<N>:<payload>` is decrypted with `SECRET_MANAGER_KEY_V<N>`. Versions let you rotate the key: encrypt new values with the next version, keep the old key until nothing uses it, then remove it.
28
+ Any value can be stored encrypted, as `ENC:v2:<key id>:<data>`. It is decrypted when it is read, with the master key named by its key id (`OPENLOOPS_ENCRYPTION_KEY_V<N>`), and only where it was made: the name of the variable and, in a multi tenant runtime, the id of the tenant are part of what authenticates it. Rotate a key by encrypting new values with the next version and keeping the old key until nothing uses it.
33
29
 
34
30
  ```ts
35
- import { SecretManager } from 'openloops/common'
31
+ import { encryptConfigValue, generateEncryptionKey } from 'nanosaas/common'
36
32
 
37
- SecretManager.encrypt('sk-ant-...')
38
- SecretManager.encrypt('sk-ant-...', 2)
33
+ generateEncryptionKey()
34
+ encryptConfigValue('ANTHROPIC_API_KEY', 'sk-ant-...')
35
+ encryptConfigValue('ANTHROPIC_API_KEY', 'sk-ant-...', { tenantId: String(agent._id) })
39
36
  ```
40
37
 
38
+ The earlier format (`ENC:` and `ENC:v1:`) is not read. Migrate once with `reencrypt` of `nanosaas/common`, giving it the function that decrypts the old values. See the documentation of `nanosaas` about encryption.
39
+
41
40
  ## One process, several agents
42
41
 
43
42
  By default the configuration is read from the environment, which is one configuration per process. To serve several agents from the same process, for example one function that runs every agent of a platform, run each request with its own configuration:
44
43
 
45
44
  ```ts
46
- import { runWithConfigs } from 'openloops/common'
45
+ import { runWithTenant } from 'nanosaas/common'
47
46
 
48
- await runWithConfigs(configsOfThisAgent, () => handleRequest(event))
47
+ await runWithTenant(String(agent._id), configsOfThisAgent, () => handleRequest(event))
49
48
  ```
50
49
 
51
- `configsOfThisAgent` is an object with the same names as the variables of this page (`OPENLOOPS_DB_URI`, `OPENLOOPS_DB_NAME`, `JWT_SECRET`, `ANTHROPIC_API_KEY`...), and its values can be encrypted. Everything that runs inside the callback, including what it awaits, reads those values and never the environment, so a name that is missing from the object is empty and does not fall back to the environment. Outside of `runWithConfigs` nothing changes.
50
+ `configsOfThisAgent` is an object with the same names as the variables of this page (`OPENLOOPS_DB_URI`, `OPENLOOPS_DB_NAME`, `JWT_SECRET`, `ANTHROPIC_API_KEY`...), and its values can be encrypted. Everything that runs inside the callback, including what it awaits, reads those values and never the environment, so a name that is missing from the object is empty and does not fall back to the environment. Outside of `runWithTenant` nothing changes.
52
51
 
53
52
  Each agent can use its own database, even in its own cluster: the repositories resolve the database name and the connection on every call, and the connections are shared by connection string. The API key of the provider is sent with each model call, so two agents never use each other's key. See the example [run-agent-multi-tenant](../examples/run-agent/run-agent-multi-tenant.ts).
54
53
 
55
- Pass the configuration of a request to `runWithConfigs` before creating the `Agent` and before resolving the user, and do not keep the result of `secretManager.get` between requests.
54
+ Pass the configuration of a request to `runWithTenant` before creating the `Agent` and before resolving the user, and do not keep the result of `secretManager.get` between requests.
56
55
 
57
56
  ## Which model a chat uses
58
57
 
@@ -100,7 +99,7 @@ Choose the model of a chat when you run it:
100
99
  await agent.run({
101
100
  input: { message: 'hi' },
102
101
  options: { modelProvider: 'anthropic', modelName: 'claude-haiku-5-5' },
103
- currentUser,
102
+ actor,
104
103
  })
105
104
  ```
106
105
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  ```typescript
19
19
  import * as Sentry from '@sentry/node'
20
- import { setErrorReporter } from 'openloops/common'
20
+ import { setErrorReporter } from 'nanosaas/common'
21
21
 
22
22
  Sentry.init({ dsn: process.env.MY_SENTRY_DSN })
23
23
 
@@ -49,7 +49,7 @@ import { AgiLoop } from 'openloops/loops'
49
49
 
50
50
  const agent = new Agent({ loop: new AgiLoop() })
51
51
 
52
- const result = await agent.run({ input: { message: 'hi, how are you?' }, currentUser })
52
+ const result = await agent.run({ input: { message: 'hi, how are you?' }, actor })
53
53
  ```
54
54
 
55
55
  The first line is the file that declares the reporter. If this run fails, the reporter is called without anything else in this code. The [example](../examples/errors/error-reporting.ts) has the declaration at the top and the code that runs below it, in one file.
@@ -111,7 +111,7 @@ What is not reported are the errors that the use cases throw, such as a missing
111
111
 
112
112
  ```typescript
113
113
  try {
114
- await updateChat({ id, payload: { title }, currentUser })
114
+ await updateChat({ id, payload: { title }, actor })
115
115
  } catch (error) {
116
116
  res.status(error.statusCode ?? 500).json({ message: error.errorMessage })
117
117
  }
@@ -154,7 +154,7 @@ The simple way is a file of its own that declares the reporter, `error-reporting
154
154
 
155
155
  ```typescript
156
156
  import * as Sentry from '@sentry/node'
157
- import { setErrorReporter } from 'openloops/common'
157
+ import { setErrorReporter } from 'nanosaas/common'
158
158
 
159
159
  Sentry.init({ dsn: process.env.MY_SENTRY_DSN })
160
160
 
@@ -176,7 +176,7 @@ import './error-reporting-lambda'
176
176
  import { listChatsByUser } from 'openloops/chats'
177
177
 
178
178
  export const handler = async (event: any) => {
179
- const result = await listChatsByUser({ options: { page: 1, limit: 10 }, currentUser })
179
+ const result = await listChatsByUser({ options: { page: 1, limit: 10 }, actor })
180
180
 
181
181
  return { statusCode: 200, body: JSON.stringify(result) }
182
182
  }
@@ -197,7 +197,7 @@ beforeEach(() => setErrorReporter(reporter))
197
197
  afterEach(() => setErrorReporter(undefined))
198
198
 
199
199
  it('reports a failed run', async () => {
200
- await agent.run({ input: { message: 'hi' }, currentUser })
200
+ await agent.run({ input: { message: 'hi' }, actor })
201
201
 
202
202
  expect(reporter).toHaveBeenCalledWith(expect.any(Error), expect.objectContaining({ source: 'agent' }))
203
203
  })
@@ -57,7 +57,7 @@ const noSpam = new Guard({
57
57
  | `type` | Where it runs. Only `'input'` exists: it runs on the user message before the model. |
58
58
  | `reply` | What the user receives when the guard blocks. |
59
59
  | `ref` | Reference shown to the user and written to the traces. Derived from `name` when omitted. |
60
- | `handler` | Receives `{ message, chat, currentUser, currentSession, skillParams, logger }` and returns `{ passed, reason? }`. May be async. |
60
+ | `handler` | Receives `{ message, chat, actor, requestContext, skillParams, logger }` and returns `{ passed, reason? }`. May be async. |
61
61
 
62
62
  ## What happens when a guard blocks
63
63
 
@@ -6,7 +6,7 @@ This page is for whoever builds the backend that uses `openloops`, a person or a
6
6
 
7
7
  `openloops` is a harness for agents, and it gives you a set of use cases that read and write MongoDB. It does **not** include an HTTP server, routes, controllers, sessions or authorization. Your backend owns those, and calls `openloops` from its own handlers.
8
8
 
9
- Requirements: Node 22 or newer and a MongoDB database. Install it with `npm install openloops` or `yarn add openloops`, set the environment variables of [configuration](configuration.md), and import from the subpaths (`openloops/core`, `openloops/mcps`, and so on).
9
+ Requirements: Node 22 or newer and a MongoDB database. Install it with `npm install openloops nanosaas` or `yarn add openloops nanosaas` (`nanosaas` is a peer dependency, at the exact version that `openloops` asks for), call `configure({ appName: 'openloops' })` once when your process starts, set the environment variables of [configuration](configuration.md), and import from the subpaths (`openloops/core`, `openloops/mcps`, and so on). Users, login and tokens come from `nanosaas` (see [authentication](authentication.md)).
10
10
 
11
11
  ## Tell your coding agent where this is
12
12
 
@@ -21,18 +21,18 @@ The package has no controllers: the authorization of every endpoint is the respo
21
21
 
22
22
  ## The rule that matters most: always pass the user
23
23
 
24
- The use cases check who owns every record, in the repository, with the `currentUser` you pass. Read [authorization](authorization.md) once.
24
+ The use cases check who owns every record, in the repository, with the `actor` you pass. Read [authorization](authorization.md) once.
25
25
 
26
26
  - A record that is not the user's is answered as if it did not exist: a 404 `HttpError` from the functions that update or delete, and `null` from the getters, `getChatById` included.
27
- - A call without `currentUser` fails with 401. Your endpoint is still the one that authenticates the request and builds the `currentUser` from the token.
28
- - An administrator acts on the records of other users only with `scope: Scope.asAdmin(currentUser)`, and a worker or a webhook with `Scope.system('reason')`. Never build a scope from a value that comes from a request.
27
+ - A call without `actor` fails with 401. Your endpoint is still the one that authenticates the request and builds the `actor` from the token.
28
+ - An administrator acts on the records of other users only with `scope: Scope.asAdmin(actor)`, and a worker or a webhook with `Scope.system('reason')`. Never build a scope from a value that comes from a request.
29
29
 
30
30
  ## Which endpoint calls what
31
31
 
32
32
  | Your endpoint | `openloops` call |
33
33
  | --- | --- |
34
- | Send a message | `new Agent({ loop, tools, guards }).run({ input: { message, chatId? }, currentUser })` |
35
- | Stop a running message | `Agent.interruptExecution(chatId, currentUser)` |
34
+ | Send a message | `new Agent({ loop, tools, guards }).run({ input: { message, chatId? }, actor })` |
35
+ | Stop a running message | `Agent.interruptExecution(chatId, actor)` |
36
36
  | List, read, delete chats | `listChatsByUser` (with `executionMode` to separate interactive from autonomous, `search` for the title and the messages, and `select` for a light history list), `getChatById`, `updateChat` to rename a chat with `title`, `deleteChat` |
37
37
  | Poll the state of a chat | `getChatById({ id, select: { state: 1 } })` |
38
38
  | Manage MCP servers | `createMcpServer`, `listMcpServersByUser`, `getMcpServerById`, `updateMcpServer`, `deleteMcpServer`, `verifyMcpServerConnection` |
@@ -43,7 +43,7 @@ The use cases check who owns every record, in the repository, with the `currentU
43
43
  | Receive an event from another system | `receiveAutomationEvent`, public endpoint, authenticated only by the token of the automation |
44
44
  | Tokens of an event automation | `issueAutomationEventToken`, `revokeAutomationEventToken`, `rotateAutomationEventTokens` |
45
45
  | History of runs | `listAutomationRunsByAutomation`, `listAutomationRunsByUser` |
46
- | "Run now" | `runner.runNow({ automationId, currentUser })` |
46
+ | "Run now" | `runner.runNow({ automationId, actor })` |
47
47
  | Sign in, sessions, users | `login`, `refreshSession`, `logout`, `issuePasswordResetToken`, `resetPassword`, `changePassword`, `createUser`, `getUserById`, `updateUser`, `deleteUser` |
48
48
 
49
49
  ## Running the agent for a message
@@ -51,10 +51,10 @@ The use cases check who owns every record, in the repository, with the `currentU
51
51
  ```typescript
52
52
  import { Agent } from 'openloops/core'
53
53
  import { AgiLoop } from 'openloops/loops'
54
- import { CurrentUser } from 'openloops/base'
54
+ import { Actor } from 'nanosaas/common'
55
55
  import { inputGuards } from 'openloops/guardrails'
56
56
 
57
- const currentUser = await CurrentUser.asyncFromDB(userIdFromYourAuth)
57
+ const actor = Actor.fromClaims({ userId: userIdFromYourAuth })
58
58
 
59
59
  const agent = new Agent({
60
60
  loop: new AgiLoop(),
@@ -64,7 +64,7 @@ const agent = new Agent({
64
64
 
65
65
  const { data, error } = await agent.run({
66
66
  input: { message, chatId },
67
- currentUser,
67
+ actor,
68
68
  })
69
69
  ```
70
70
 
@@ -103,7 +103,7 @@ Your users register their own servers, and every server must be approved before
103
103
  Three parts, as described in [automations](automations.md):
104
104
 
105
105
  1. Endpoints that create and manage automations and read their runs, from the table above.
106
- 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
+ 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 `Actor`.
107
107
  3. A worker process that you start once, with the options of the agent your automations should use:
108
108
 
109
109
  ```typescript
@@ -124,7 +124,7 @@ runner.start()
124
124
 
125
125
  ## Security checklist
126
126
 
127
- - Pass the `currentUser` of the request to every call, and build it from the verified token.
127
+ - Pass the `actor` of the request to every call, and build it from the verified token.
128
128
  - Never take a `scope` from the body or the query of a request.
129
129
  - Mask `headers` and `history` of MCP servers.
130
130
  - Add input guards for what your product must never receive, such as card numbers.
package/docs/loops.md CHANGED
@@ -71,8 +71,8 @@ The first argument of a node is everything it needs to read:
71
71
 
72
72
  ```typescript
73
73
  ctx.currentMessage
74
- ctx.currentUser
75
- ctx.currentSession
74
+ ctx.actor
75
+ ctx.requestContext
76
76
  ctx.identity
77
77
  ctx.chat
78
78
  ctx.task
@@ -29,7 +29,7 @@ const result = await createMcpServer({
29
29
  Authorization: 'Bearer ...',
30
30
  },
31
31
  },
32
- currentUser,
32
+ actor,
33
33
  })
34
34
  ```
35
35
 
@@ -60,10 +60,10 @@ The latest manifest is `history[0]`. The approved manifest is the entry of `hist
60
60
  ```typescript
61
61
  const page = await listMcpServersByUser({
62
62
  options: { page: 1, limit: 10 },
63
- currentUser,
63
+ actor,
64
64
  })
65
65
 
66
- const all = await listAllMcpServersByUser({ currentUser })
66
+ const all = await listAllMcpServersByUser({ actor })
67
67
  ```
68
68
 
69
69
  `listMcpServersByUser` is paginated (page 1, 10 per page by default) and sorted by last update, newest first. Use it for a management screen.
@@ -73,7 +73,7 @@ const all = await listAllMcpServersByUser({ currentUser })
73
73
  ## Getting one by id
74
74
 
75
75
  ```typescript
76
- const result = await getMcpServerById({ id: mcpServerId, currentUser })
76
+ const result = await getMcpServerById({ id: mcpServerId, actor })
77
77
  ```
78
78
 
79
79
  ## Updating a server
@@ -86,7 +86,7 @@ const result = await updateMcpServer({
86
86
  headers: { Authorization: 'Bearer <new-token>' },
87
87
  __v: current.__v,
88
88
  },
89
- currentUser,
89
+ actor,
90
90
  })
91
91
  ```
92
92
 
@@ -98,9 +98,9 @@ const result = await updateMcpServer({
98
98
  ## Deleting a server
99
99
 
100
100
  ```typescript
101
- await deleteMcpServer({ id: mcpServerId, currentUser })
101
+ await deleteMcpServer({ id: mcpServerId, actor })
102
102
 
103
- await deleteMcpServer({ id: mcpServerId, hardDelete: true, currentUser })
103
+ await deleteMcpServer({ id: mcpServerId, hardDelete: true, actor })
104
104
  ```
105
105
 
106
106
  The first one is a soft delete. A hard delete is for admins only.
@@ -108,7 +108,7 @@ The first one is a soft delete. A hard delete is for admins only.
108
108
  ## Checking the connection
109
109
 
110
110
  ```typescript
111
- const result = await verifyMcpServerConnection({ id: mcpServerId, currentUser })
111
+ const result = await verifyMcpServerConnection({ id: mcpServerId, actor })
112
112
  ```
113
113
 
114
114
  Connects, reads the manifest and stores it in `history` if it is new, or stores a sanitized error and `status: 'error'`. The agent calls it by itself when it sees that a server changed. You can call it from a "test connection" button.
@@ -120,10 +120,10 @@ await decideMcpServerTrust({
120
120
  id: mcpServerId,
121
121
  decision: 'approve',
122
122
  manifestHash: result.history[0].hash,
123
- currentUser,
123
+ actor,
124
124
  })
125
125
 
126
- await decideMcpServerTrust({ id: mcpServerId, decision: 'block', currentUser })
126
+ await decideMcpServerTrust({ id: mcpServerId, decision: 'block', actor })
127
127
  ```
128
128
 
129
129
  - Approving requires the hash of the manifest the user reviewed, and it must be the latest one in `history`. If the server changed since the user looked at it, the call fails and the user has to review again.
@@ -168,7 +168,7 @@ agent.addInternalMcp({ name: 'other', url: 'https://other.example.com/mcp' })
168
168
 
169
169
  await agent.run({
170
170
  input: { message: 'how much did I spend on food this month?' },
171
- currentUser,
171
+ actor,
172
172
  mcpTokens: { budget: sessionToken },
173
173
  })
174
174
  ```
@@ -213,7 +213,7 @@ const agent = new Agent({
213
213
 
214
214
  await agent.run({
215
215
  input: { message: 'summarize my week' },
216
- currentUser,
216
+ actor,
217
217
  mcpTokens: { budget: sessionToken, crm: sessionToken },
218
218
  })
219
219
  ```
@@ -248,13 +248,13 @@ const mcp = await createInternalMcp({
248
248
  url: 'https://api.example.com/mcp',
249
249
  headers: { Authorization: 'Bearer {{token}}' },
250
250
  },
251
- currentUser: admin,
251
+ actor: admin,
252
252
  })
253
253
 
254
- await updateInternalMcp({ id: mcp._id, payload: { enabled: false, __v: mcp.__v }, currentUser: admin })
254
+ await updateInternalMcp({ id: mcp._id, payload: { enabled: false, __v: mcp.__v }, actor: admin })
255
255
  ```
256
256
 
257
- - Every function needs an admin as `currentUser` and answers 403 otherwise. The sub-route separates the code, the permission is what protects it.
257
+ - Every function needs an admin as `actor` and answers 403 otherwise. The sub-route separates the code, the permission is what protects it.
258
258
  - `name` and `url` are required, `type` is always `http`, `environment` is optional and `enabled` defaults to `true`. A disabled server is not loaded. The name must be unique among the internal servers (409).
259
259
  - A header with `{{token}}` uses `mcpTokens[name]` of the run. The stored servers have no `autonomousToken`, which exists only in the servers declared in code, so in an automation they are available only when the token is written in the header (for example `Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJjcm0uZXhhbXBsZS5jb20iLCJzdWIiOiJzdmMtb3Blbmxvb3BzLWNybSIsImF1ZCI6ImNybS1tY3AiLCJzY29wZSI6ImNybTpyZWFkIGNybTp3cml0ZSIsImlhdCI6MTc2MjIxNDQwMCwiZXhwIjoxNzkzNzUwNDAwfQ.YCtd8mv7RZpaZb3Z1aSl25MGP2QRWHc8RtA82MJOH7U`), which is sent as it is in every run.
260
260
  - Deleting is permanent. Internal servers have no owner, so they are not listed to any user.
package/docs/skills.md CHANGED
@@ -65,7 +65,7 @@ if (result.can_answer) {
65
65
  }
66
66
  ```
67
67
 
68
- `ctx.skillParams` already carries the provider and model chosen for the chat, `sessionId`, `answerId`, the user's message, `currentUser`, `currentSession` and the current chat. You normally only add `contextInjection`.
68
+ `ctx.skillParams` already carries the provider and model chosen for the chat, `sessionId`, `answerId`, the user's message, `actor`, `requestContext` and the current chat. You normally only add `contextInjection`.
69
69
 
70
70
  | Run option | What it does |
71
71
  | --- | --- |
package/docs/tools.md CHANGED
@@ -29,7 +29,7 @@ export const greetUserTool = new Tool({
29
29
  required: ['firstName'],
30
30
  },
31
31
  handler: async (params: Params): Promise<Output> => {
32
- const { currentUser, sessionId, answerId, firstName } = params
32
+ const { actor, sessionId, answerId, firstName } = params
33
33
  return { data: { greeting: `Hi ${firstName}` } }
34
34
  },
35
35
  })
@@ -43,7 +43,7 @@ export const greetUserTool = new Tool({
43
43
  | `destructive` | `true` makes the agent ask the user to confirm before it runs. Defaults to `false`, so set it explicitly for anything that changes or deletes data. |
44
44
  | `handler` | Receives the arguments plus `BaseParams` and returns `{ data }`. |
45
45
 
46
- `BaseParams` (`currentUser`, `sessionId`, `answerId`) is always merged into the arguments your handler receives. Destructure and ignore the ones you don't need.
46
+ `BaseParams` (`actor`, `sessionId`, `answerId`) is always merged into the arguments your handler receives. Destructure and ignore the ones you don't need.
47
47
 
48
48
  A `Tool` instance is shared. Never write to `this` inside a handler. Everything that varies between calls comes in through `params`.
49
49