solace-agent-mesh 1.6.2__py3-none-any.whl → 1.7.0__py3-none-any.whl

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.

Potentially problematic release.


This version of solace-agent-mesh might be problematic. Click here for more details.

Files changed (245) hide show
  1. solace_agent_mesh/agent/adk/adk_llm.txt +12 -18
  2. solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
  3. solace_agent_mesh/agent/adk/callbacks.py +138 -20
  4. solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +2 -0
  5. solace_agent_mesh/agent/adk/models/lite_llm.py +38 -5
  6. solace_agent_mesh/agent/adk/models/models_llm.txt +82 -35
  7. solace_agent_mesh/agent/adk/runner.py +9 -0
  8. solace_agent_mesh/agent/adk/services.py +3 -3
  9. solace_agent_mesh/agent/adk/stream_parser.py +6 -1
  10. solace_agent_mesh/agent/adk/tool_wrapper.py +3 -0
  11. solace_agent_mesh/agent/agent_llm.txt +61 -70
  12. solace_agent_mesh/agent/protocol/event_handlers.py +29 -1
  13. solace_agent_mesh/agent/protocol/protocol_llm.txt +1 -1
  14. solace_agent_mesh/agent/proxies/a2a/a2a_llm.txt +190 -0
  15. solace_agent_mesh/agent/proxies/base/base_llm.txt +148 -0
  16. solace_agent_mesh/agent/proxies/proxies_llm.txt +283 -0
  17. solace_agent_mesh/agent/sac/app.py +22 -0
  18. solace_agent_mesh/agent/sac/component.py +76 -40
  19. solace_agent_mesh/agent/sac/sac_llm.txt +1 -1
  20. solace_agent_mesh/agent/sac/task_execution_context.py +21 -0
  21. solace_agent_mesh/agent/testing/testing_llm.txt +2 -1
  22. solace_agent_mesh/agent/tools/builtin_artifact_tools.py +13 -148
  23. solace_agent_mesh/agent/tools/dynamic_tool.py +2 -0
  24. solace_agent_mesh/agent/tools/tools_llm.txt +93 -80
  25. solace_agent_mesh/agent/tools/tools_llm_detail.txt +3 -2
  26. solace_agent_mesh/agent/utils/artifact_helpers.py +4 -0
  27. solace_agent_mesh/agent/utils/utils_llm.txt +16 -2
  28. solace_agent_mesh/assets/docs/404.html +3 -3
  29. solace_agent_mesh/assets/docs/assets/js/05749d90.c70b2be9.js +1 -0
  30. solace_agent_mesh/assets/docs/assets/js/15ba94aa.92fea363.js +1 -0
  31. solace_agent_mesh/assets/docs/assets/js/15e40e79.36003774.js +1 -0
  32. solace_agent_mesh/assets/docs/assets/js/2987107d.a80604f9.js +1 -0
  33. solace_agent_mesh/assets/docs/assets/js/3ac1795d.e4870a49.js +1 -0
  34. solace_agent_mesh/assets/docs/assets/js/3ff0015d.b63ee53a.js +1 -0
  35. solace_agent_mesh/assets/docs/assets/js/547e15cc.2f7790c1.js +1 -0
  36. solace_agent_mesh/assets/docs/assets/js/5c2bd65f.45b32c2b.js +1 -0
  37. solace_agent_mesh/assets/docs/assets/js/631738c7.fa471607.js +1 -0
  38. solace_agent_mesh/assets/docs/assets/js/64195356.c498c4d0.js +1 -0
  39. solace_agent_mesh/assets/docs/assets/js/6a520c9d.b6e3f2ce.js +1 -0
  40. solace_agent_mesh/assets/docs/assets/js/6ad8f0bd.a5b36a60.js +1 -0
  41. solace_agent_mesh/assets/docs/assets/js/71da7b71.374b9d54.js +1 -0
  42. solace_agent_mesh/assets/docs/assets/js/8024126c.fa0e7186.js +1 -0
  43. solace_agent_mesh/assets/docs/assets/js/8b032486.91a91afc.js +1 -0
  44. solace_agent_mesh/assets/docs/assets/js/94e8668d.09ed9234.js +1 -0
  45. solace_agent_mesh/assets/docs/assets/js/{ab9708a8.3e6dd091.js → ab9708a8.245ae0ef.js} +1 -1
  46. solace_agent_mesh/assets/docs/assets/js/ad87452a.9d73dad6.js +1 -0
  47. solace_agent_mesh/assets/docs/assets/js/cbe2e9ea.f902fad8.js +1 -0
  48. solace_agent_mesh/assets/docs/assets/js/da0b5bad.b62f7b08.js +1 -0
  49. solace_agent_mesh/assets/docs/assets/js/db5d6442.3daf1696.js +1 -0
  50. solace_agent_mesh/assets/docs/assets/js/dd817ffc.c37a755e.js +1 -0
  51. solace_agent_mesh/assets/docs/assets/js/dd81e2b8.b682e9c2.js +1 -0
  52. solace_agent_mesh/assets/docs/assets/js/de915948.44a432bc.js +1 -0
  53. solace_agent_mesh/assets/docs/assets/js/e04b235d.c9c50c7b.js +1 -0
  54. solace_agent_mesh/assets/docs/assets/js/e3d9abda.d11c67a7.js +1 -0
  55. solace_agent_mesh/assets/docs/assets/js/{e6f9706b.e74a984d.js → e6f9706b.045d0fa1.js} +1 -1
  56. solace_agent_mesh/assets/docs/assets/js/e92d0134.3bda61dd.js +1 -0
  57. solace_agent_mesh/assets/docs/assets/js/f284c35a.5099c51e.js +1 -0
  58. solace_agent_mesh/assets/docs/assets/js/ff4d71f2.74710fc1.js +1 -0
  59. solace_agent_mesh/assets/docs/assets/js/main.e6488e8b.js +2 -0
  60. solace_agent_mesh/assets/docs/assets/js/runtime~main.d9606d6a.js +1 -0
  61. solace_agent_mesh/assets/docs/docs/documentation/components/agents/index.html +4 -4
  62. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/artifact-management/index.html +4 -4
  63. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/audio-tools/index.html +4 -4
  64. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/data-analysis-tools/index.html +4 -4
  65. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/embeds/index.html +18 -4
  66. solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/index.html +4 -4
  67. solace_agent_mesh/assets/docs/docs/documentation/components/cli/index.html +4 -4
  68. solace_agent_mesh/assets/docs/docs/documentation/components/gateways/index.html +5 -5
  69. solace_agent_mesh/assets/docs/docs/documentation/components/index.html +4 -4
  70. solace_agent_mesh/assets/docs/docs/documentation/components/orchestrator/index.html +4 -4
  71. solace_agent_mesh/assets/docs/docs/documentation/components/plugins/index.html +4 -4
  72. solace_agent_mesh/assets/docs/docs/documentation/components/projects/index.html +196 -0
  73. solace_agent_mesh/assets/docs/docs/documentation/components/proxies/index.html +4 -4
  74. solace_agent_mesh/assets/docs/docs/documentation/deploying/debugging/index.html +5 -5
  75. solace_agent_mesh/assets/docs/docs/documentation/deploying/deployment-options/index.html +6 -7
  76. solace_agent_mesh/assets/docs/docs/documentation/deploying/index.html +4 -4
  77. solace_agent_mesh/assets/docs/docs/documentation/deploying/kubernetes-deployment/index.html +47 -0
  78. solace_agent_mesh/assets/docs/docs/documentation/deploying/logging/index.html +4 -4
  79. solace_agent_mesh/assets/docs/docs/documentation/deploying/observability/index.html +4 -4
  80. solace_agent_mesh/assets/docs/docs/documentation/developing/create-agents/index.html +4 -4
  81. solace_agent_mesh/assets/docs/docs/documentation/developing/create-gateways/index.html +160 -169
  82. solace_agent_mesh/assets/docs/docs/documentation/developing/creating-python-tools/index.html +4 -4
  83. solace_agent_mesh/assets/docs/docs/documentation/developing/creating-service-providers/index.html +4 -4
  84. solace_agent_mesh/assets/docs/docs/documentation/developing/evaluations/index.html +4 -4
  85. solace_agent_mesh/assets/docs/docs/documentation/developing/index.html +4 -4
  86. solace_agent_mesh/assets/docs/docs/documentation/developing/structure/index.html +4 -4
  87. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/bedrock-agents/index.html +4 -4
  88. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/custom-agent/index.html +5 -5
  89. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/event-mesh-gateway/index.html +4 -4
  90. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mcp-integration/index.html +4 -4
  91. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mongodb-integration/index.html +4 -4
  92. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rag-integration/index.html +4 -4
  93. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rest-gateway/index.html +4 -4
  94. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/slack-integration/index.html +4 -4
  95. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/sql-database/index.html +4 -4
  96. solace_agent_mesh/assets/docs/docs/documentation/enterprise/agent-builder/index.html +59 -0
  97. solace_agent_mesh/assets/docs/docs/documentation/enterprise/connectors/index.html +62 -0
  98. solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +10 -6
  99. solace_agent_mesh/assets/docs/docs/documentation/enterprise/installation/index.html +4 -4
  100. solace_agent_mesh/assets/docs/docs/documentation/enterprise/rbac-setup-guide/index.html +24 -29
  101. solace_agent_mesh/assets/docs/docs/documentation/enterprise/secure-user-delegated-access/index.html +440 -0
  102. solace_agent_mesh/assets/docs/docs/documentation/enterprise/single-sign-on/index.html +27 -4
  103. solace_agent_mesh/assets/docs/docs/documentation/enterprise/wheel-installation/index.html +62 -0
  104. solace_agent_mesh/assets/docs/docs/documentation/getting-started/architecture/index.html +4 -4
  105. solace_agent_mesh/assets/docs/docs/documentation/getting-started/index.html +5 -4
  106. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
  107. solace_agent_mesh/assets/docs/docs/documentation/getting-started/try-agent-mesh/index.html +3 -3
  108. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/artifact-storage/index.html +290 -0
  109. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/configurations/index.html +9 -9
  110. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/index.html +4 -4
  111. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/installation/index.html +4 -4
  112. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/large_language_models/index.html +4 -4
  113. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/run-project/index.html +4 -4
  114. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/session-storage/index.html +251 -0
  115. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/user-feedback/index.html +88 -0
  116. solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
  117. solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-technical-migration-map/index.html +3 -3
  118. solace_agent_mesh/assets/docs/lunr-index-1762189824009.json +1 -0
  119. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  120. solace_agent_mesh/assets/docs/search-doc-1762189824009.json +1 -0
  121. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  122. solace_agent_mesh/assets/docs/sitemap.xml +1 -1
  123. solace_agent_mesh/cli/__init__.py +1 -1
  124. solace_agent_mesh/cli/commands/docs_cmd.py +4 -1
  125. solace_agent_mesh/cli/commands/init_cmd/orchestrator_step.py +1 -1
  126. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-D4_RMYRh.js → authCallback-tcIFZLis.js} +1 -1
  127. solace_agent_mesh/client/webui/frontend/static/assets/{client-UZ3qU6Bq.js → client-CRYdKo2Q.js} +3 -3
  128. solace_agent_mesh/client/webui/frontend/static/assets/main-CojeY_1w.css +1 -0
  129. solace_agent_mesh/client/webui/frontend/static/assets/main-ILja9MCG.js +353 -0
  130. solace_agent_mesh/client/webui/frontend/static/assets/vendor-CINwxvwV.js +470 -0
  131. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
  132. solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
  133. solace_agent_mesh/common/a2a/a2a_llm.txt +13 -20
  134. solace_agent_mesh/common/a2a/protocol.py +5 -0
  135. solace_agent_mesh/common/a2a/types.py +1 -0
  136. solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +49 -11
  137. solace_agent_mesh/common/a2a_spec/schemas/artifact_creation_progress.json +23 -6
  138. solace_agent_mesh/common/a2a_spec/schemas/feedback_event.json +51 -0
  139. solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +26 -9
  140. solace_agent_mesh/common/common_llm.txt +13 -34
  141. solace_agent_mesh/common/data_parts.py +20 -4
  142. solace_agent_mesh/common/middleware/middleware_llm.txt +1 -1
  143. solace_agent_mesh/common/sac/sac_llm.txt +1 -1
  144. solace_agent_mesh/common/sam_events/sam_events_llm.txt +1 -1
  145. solace_agent_mesh/common/services/employee_service.py +1 -1
  146. solace_agent_mesh/common/services/providers/providers_llm.txt +3 -2
  147. solace_agent_mesh/common/services/services_llm.txt +9 -4
  148. solace_agent_mesh/common/utils/embeds/constants.py +1 -0
  149. solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
  150. solace_agent_mesh/common/utils/embeds/modifiers.py +2 -1
  151. solace_agent_mesh/common/utils/embeds/resolver.py +58 -6
  152. solace_agent_mesh/common/utils/embeds/types.py +8 -0
  153. solace_agent_mesh/common/utils/utils_llm.txt +5 -6
  154. solace_agent_mesh/core_a2a/core_a2a_llm.txt +1 -1
  155. solace_agent_mesh/gateway/adapter/__init__.py +1 -0
  156. solace_agent_mesh/gateway/adapter/base.py +143 -0
  157. solace_agent_mesh/gateway/adapter/types.py +221 -0
  158. solace_agent_mesh/gateway/base/app.py +29 -2
  159. solace_agent_mesh/gateway/base/base_llm.txt +10 -8
  160. solace_agent_mesh/gateway/base/component.py +573 -142
  161. solace_agent_mesh/gateway/gateway_llm.txt +55 -59
  162. solace_agent_mesh/gateway/generic/__init__.py +1 -0
  163. solace_agent_mesh/gateway/generic/app.py +50 -0
  164. solace_agent_mesh/gateway/generic/component.py +650 -0
  165. solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +99 -49
  166. solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_fulltext_search_indexes.py +92 -0
  167. solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_project_users_table.py +72 -0
  168. solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_soft_delete_and_search.py +150 -0
  169. solace_agent_mesh/gateway/http_sse/alembic/versions/20251024_add_default_agent_to_projects.py +26 -0
  170. solace_agent_mesh/gateway/http_sse/alembic/versions/20251024_add_projects_table.py +135 -0
  171. solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +26 -20
  172. solace_agent_mesh/gateway/http_sse/app.py +19 -14
  173. solace_agent_mesh/gateway/http_sse/component.py +150 -118
  174. solace_agent_mesh/gateway/http_sse/components/components_llm.txt +1 -1
  175. solace_agent_mesh/gateway/http_sse/dependencies.py +21 -3
  176. solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +8 -8
  177. solace_agent_mesh/gateway/http_sse/main.py +55 -14
  178. solace_agent_mesh/gateway/http_sse/repository/__init__.py +19 -1
  179. solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +56 -98
  180. solace_agent_mesh/gateway/http_sse/repository/entities/project.py +81 -0
  181. solace_agent_mesh/gateway/http_sse/repository/entities/project_user.py +47 -0
  182. solace_agent_mesh/gateway/http_sse/repository/entities/session.py +23 -1
  183. solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +47 -0
  184. solace_agent_mesh/gateway/http_sse/repository/interfaces.py +112 -4
  185. solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -1
  186. solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +51 -60
  187. solace_agent_mesh/gateway/http_sse/repository/models/project_model.py +51 -0
  188. solace_agent_mesh/gateway/http_sse/repository/models/project_user_model.py +75 -0
  189. solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +7 -1
  190. solace_agent_mesh/gateway/http_sse/repository/project_repository.py +172 -0
  191. solace_agent_mesh/gateway/http_sse/repository/project_user_repository.py +186 -0
  192. solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +125 -157
  193. solace_agent_mesh/gateway/http_sse/repository/session_repository.py +269 -8
  194. solace_agent_mesh/gateway/http_sse/routers/artifacts.py +143 -51
  195. solace_agent_mesh/gateway/http_sse/routers/config.py +69 -0
  196. solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +198 -94
  197. solace_agent_mesh/gateway/http_sse/routers/dto/requests/project_requests.py +48 -0
  198. solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +68 -18
  199. solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +13 -0
  200. solace_agent_mesh/gateway/http_sse/routers/dto/responses/project_responses.py +30 -0
  201. solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +51 -35
  202. solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +2 -0
  203. solace_agent_mesh/gateway/http_sse/routers/feedback.py +133 -2
  204. solace_agent_mesh/gateway/http_sse/routers/projects.py +542 -0
  205. solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +9 -11
  206. solace_agent_mesh/gateway/http_sse/routers/sessions.py +154 -3
  207. solace_agent_mesh/gateway/http_sse/routers/tasks.py +296 -4
  208. solace_agent_mesh/gateway/http_sse/services/project_service.py +403 -0
  209. solace_agent_mesh/gateway/http_sse/services/services_llm.txt +16 -10
  210. solace_agent_mesh/gateway/http_sse/services/session_service.py +178 -6
  211. solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +2 -3
  212. solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +48 -14
  213. solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
  214. {solace_agent_mesh-1.6.2.dist-info → solace_agent_mesh-1.7.0.dist-info}/METADATA +3 -5
  215. {solace_agent_mesh-1.6.2.dist-info → solace_agent_mesh-1.7.0.dist-info}/RECORD +219 -176
  216. solace_agent_mesh/assets/docs/assets/js/15ba94aa.932dd2db.js +0 -1
  217. solace_agent_mesh/assets/docs/assets/js/3ac1795d.76654dd9.js +0 -1
  218. solace_agent_mesh/assets/docs/assets/js/3ff0015d.2be20244.js +0 -1
  219. solace_agent_mesh/assets/docs/assets/js/547e15cc.2cbb060a.js +0 -1
  220. solace_agent_mesh/assets/docs/assets/js/5c2bd65f.eda4bcb2.js +0 -1
  221. solace_agent_mesh/assets/docs/assets/js/631738c7.7c4594c9.js +0 -1
  222. solace_agent_mesh/assets/docs/assets/js/6a520c9d.ba015d81.js +0 -1
  223. solace_agent_mesh/assets/docs/assets/js/6ad8f0bd.f4b15f3b.js +0 -1
  224. solace_agent_mesh/assets/docs/assets/js/71da7b71.ddbdfbe2.js +0 -1
  225. solace_agent_mesh/assets/docs/assets/js/8024126c.56e59919.js +0 -1
  226. solace_agent_mesh/assets/docs/assets/js/94e8668d.b5ddb7a1.js +0 -1
  227. solace_agent_mesh/assets/docs/assets/js/da0b5bad.d08a9466.js +0 -1
  228. solace_agent_mesh/assets/docs/assets/js/dd817ffc.0aa9630a.js +0 -1
  229. solace_agent_mesh/assets/docs/assets/js/dd81e2b8.d590bc9e.js +0 -1
  230. solace_agent_mesh/assets/docs/assets/js/de915948.27d6b065.js +0 -1
  231. solace_agent_mesh/assets/docs/assets/js/e3d9abda.6b9493d0.js +0 -1
  232. solace_agent_mesh/assets/docs/assets/js/e92d0134.4f395c6b.js +0 -1
  233. solace_agent_mesh/assets/docs/assets/js/f284c35a.720d2ef2.js +0 -1
  234. solace_agent_mesh/assets/docs/assets/js/ff4d71f2.15b02f97.js +0 -1
  235. solace_agent_mesh/assets/docs/assets/js/main.d1643f0b.js +0 -2
  236. solace_agent_mesh/assets/docs/assets/js/runtime~main.97f920d4.js +0 -1
  237. solace_agent_mesh/assets/docs/lunr-index-1761663789856.json +0 -1
  238. solace_agent_mesh/assets/docs/search-doc-1761663789856.json +0 -1
  239. solace_agent_mesh/client/webui/frontend/static/assets/main--3yJYl7S.css +0 -1
  240. solace_agent_mesh/client/webui/frontend/static/assets/main-DojKHS49.js +0 -342
  241. solace_agent_mesh/client/webui/frontend/static/assets/vendor-DSqhjwq_.js +0 -405
  242. /solace_agent_mesh/assets/docs/assets/js/{main.d1643f0b.js.LICENSE.txt → main.e6488e8b.js.LICENSE.txt} +0 -0
  243. {solace_agent_mesh-1.6.2.dist-info → solace_agent_mesh-1.7.0.dist-info}/WHEEL +0 -0
  244. {solace_agent_mesh-1.6.2.dist-info → solace_agent_mesh-1.7.0.dist-info}/entry_points.txt +0 -0
  245. {solace_agent_mesh-1.6.2.dist-info → solace_agent_mesh-1.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,186 @@
1
+ """
2
+ Repository implementation for project user access data operations.
3
+ """
4
+ from typing import List, Optional
5
+ import uuid
6
+
7
+ from sqlalchemy.orm import Session as DBSession
8
+
9
+ from .models import ProjectUserModel
10
+ from .entities.project_user import ProjectUser
11
+ from ..shared import now_epoch_ms
12
+
13
+
14
+ class ProjectUserRepository:
15
+ """SQLAlchemy implementation of project user repository."""
16
+
17
+ def __init__(self, db: DBSession):
18
+ self.db = db
19
+
20
+ def add_user_to_project(
21
+ self,
22
+ project_id: str,
23
+ user_id: str,
24
+ role: str,
25
+ added_by_user_id: str
26
+ ) -> ProjectUser:
27
+ """
28
+ Add a user to a project with a specific role.
29
+
30
+ Args:
31
+ project_id: The project ID
32
+ user_id: The user ID to add
33
+ role: The role to assign (owner, editor, viewer)
34
+ added_by_user_id: The user ID who is granting access
35
+
36
+ Returns:
37
+ ProjectUser: The created project user access record
38
+ """
39
+ model = ProjectUserModel(
40
+ id=str(uuid.uuid4()),
41
+ project_id=project_id,
42
+ user_id=user_id,
43
+ role=role,
44
+ added_at=now_epoch_ms(),
45
+ added_by_user_id=added_by_user_id,
46
+ )
47
+ self.db.add(model)
48
+ self.db.commit()
49
+ self.db.refresh(model)
50
+ return self._model_to_entity(model)
51
+
52
+ def get_project_users(self, project_id: str) -> List[ProjectUser]:
53
+ """
54
+ Get all users who have access to a project.
55
+
56
+ Args:
57
+ project_id: The project ID
58
+
59
+ Returns:
60
+ List[ProjectUser]: List of users with access to the project
61
+ """
62
+ models = self.db.query(ProjectUserModel).filter(
63
+ ProjectUserModel.project_id == project_id
64
+ ).all()
65
+ return [self._model_to_entity(model) for model in models]
66
+
67
+ def get_user_projects_access(self, user_id: str) -> List[ProjectUser]:
68
+ """
69
+ Get all projects a user has access to.
70
+
71
+ Args:
72
+ user_id: The user ID
73
+
74
+ Returns:
75
+ List[ProjectUser]: List of project access records for the user
76
+ """
77
+ models = self.db.query(ProjectUserModel).filter(
78
+ ProjectUserModel.user_id == user_id
79
+ ).all()
80
+ return [self._model_to_entity(model) for model in models]
81
+
82
+ def get_user_project_access(
83
+ self,
84
+ project_id: str,
85
+ user_id: str
86
+ ) -> Optional[ProjectUser]:
87
+ """
88
+ Get a specific user's access to a project.
89
+
90
+ Args:
91
+ project_id: The project ID
92
+ user_id: The user ID
93
+
94
+ Returns:
95
+ Optional[ProjectUser]: The access record if found, None otherwise
96
+ """
97
+ model = self.db.query(ProjectUserModel).filter(
98
+ ProjectUserModel.project_id == project_id,
99
+ ProjectUserModel.user_id == user_id
100
+ ).first()
101
+
102
+ return self._model_to_entity(model) if model else None
103
+
104
+ def update_user_role(
105
+ self,
106
+ project_id: str,
107
+ user_id: str,
108
+ new_role: str
109
+ ) -> Optional[ProjectUser]:
110
+ """
111
+ Update a user's role for a project.
112
+
113
+ Args:
114
+ project_id: The project ID
115
+ user_id: The user ID
116
+ new_role: The new role to assign
117
+
118
+ Returns:
119
+ Optional[ProjectUser]: The updated access record if found, None otherwise
120
+ """
121
+ model = self.db.query(ProjectUserModel).filter(
122
+ ProjectUserModel.project_id == project_id,
123
+ ProjectUserModel.user_id == user_id
124
+ ).first()
125
+
126
+ if not model:
127
+ return None
128
+
129
+ model.role = new_role
130
+ self.db.commit()
131
+ self.db.refresh(model)
132
+ return self._model_to_entity(model)
133
+
134
+ def remove_user_from_project(
135
+ self,
136
+ project_id: str,
137
+ user_id: str
138
+ ) -> bool:
139
+ """
140
+ Remove a user's access to a project.
141
+
142
+ Args:
143
+ project_id: The project ID
144
+ user_id: The user ID to remove
145
+
146
+ Returns:
147
+ bool: True if removed successfully, False otherwise
148
+ """
149
+ result = self.db.query(ProjectUserModel).filter(
150
+ ProjectUserModel.project_id == project_id,
151
+ ProjectUserModel.user_id == user_id
152
+ ).delete()
153
+ self.db.commit()
154
+ return result > 0
155
+
156
+ def user_has_access(
157
+ self,
158
+ project_id: str,
159
+ user_id: str
160
+ ) -> bool:
161
+ """
162
+ Check if a user has access to a project.
163
+
164
+ Args:
165
+ project_id: The project ID
166
+ user_id: The user ID
167
+
168
+ Returns:
169
+ bool: True if user has access, False otherwise
170
+ """
171
+ count = self.db.query(ProjectUserModel).filter(
172
+ ProjectUserModel.project_id == project_id,
173
+ ProjectUserModel.user_id == user_id
174
+ ).count()
175
+ return count > 0
176
+
177
+ def _model_to_entity(self, model: ProjectUserModel) -> ProjectUser:
178
+ """Convert SQLAlchemy model to domain entity."""
179
+ return ProjectUser(
180
+ id=model.id,
181
+ project_id=model.project_id,
182
+ user_id=model.user_id,
183
+ role=model.role,
184
+ added_at=model.added_at,
185
+ added_by_user_id=model.added_by_user_id,
186
+ )
@@ -1,19 +1,21 @@
1
+ # DEVELOPER GUIDE: repository
2
+
1
3
  ## Quick Summary
2
4
 
3
- The repository directory implements the data access layer for the HTTP SSE gateway using the Repository pattern. It provides a clean separation between domain entities and database persistence through SQLAlchemy ORM models. The architecture consists of abstract interfaces, concrete implementations, domain entities with business logic, and SQLAlchemy models for database operations. The two main subdirectories (entities and models) work together to provide a complete data persistence solution for chat sessions, messages, tasks, feedback, and events.
5
+ The repository directory implements the data access layer for the HTTP SSE gateway using the Repository pattern with SQLAlchemy ORM. It provides a clean separation between domain entities (business logic) and database persistence through abstract interfaces and concrete implementations. The architecture consists of repository interfaces defining contracts, SQLAlchemy implementations, domain entities with validation, and ORM models for database schema. The entities/ subdirectory contains business objects while models/ contains database persistence logic, working together to provide comprehensive data management for chat sessions, tasks, feedback, and events.
4
6
 
5
7
  ## Files and Subdirectories Overview
6
8
 
7
9
  **Direct files:**
8
10
  - `__init__.py` - Main package exports for repository interfaces, implementations, entities, and models
9
- - `interfaces.py` - Abstract repository interfaces defining data access contracts for sessions, messages, tasks, and feedback
10
- - `message_repository.py` - SQLAlchemy implementation of message data access operations
11
+ - `interfaces.py` - Abstract repository interfaces defining data access contracts
11
12
  - `session_repository.py` - SQLAlchemy implementation of session data access operations
13
+ - `chat_task_repository.py` - SQLAlchemy implementation of chat task data access operations
12
14
  - `feedback_repository.py` - SQLAlchemy implementation of feedback data access operations
13
15
  - `task_repository.py` - SQLAlchemy implementation of task data access operations
14
16
 
15
17
  **Subdirectories:**
16
- - `entities/` - Domain entities with business logic for sessions, messages, tasks, feedback, and events
18
+ - `entities/` - Domain entities with business logic for sessions, tasks, feedback, and events
17
19
  - `models/` - SQLAlchemy ORM models for database persistence and schema definition
18
20
 
19
21
  ## Developer API Reference
@@ -22,76 +24,68 @@ The repository directory implements the data access layer for the HTTP SSE gatew
22
24
 
23
25
  #### __init__.py
24
26
  **Purpose:** Central package exports for all repository components
25
- **Import:** `from solace_agent_mesh.gateway.http_sse.repository import IMessageRepository, ISessionRepository, MessageRepository, SessionRepository, Session, Message, SessionHistory, Base, MessageModel, SessionModel`
27
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository import ISessionRepository, SessionRepository, Session, Base, SessionModel`
26
28
 
27
29
  **Exports:**
28
- - `IMessageRepository` - Message repository interface
29
- - `ISessionRepository` - Session repository interface
30
- - `MessageRepository` - Message repository implementation
30
+ - `ISessionRepository` - Session repository interface
31
31
  - `SessionRepository` - Session repository implementation
32
- - `Message` - Message domain entity
33
32
  - `Session` - Session domain entity
34
- - `SessionHistory` - Session with messages composite entity
35
33
  - `Base` - SQLAlchemy declarative base
36
- - `MessageModel` - SQLAlchemy message model
37
34
  - `SessionModel` - SQLAlchemy session model
38
35
 
39
36
  #### interfaces.py
40
37
  **Purpose:** Defines abstract repository interfaces for data access contracts
41
- **Import:** `from solace_agent_mesh.gateway.http_sse.repository.interfaces import ISessionRepository, IMessageRepository, ITaskRepository, IFeedbackRepository`
38
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.interfaces import ISessionRepository, ITaskRepository, IFeedbackRepository, IChatTaskRepository`
42
39
 
43
40
  **Classes:**
44
41
  - `ISessionRepository(ABC)` - Abstract interface for session data operations
45
- - `find_by_user(user_id: UserId, pagination: PaginationInfo | None = None) -> list[Session]` - Find all sessions for a user
46
- - `count_by_user(user_id: UserId) -> int` - Count total sessions for a user
47
- - `find_user_session(session_id: SessionId, user_id: UserId) -> Session | None` - Find specific user session
48
- - `save(session: Session) -> Session` - Save or update a session
49
- - `delete(session_id: SessionId, user_id: UserId) -> bool` - Delete user session
50
- - `find_user_session_with_messages(session_id: SessionId, user_id: UserId, pagination: PaginationInfo | None = None) -> tuple[Session, list[Message]] | None` - Find session with messages
51
-
52
- - `IMessageRepository(ABC)` - Abstract interface for message data operations
53
- - `find_by_session(session_id: SessionId, pagination: PaginationInfo | None = None) -> list[Message]` - Find messages in session
54
- - `save(message: Message) -> Message` - Save or update a message
55
- - `delete_by_session(session_id: SessionId) -> bool` - Delete all session messages
42
+ - `find_by_user(session: DBSession, user_id: UserId, pagination: PaginationParams | None = None) -> list[Session]` - Find all sessions for a user
43
+ - `count_by_user(session: DBSession, user_id: UserId) -> int` - Count total sessions for a user
44
+ - `find_user_session(session: DBSession, session_id: SessionId, user_id: UserId) -> Session | None` - Find specific user session
45
+ - `save(session: DBSession, session_obj: Session) -> Session` - Save or update a session
46
+ - `delete(session: DBSession, session_id: SessionId, user_id: UserId) -> bool` - Delete user session
56
47
 
57
48
  - `ITaskRepository(ABC)` - Abstract interface for task data operations
58
- - `save_task(task: Task) -> Task` - Create or update a task
59
- - `save_event(event: TaskEvent) -> TaskEvent` - Save a task event
60
- - `find_by_id(task_id: str) -> Task | None` - Find a task by its ID
61
- - `find_by_id_with_events(task_id: str) -> tuple[Task, list[TaskEvent]] | None` - Find a task with all its events
62
- - `search(user_id: UserId, start_date: int | None = None, end_date: int | None = None, search_query: str | None = None, pagination: PaginationParams | None = None) -> list[Task]` - Search for tasks with filters
63
- - `delete_tasks_older_than(cutoff_time_ms: int, batch_size: int) -> int` - Delete tasks older than cutoff time
49
+ - `save_task(session: DBSession, task: Task) -> Task` - Create or update a task
50
+ - `save_event(session: DBSession, event: TaskEvent) -> TaskEvent` - Save a task event
51
+ - `find_by_id(session: DBSession, task_id: str) -> Task | None` - Find a task by its ID
52
+ - `find_by_id_with_events(session: DBSession, task_id: str) -> tuple[Task, list[TaskEvent]] | None` - Find a task with all its events
53
+ - `search(session: DBSession, user_id: UserId, start_date: int | None = None, end_date: int | None = None, search_query: str | None = None, pagination: PaginationParams | None = None) -> list[Task]` - Search for tasks with filters
54
+ - `delete_tasks_older_than(session: DBSession, cutoff_time_ms: int, batch_size: int) -> int` - Delete tasks older than cutoff time
64
55
 
65
56
  - `IFeedbackRepository(ABC)` - Abstract interface for feedback data operations
66
- - `save(feedback: Feedback) -> Feedback` - Save feedback
67
- - `delete_feedback_older_than(cutoff_time_ms: int, batch_size: int) -> int` - Delete feedback older than cutoff time
68
-
69
- #### message_repository.py
70
- **Purpose:** SQLAlchemy implementation of message repository interface
71
- **Import:** `from solace_agent_mesh.gateway.http_sse.repository.message_repository import MessageRepository`
57
+ - `save(session: DBSession, feedback: Feedback) -> Feedback` - Save feedback
58
+ - `delete_feedback_older_than(session: DBSession, cutoff_time_ms: int, batch_size: int) -> int` - Delete feedback older than cutoff time
72
59
 
73
- **Classes:**
74
- - `MessageRepository(IMessageRepository)` - SQLAlchemy message repository implementation
75
- - `__init__(db: DBSession)` - Initialize with database session
76
- - `find_by_session(session_id: SessionId, pagination: PaginationInfo | None = None) -> list[Message]` - Find messages in session with pagination
77
- - `save(message: Message) -> Message` - Save or update message in database
78
- - `delete_by_session(session_id: SessionId) -> bool` - Delete all messages in session
79
- - `_convert_model_to_entity(model: MessageModel) -> Message` - Convert SQLAlchemy model to domain entity
60
+ - `IChatTaskRepository(ABC)` - Abstract interface for chat task data operations
61
+ - `save(session: DBSession, task: ChatTask) -> ChatTask` - Save or update a chat task (upsert)
62
+ - `find_by_session(session: DBSession, session_id: SessionId, user_id: UserId) -> list[ChatTask]` - Find all tasks for a session
63
+ - `find_by_id(session: DBSession, task_id: str, user_id: UserId) -> Optional[ChatTask]` - Find a specific task
64
+ - `delete_by_session(session: DBSession, session_id: SessionId) -> bool` - Delete all tasks for a session
80
65
 
81
66
  #### session_repository.py
82
67
  **Purpose:** SQLAlchemy implementation of session repository interface
83
68
  **Import:** `from solace_agent_mesh.gateway.http_sse.repository.session_repository import SessionRepository`
84
69
 
85
70
  **Classes:**
86
- - `SessionRepository(ISessionRepository)` - SQLAlchemy session repository implementation
87
- - `__init__(db: DBSession)` - Initialize with database session
88
- - `find_by_user(user_id: UserId, pagination: PaginationInfo | None = None) -> list[Session]` - Find user sessions with pagination
89
- - `count_by_user(user_id: UserId) -> int` - Count total sessions for a user
90
- - `find_user_session(session_id: SessionId, user_id: UserId) -> Session | None` - Find specific user session
91
- - `save(session: Session) -> Session` - Save or update session in database
92
- - `delete(session_id: SessionId, user_id: UserId) -> bool` - Delete user session
93
- - `find_user_session_with_messages(session_id: SessionId, user_id: UserId, pagination: PaginationInfo | None = None) -> tuple[Session, list[Message]] | None` - Find session with messages
94
- - `_message_model_to_entity(model: MessageModel) -> Message` - Convert message model to entity
71
+ - `SessionRepository(PaginatedRepository[SessionModel, Session], ISessionRepository)` - SQLAlchemy session repository implementation
72
+ - `find_by_user(session: DBSession, user_id: UserId, pagination: PaginationParams | None = None) -> list[Session]` - Find user sessions with pagination
73
+ - `count_by_user(session: DBSession, user_id: UserId) -> int` - Count total sessions for a user
74
+ - `find_user_session(session: DBSession, session_id: SessionId, user_id: UserId) -> Session | None` - Find specific user session
75
+ - `save(db_session: DBSession, session: Session) -> Session` - Save or update session in database
76
+ - `delete(db_session: DBSession, session_id: SessionId, user_id: UserId) -> bool` - Delete user session
77
+
78
+ #### chat_task_repository.py
79
+ **Purpose:** SQLAlchemy implementation of chat task repository interface
80
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.chat_task_repository import ChatTaskRepository`
81
+
82
+ **Classes:**
83
+ - `ChatTaskRepository(IChatTaskRepository)` - SQLAlchemy chat task repository implementation
84
+ - `save(session: DBSession, task: ChatTask) -> ChatTask` - Save or update a chat task (upsert)
85
+ - `find_by_session(session: DBSession, session_id: SessionId, user_id: UserId) -> List[ChatTask]` - Find all tasks for a session
86
+ - `find_by_id(session: DBSession, task_id: str, user_id: UserId) -> Optional[ChatTask]` - Find a specific task
87
+ - `delete_by_session(session: DBSession, session_id: SessionId) -> bool` - Delete all tasks for a session
88
+ - `_model_to_entity(model: ChatTaskModel) -> ChatTask` - Convert SQLAlchemy model to domain entity
95
89
 
96
90
  #### feedback_repository.py
97
91
  **Purpose:** SQLAlchemy implementation of feedback repository interface
@@ -99,9 +93,8 @@ The repository directory implements the data access layer for the HTTP SSE gatew
99
93
 
100
94
  **Classes:**
101
95
  - `FeedbackRepository(IFeedbackRepository)` - SQLAlchemy feedback repository implementation
102
- - `__init__(db: DBSession)` - Initialize with database session
103
- - `save(feedback: Feedback) -> Feedback` - Save feedback to database
104
- - `delete_feedback_older_than(cutoff_time_ms: int, batch_size: int) -> int` - Delete feedback older than cutoff time using batch deletion
96
+ - `save(session: DBSession, feedback: Feedback) -> Feedback` - Save feedback to database
97
+ - `delete_feedback_older_than(session: DBSession, cutoff_time_ms: int, batch_size: int) -> int` - Delete feedback older than cutoff time using batch deletion
105
98
  - `_model_to_entity(model: FeedbackModel) -> Feedback` - Convert SQLAlchemy model to domain entity
106
99
 
107
100
  #### task_repository.py
@@ -110,32 +103,31 @@ The repository directory implements the data access layer for the HTTP SSE gatew
110
103
 
111
104
  **Classes:**
112
105
  - `TaskRepository(ITaskRepository)` - SQLAlchemy task repository implementation
113
- - `__init__(db: DBSession)` - Initialize with database session
114
- - `save_task(task: Task) -> Task` - Create or update a task
115
- - `save_event(event: TaskEvent) -> TaskEvent` - Save a task event
116
- - `find_by_id(task_id: str) -> Task | None` - Find a task by its ID
117
- - `find_by_id_with_events(task_id: str) -> tuple[Task, list[TaskEvent]] | None` - Find a task with all its events
118
- - `search(user_id: UserId, start_date: int | None = None, end_date: int | None = None, search_query: str | None = None, pagination: PaginationParams | None = None) -> list[Task]` - Search for tasks with filters
119
- - `delete_tasks_older_than(cutoff_time_ms: int, batch_size: int) -> int` - Delete tasks older than cutoff time using batch deletion
106
+ - `save_task(session: DBSession, task: Task) -> Task` - Create or update a task
107
+ - `save_event(session: DBSession, event: TaskEvent) -> TaskEvent` - Save a task event
108
+ - `find_by_id(session: DBSession, task_id: str) -> Task | None` - Find a task by its ID
109
+ - `find_by_id_with_events(session: DBSession, task_id: str) -> tuple[Task, list[TaskEvent]] | None` - Find a task with all its events
110
+ - `search(session: DBSession, user_id: UserId, start_date: int | None = None, end_date: int | None = None, pagination: PaginationParams | None = None) -> list[Task]` - Search for tasks with filters
111
+ - `delete_tasks_older_than(session: DBSession, cutoff_time_ms: int, batch_size: int) -> int` - Delete tasks older than cutoff time using batch deletion
120
112
  - `_task_model_to_entity(model: TaskModel) -> Task` - Convert SQLAlchemy task model to domain entity
121
113
  - `_event_model_to_entity(model: TaskEventModel) -> TaskEvent` - Convert SQLAlchemy event model to domain entity
122
114
 
123
115
  ### Subdirectory APIs
124
116
 
125
117
  #### entities/
126
- **Purpose:** Provides domain entities with business logic for sessions, messages, tasks, feedback, and events
127
- **Key Exports:** Message, Session, SessionHistory, Task, TaskEvent, Feedback
118
+ **Purpose:** Provides domain entities with business logic for sessions, tasks, feedback, and events
119
+ **Key Exports:** ChatTask, Feedback, Session, Task, TaskEvent
128
120
  **Import Examples:**
129
121
  ```python
130
- from solace_agent_mesh.gateway.http_sse.repository.entities import Message, Session, SessionHistory, Task, TaskEvent, Feedback
122
+ from solace_agent_mesh.gateway.http_sse.repository.entities import ChatTask, Feedback, Session, Task, TaskEvent
131
123
  ```
132
124
 
133
125
  #### models/
134
126
  **Purpose:** Provides SQLAlchemy ORM models for database persistence and schema definition
135
- **Key Exports:** Base, MessageModel, SessionModel, TaskModel, TaskEventModel, FeedbackModel
127
+ **Key Exports:** Base, ChatTaskModel, FeedbackModel, SessionModel, TaskModel, TaskEventModel, CreateSessionModel, UpdateSessionModel
136
128
  **Import Examples:**
137
129
  ```python
138
- from solace_agent_mesh.gateway.http_sse.repository.models import Base, MessageModel, SessionModel, TaskModel, TaskEventModel, FeedbackModel
130
+ from solace_agent_mesh.gateway.http_sse.repository.models import Base, SessionModel, ChatTaskModel, TaskModel, FeedbackModel
139
131
  ```
140
132
 
141
133
  ## Complete Usage Guide
@@ -146,27 +138,27 @@ from solace_agent_mesh.gateway.http_sse.repository.models import Base, MessageMo
146
138
  from sqlalchemy import create_engine
147
139
  from sqlalchemy.orm import sessionmaker
148
140
  from solace_agent_mesh.gateway.http_sse.repository import (
149
- Base, MessageRepository, SessionRepository, TaskRepository, FeedbackRepository
141
+ Base, SessionRepository, ChatTaskRepository, TaskRepository, FeedbackRepository
150
142
  )
151
143
 
152
144
  # Create database engine and session
153
145
  engine = create_engine("sqlite:///chat.db")
154
146
  Base.metadata.create_all(engine)
155
- Session = sessionmaker(bind=engine)
156
- db_session = Session()
147
+ SessionMaker = sessionmaker(bind=engine)
148
+ db_session = SessionMaker()
157
149
 
158
150
  # Initialize repositories
159
- message_repo = MessageRepository(db_session)
160
- session_repo = SessionRepository(db_session)
161
- task_repo = TaskRepository(db_session)
162
- feedback_repo = FeedbackRepository(db_session)
151
+ session_repo = SessionRepository()
152
+ chat_task_repo = ChatTaskRepository()
153
+ task_repo = TaskRepository()
154
+ feedback_repo = FeedbackRepository()
163
155
  ```
164
156
 
165
157
  ### 2. Working with Sessions
166
158
 
167
159
  ```python
168
160
  from solace_agent_mesh.gateway.http_sse.repository.entities import Session
169
- from solace_agent_mesh.gateway.http_sse.shared.types import PaginationInfo
161
+ from solace_agent_mesh.gateway.http_sse.shared.pagination import PaginationParams
170
162
  import time
171
163
 
172
164
  # Create a new session
@@ -179,51 +171,66 @@ session = Session(
179
171
  )
180
172
 
181
173
  # Save session
182
- saved_session = session_repo.save(session)
174
+ saved_session = session_repo.save(db_session, session)
183
175
 
184
176
  # Find user sessions with pagination
185
- pagination = PaginationInfo(page=1, page_size=10)
186
- user_sessions = session_repo.find_by_user("user_456", pagination)
177
+ pagination = PaginationParams(page=1, page_size=10)
178
+ user_sessions = session_repo.find_by_user(db_session, "user_456", pagination)
187
179
 
188
180
  # Count total sessions for user
189
- total_sessions = session_repo.count_by_user("user_456")
181
+ total_sessions = session_repo.count_by_user(db_session, "user_456")
190
182
 
191
183
  # Find specific session
192
- found_session = session_repo.find_user_session("session_123", "user_456")
184
+ found_session = session_repo.find_user_session(db_session, "session_123", "user_456")
193
185
 
194
186
  # Update session
195
187
  if found_session:
196
188
  found_session.update_name("Updated Chat Name")
197
- session_repo.save(found_session)
189
+ session_repo.save(db_session, found_session)
190
+
191
+ # Delete session
192
+ deleted = session_repo.delete(db_session, "session_123", "user_456")
193
+ db_session.commit()
198
194
  ```
199
195
 
200
- ### 3. Working with Messages
196
+ ### 3. Working with Chat Tasks
201
197
 
202
198
  ```python
203
- from solace_agent_mesh.gateway.http_sse.repository.entities import Message
204
- from solace_agent_mesh.gateway.http_sse.shared.enums import SenderType, MessageType
199
+ from solace_agent_mesh.gateway.http_sse.repository.entities import ChatTask
200
+ import json
201
+
202
+ # Create a chat task with message bubbles
203
+ message_bubbles = json.dumps([
204
+ {"type": "user", "content": "Hello, I need help"},
205
+ {"type": "agent", "content": "Hi! How can I assist you today?"}
206
+ ])
205
207
 
206
- # Create a new message
207
- message = Message(
208
- id="msg_123",
208
+ chat_task = ChatTask(
209
+ id="chat_task_123",
209
210
  session_id="session_123",
210
- message="Hello, how can I help you today?",
211
- sender_type=SenderType.AGENT,
212
- sender_name="Support Agent",
213
- message_type=MessageType.TEXT,
211
+ user_id="user_456",
212
+ user_message="Hello, I need help",
213
+ message_bubbles=message_bubbles,
214
214
  created_time=int(time.time() * 1000)
215
215
  )
216
216
 
217
- # Validate and save message
218
- message.validate_message_content()
219
- saved_message = message_repo.save(message)
217
+ # Save chat task
218
+ saved_task = chat_task_repo.save(db_session, chat_task)
219
+
220
+ # Find all tasks for a session
221
+ session_tasks = chat_task_repo.find_by_session(db_session, "session_123", "user_456")
220
222
 
221
- # Find messages in session
222
- session_messages = message_repo.find_by_session("session_123", pagination)
223
+ # Find specific task
224
+ found_task = chat_task_repo.find_by_id(db_session, "chat_task_123", "user_456")
223
225
 
224
- # Check message properties
225
- if message.is_from_agent():
226
- print("Message from agent")
226
+ # Add feedback to task
227
+ if found_task:
228
+ found_task.add_feedback("positive", "Great response!")
229
+ chat_task_repo.save(db_session, found_task)
230
+
231
+ # Delete all tasks for a session
232
+ deleted = chat_task_repo.delete_by_session(db_session, "session_123")
233
+ db_session.commit()
227
234
  ```
228
235
 
229
236
  ### 4. Working with Tasks and Events
@@ -237,11 +244,13 @@ task = Task(
237
244
  user_id="user_456",
238
245
  start_time=int(time.time() * 1000),
239
246
  status="in_progress",
240
- initial_request_text="Help me with my order"
247
+ initial_request_text="Help me with my order",
248
+ total_input_tokens=150,
249
+ total_output_tokens=300
241
250
  )
242
251
 
243
252
  # Save task
244
- saved_task = task_repo.save_task(task)
253
+ saved_task = task_repo.save_task(db_session, task)
245
254
 
246
255
  # Create task event
247
256
  event = TaskEvent(
@@ -255,22 +264,32 @@ event = TaskEvent(
255
264
  )
256
265
 
257
266
  # Save event
258
- saved_event = task_repo.save_event(event)
267
+ saved_event = task_repo.save_event(db_session, event)
259
268
 
260
269
  # Find task with events
261
- result = task_repo.find_by_id_with_events("task_123")
270
+ result = task_repo.find_by_id_with_events(db_session, "task_123")
262
271
  if result:
263
272
  task, events = result
264
273
  print(f"Task {task.id} has {len(events)} events")
265
274
 
266
- # Search tasks
267
- from solace_agent_mesh.gateway.http_sse.shared.types import PaginationParams
275
+ # Search tasks with filters
276
+ from solace_agent_mesh.gateway.http_sse.shared.pagination import PaginationParams
268
277
  pagination_params = PaginationParams(page=1, page_size=10)
278
+ start_date = int((time.time() - 86400) * 1000) # 24 hours ago
279
+ end_date = int(time.time() * 1000)
280
+
269
281
  tasks = task_repo.search(
282
+ db_session,
270
283
  user_id="user_456",
271
- search_query="order",
284
+ start_date=start_date,
285
+ end_date=end_date,
272
286
  pagination=pagination_params
273
287
  )
288
+
289
+ # Batch delete old tasks
290
+ cutoff_time = int((time.time() - 7 * 86400) * 1000) # 7 days ago
291
+ deleted_count = task_repo.delete_tasks_older_than(db_session, cutoff_time, batch_size=100)
292
+ print(f"Deleted {deleted_count} old tasks")
274
293
  ```
275
294
 
276
295
  ### 5. Working with Feedback
@@ -285,56 +304,5 @@ feedback = Feedback(
285
304
  task_id="task_123",
286
305
  user_id="user_456",
287
306
  rating="up",
288
- comment="Great service!",
289
- created_time=int(time.time() * 1000)
290
- )
291
-
292
- # Save feedback
293
- saved_feedback = feedback_repo.save(feedback)
294
- ```
295
-
296
- ### 6. Working with Session History (Combined Operations)
297
-
298
- ```python
299
- from solace_agent_mesh.gateway.http_sse.repository.entities import SessionHistory
300
-
301
- # Get session with messages in one operation
302
- result = session_repo.find_user_session_with_messages(
303
- "session_123", "user_456", pagination
304
- )
305
-
306
- if result:
307
- session, messages = result
308
-
309
- # Create session history object
310
- history = SessionHistory(
311
- session=session,
312
- messages=messages,
313
- total_message_count=len(messages)
314
- )
315
-
316
- print(f"Session: {history.session.name}")
317
- print(f"Messages: {len(history.messages)}")
318
- ```
319
-
320
- ### 7. Using Repository Interfaces for Dependency Injection
321
-
322
- ```python
323
- from solace_agent_mesh.gateway.http_sse.repository.interfaces import (
324
- ISessionRepository, IMessageRepository, ITaskRepository, IFeedbackRepository
325
- )
326
307
 
327
- class ChatService:
328
- def __init__(
329
- self,
330
- session_repo: ISessionRepository,
331
- message_repo: IMessageRepository,
332
- task_repo: ITaskRepository,
333
- feedback_repo: IFeedbackRepository
334
- ):
335
- self.session_repo = session_repo
336
- self.message_repo = message_repo
337
- self.task_repo = task_repo
338
- self.feedback_
339
-
340
- # content_hash: e4e822acd625d1acce1f4ea0721844e7428a9b110c9e73b6657b8d3adc8ed038
308
+ # content_hash: 9dc7b1b626d834a08c7dad6774af9b5c2190e1e635d0be92c54121eed438521f