solace-agent-mesh 1.4.11__py3-none-any.whl → 1.5.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 (189) hide show
  1. solace_agent_mesh/agent/adk/adk_llm.txt +3 -4
  2. solace_agent_mesh/agent/adk/adk_llm_detail.txt +566 -0
  3. solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
  4. solace_agent_mesh/agent/adk/artifacts/s3_artifact_service.py +1 -0
  5. solace_agent_mesh/agent/adk/callbacks.py +51 -2
  6. solace_agent_mesh/agent/adk/models/lite_llm.py +1 -0
  7. solace_agent_mesh/agent/adk/models/models_llm.txt +1 -2
  8. solace_agent_mesh/agent/adk/services.py +30 -15
  9. solace_agent_mesh/agent/adk/setup.py +4 -0
  10. solace_agent_mesh/agent/agent_llm.txt +1 -1
  11. solace_agent_mesh/agent/agent_llm_detail.txt +1702 -0
  12. solace_agent_mesh/agent/protocol/event_handlers.py +2 -13
  13. solace_agent_mesh/agent/protocol/protocol_llm.txt +15 -2
  14. solace_agent_mesh/agent/protocol/protocol_llm_detail.txt +92 -0
  15. solace_agent_mesh/agent/sac/component.py +51 -21
  16. solace_agent_mesh/agent/sac/sac_llm.txt +15 -1
  17. solace_agent_mesh/agent/sac/sac_llm_detail.txt +200 -0
  18. solace_agent_mesh/agent/sac/task_execution_context.py +73 -0
  19. solace_agent_mesh/agent/testing/testing_llm_detail.txt +68 -0
  20. solace_agent_mesh/agent/tools/tools_llm.txt +148 -154
  21. solace_agent_mesh/agent/tools/tools_llm_detail.txt +274 -0
  22. solace_agent_mesh/agent/utils/utils_llm.txt +1 -1
  23. solace_agent_mesh/agent/utils/utils_llm_detail.txt +149 -0
  24. solace_agent_mesh/assets/docs/404.html +3 -3
  25. solace_agent_mesh/assets/docs/assets/js/0e682baa.d54b8668.js +1 -0
  26. solace_agent_mesh/assets/docs/assets/js/483cef9a.bf9398af.js +1 -0
  27. solace_agent_mesh/assets/docs/assets/js/{main.dc155742.js → main.0c149855.js} +2 -2
  28. solace_agent_mesh/assets/docs/assets/js/{runtime~main.0d2ff2b6.js → runtime~main.c66557e4.js} +1 -1
  29. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +3 -3
  30. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/rbac-setup-guilde/index.html +3 -3
  31. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +8 -4
  32. solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
  33. solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html +3 -3
  34. solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +3 -3
  35. solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +3 -3
  36. solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +3 -3
  37. solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +3 -3
  38. solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +3 -3
  39. solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +3 -3
  40. solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +3 -3
  41. solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +3 -3
  42. solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +3 -3
  43. solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +3 -3
  44. solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +3 -3
  45. solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/litellm_models/index.html +3 -3
  46. solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +3 -3
  47. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
  48. solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +3 -3
  49. solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +3 -3
  50. solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +3 -3
  51. solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +3 -3
  52. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +7 -4
  53. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +3 -3
  54. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +3 -3
  55. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +3 -3
  56. solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +3 -3
  57. solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +3 -3
  58. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +3 -3
  59. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +3 -3
  60. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +3 -3
  61. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +3 -3
  62. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +3 -3
  63. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +3 -3
  64. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +3 -3
  65. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-python-tools/index.html +3 -3
  66. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +3 -3
  67. solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +3 -3
  68. solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +3 -3
  69. solace_agent_mesh/assets/docs/lunr-index-1760032255022.json +1 -0
  70. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  71. solace_agent_mesh/assets/docs/search-doc-1760032255022.json +1 -0
  72. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  73. solace_agent_mesh/cli/__init__.py +1 -1
  74. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-j1LW-wlq.js → authCallback-DwrxZE0E.js} +1 -1
  75. solace_agent_mesh/client/webui/frontend/static/assets/{client-B9p_nFNA.js → client-DarGQzyw.js} +1 -1
  76. solace_agent_mesh/client/webui/frontend/static/assets/main-CZbpmwfA.css +1 -0
  77. solace_agent_mesh/client/webui/frontend/static/assets/main-C__uuUkB.js +339 -0
  78. solace_agent_mesh/client/webui/frontend/static/assets/{vendor-CS5YMf8a.js → vendor-BKIeiHj_.js} +80 -70
  79. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
  80. solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
  81. solace_agent_mesh/common/a2a/a2a_llm.txt +1 -1
  82. solace_agent_mesh/common/a2a/a2a_llm_detail.txt +193 -0
  83. solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +1 -1
  84. solace_agent_mesh/common/a2a_spec/a2a_spec_llm_detail.txt +736 -0
  85. solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +23 -0
  86. solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +93 -15
  87. solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +23 -0
  88. solace_agent_mesh/common/common_llm.txt +24 -39
  89. solace_agent_mesh/common/common_llm_detail.txt +2562 -0
  90. solace_agent_mesh/common/data_parts.py +9 -1
  91. solace_agent_mesh/common/middleware/middleware_llm_detail.txt +185 -0
  92. solace_agent_mesh/common/sac/sac_llm.txt +1 -1
  93. solace_agent_mesh/common/sac/sac_llm_detail.txt +82 -0
  94. solace_agent_mesh/common/sam_events/sam_events_llm.txt +104 -0
  95. solace_agent_mesh/common/sam_events/sam_events_llm_detail.txt +115 -0
  96. solace_agent_mesh/common/services/identity_service.py +7 -4
  97. solace_agent_mesh/common/services/providers/local_file_identity_service.py +4 -2
  98. solace_agent_mesh/common/services/services_llm.txt +57 -6
  99. solace_agent_mesh/common/services/services_llm_detail.txt +459 -0
  100. solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
  101. solace_agent_mesh/common/utils/utils_llm.txt +75 -87
  102. solace_agent_mesh/common/utils/utils_llm_detail.txt +572 -0
  103. solace_agent_mesh/core_a2a/core_a2a_llm_detail.txt +101 -0
  104. solace_agent_mesh/gateway/base/app.py +1 -1
  105. solace_agent_mesh/gateway/base/base_llm.txt +1 -1
  106. solace_agent_mesh/gateway/base/base_llm_detail.txt +235 -0
  107. solace_agent_mesh/gateway/base/component.py +1 -1
  108. solace_agent_mesh/gateway/gateway_llm.txt +242 -235
  109. solace_agent_mesh/gateway/gateway_llm_detail.txt +3885 -0
  110. solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +295 -0
  111. solace_agent_mesh/gateway/http_sse/alembic/env.py +10 -1
  112. solace_agent_mesh/gateway/http_sse/alembic/versions/20251006_98882922fa59_add_tasks_events_feedback_chat_tasks.py +190 -0
  113. solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +155 -0
  114. solace_agent_mesh/gateway/http_sse/alembic.ini +1 -1
  115. solace_agent_mesh/gateway/http_sse/app.py +148 -2
  116. solace_agent_mesh/gateway/http_sse/component.py +368 -60
  117. solace_agent_mesh/gateway/http_sse/components/components_llm.txt +46 -6
  118. solace_agent_mesh/gateway/http_sse/components/task_logger_forwarder.py +108 -0
  119. solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +1 -1
  120. solace_agent_mesh/gateway/http_sse/dependencies.py +116 -26
  121. solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +172 -172
  122. solace_agent_mesh/gateway/http_sse/http_sse_llm_detail.txt +3278 -0
  123. solace_agent_mesh/gateway/http_sse/main.py +146 -41
  124. solace_agent_mesh/gateway/http_sse/repository/__init__.py +3 -12
  125. solace_agent_mesh/gateway/http_sse/repository/chat_task_repository.py +103 -0
  126. solace_agent_mesh/gateway/http_sse/repository/entities/__init__.py +5 -3
  127. solace_agent_mesh/gateway/http_sse/repository/entities/chat_task.py +75 -0
  128. solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +263 -0
  129. solace_agent_mesh/gateway/http_sse/repository/entities/feedback.py +20 -0
  130. solace_agent_mesh/gateway/http_sse/repository/entities/session_history.py +0 -16
  131. solace_agent_mesh/gateway/http_sse/repository/entities/task.py +25 -0
  132. solace_agent_mesh/gateway/http_sse/repository/entities/task_event.py +21 -0
  133. solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +81 -0
  134. solace_agent_mesh/gateway/http_sse/repository/interfaces.py +73 -18
  135. solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -5
  136. solace_agent_mesh/gateway/http_sse/repository/models/chat_task_model.py +31 -0
  137. solace_agent_mesh/gateway/http_sse/repository/models/feedback_model.py +21 -0
  138. solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +266 -0
  139. solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +3 -3
  140. solace_agent_mesh/gateway/http_sse/repository/models/task_event_model.py +25 -0
  141. solace_agent_mesh/gateway/http_sse/repository/models/task_model.py +32 -0
  142. solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +340 -0
  143. solace_agent_mesh/gateway/http_sse/repository/session_repository.py +4 -53
  144. solace_agent_mesh/gateway/http_sse/repository/task_repository.py +173 -0
  145. solace_agent_mesh/gateway/http_sse/routers/artifacts.py +1 -1
  146. solace_agent_mesh/gateway/http_sse/routers/config.py +26 -4
  147. solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +346 -0
  148. solace_agent_mesh/gateway/http_sse/routers/dto/requests/__init__.py +3 -3
  149. solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +83 -0
  150. solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +2 -10
  151. solace_agent_mesh/gateway/http_sse/routers/dto/requests/task_requests.py +58 -0
  152. solace_agent_mesh/gateway/http_sse/routers/dto/responses/__init__.py +5 -3
  153. solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +107 -0
  154. solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +1 -15
  155. solace_agent_mesh/gateway/http_sse/routers/dto/responses/task_responses.py +30 -0
  156. solace_agent_mesh/gateway/http_sse/routers/feedback.py +37 -0
  157. solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +255 -204
  158. solace_agent_mesh/gateway/http_sse/routers/sessions.py +220 -40
  159. solace_agent_mesh/gateway/http_sse/routers/tasks.py +168 -42
  160. solace_agent_mesh/gateway/http_sse/services/data_retention_service.py +272 -0
  161. solace_agent_mesh/gateway/http_sse/services/feedback_service.py +241 -0
  162. solace_agent_mesh/gateway/http_sse/services/people_service.py +0 -80
  163. solace_agent_mesh/gateway/http_sse/services/services_llm.txt +177 -13
  164. solace_agent_mesh/gateway/http_sse/services/session_service.py +151 -84
  165. solace_agent_mesh/gateway/http_sse/services/task_logger_service.py +317 -0
  166. solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +25 -14
  167. solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +285 -0
  168. solace_agent_mesh/gateway/http_sse/shared/types.py +7 -0
  169. solace_agent_mesh/gateway/http_sse/utils/__init__.py +1 -0
  170. solace_agent_mesh/gateway/http_sse/utils/stim_utils.py +32 -0
  171. solace_agent_mesh/gateway/http_sse/utils/utils_llm.txt +47 -0
  172. solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
  173. solace_agent_mesh/solace_agent_mesh_llm_detail.txt +8599 -0
  174. {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/METADATA +1 -1
  175. {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/RECORD +179 -131
  176. solace_agent_mesh/agent/adk/invocation_monitor.py +0 -295
  177. solace_agent_mesh/assets/docs/assets/js/0e682baa.d054e1d8.js +0 -1
  178. solace_agent_mesh/assets/docs/assets/js/483cef9a.4736f2d8.js +0 -1
  179. solace_agent_mesh/assets/docs/lunr-index-1759514789087.json +0 -1
  180. solace_agent_mesh/assets/docs/search-doc-1759514789087.json +0 -1
  181. solace_agent_mesh/client/webui/frontend/static/assets/main-ChRwcV89.css +0 -1
  182. solace_agent_mesh/client/webui/frontend/static/assets/main-DnnE01OM.js +0 -339
  183. solace_agent_mesh/gateway/http_sse/repository/entities/message.py +0 -41
  184. solace_agent_mesh/gateway/http_sse/repository/message_repository.py +0 -84
  185. solace_agent_mesh/gateway/http_sse/repository/models/message_model.py +0 -45
  186. /solace_agent_mesh/assets/docs/assets/js/{main.dc155742.js.LICENSE.txt → main.0c149855.js.LICENSE.txt} +0 -0
  187. {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/WHEEL +0 -0
  188. {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/entry_points.txt +0 -0
  189. {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,263 @@
1
+ # DEVELOPER GUIDE: entities
2
+
3
+ ## Quick Summary
4
+ The entities directory contains domain entities for the repository layer, providing core business objects for managing chat sessions, messages, tasks, feedback, and events with built-in validation and business logic.
5
+
6
+ ## Files Overview
7
+ - `__init__.py` - Exports the main domain entities (Feedback, Message, Session, SessionHistory, Task, TaskEvent)
8
+ - `feedback.py` - Feedback entity for user ratings and comments on tasks
9
+ - `message.py` - Message entity with content validation and sender type checking
10
+ - `session.py` - Session entity with name management and access control
11
+ - `session_history.py` - Composite entity combining sessions with their message history
12
+ - `task.py` - Task entity for tracking user tasks and their status with token usage
13
+ - `task_event.py` - Task event entity for tracking events related to tasks
14
+
15
+ ## Developer API Reference
16
+
17
+ ### __init__.py
18
+ **Purpose:** Provides centralized imports for all domain entities
19
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.entities import Feedback, Message, Session, SessionHistory, Task, TaskEvent`
20
+
21
+ ### feedback.py
22
+ **Purpose:** Defines the Feedback domain entity for user ratings and comments
23
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.entities import Feedback`
24
+
25
+ **Classes:**
26
+ - `Feedback(id: str, session_id: str, task_id: str, user_id: str, rating: str, comment: str | None = None, created_time: int)` - Feedback domain entity
27
+ - `id: str` - Unique feedback identifier
28
+ - `session_id: str` - Associated session identifier
29
+ - `task_id: str` - Associated task identifier
30
+ - `user_id: str` - User who provided feedback
31
+ - `rating: str` - User rating
32
+ - `comment: str | None` - Optional feedback comment
33
+ - `created_time: int` - Feedback creation timestamp
34
+
35
+ **Usage Examples:**
36
+ ```python
37
+ from solace_agent_mesh.gateway.http_sse.repository.entities import Feedback
38
+
39
+ # Create feedback
40
+ feedback = Feedback(
41
+ id="feedback_123",
42
+ session_id="session_456",
43
+ task_id="task_789",
44
+ user_id="user_123",
45
+ rating="5",
46
+ comment="Great service!",
47
+ created_time=1640995200000
48
+ )
49
+ ```
50
+
51
+ ### message.py
52
+ **Purpose:** Defines the Message domain entity with business logic for chat messages
53
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.entities import Message`
54
+
55
+ **Classes:**
56
+ - `Message(id: MessageId, session_id: SessionId, message: str, sender_type: SenderType, sender_name: str, message_type: MessageType = MessageType.TEXT, created_time: int)` - Message domain entity with business logic
57
+ - `validate_message_content() -> None` - Validates message content is not empty and under 10MB limit
58
+ - `is_from_user() -> bool` - Checks if message is from a user
59
+ - `is_from_agent() -> bool` - Checks if message is from an agent
60
+ - `is_system_message() -> bool` - Checks if message is a system message
61
+ - `id: MessageId` - Unique message identifier
62
+ - `session_id: SessionId` - Associated session identifier
63
+ - `message: str` - Message content
64
+ - `sender_type: SenderType` - Type of sender (USER, AGENT, SYSTEM)
65
+ - `sender_name: str` - Name of the message sender
66
+ - `message_type: MessageType` - Type of message content
67
+ - `created_time: int` - Message creation timestamp
68
+
69
+ **Usage Examples:**
70
+ ```python
71
+ from solace_agent_mesh.gateway.http_sse.repository.entities import Message
72
+ from solace_agent_mesh.gateway.http_sse.shared.enums import SenderType, MessageType
73
+
74
+ # Create a user message
75
+ message = Message(
76
+ id="msg_123",
77
+ session_id="session_456",
78
+ message="Hello, how can I help?",
79
+ sender_type=SenderType.USER,
80
+ sender_name="John Doe",
81
+ message_type=MessageType.TEXT,
82
+ created_time=1640995200000
83
+ )
84
+
85
+ # Validate message content
86
+ message.validate_message_content()
87
+
88
+ # Check sender type
89
+ if message.is_from_user():
90
+ print("Message from user")
91
+ ```
92
+
93
+ ### session.py
94
+ **Purpose:** Defines the Session domain entity with business logic for chat sessions
95
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.entities import Session`
96
+
97
+ **Classes:**
98
+ - `Session(id: SessionId, user_id: UserId, name: str | None = None, agent_id: AgentId | None = None, created_time: int, updated_time: int | None = None)` - Session domain entity with business logic
99
+ - `update_name(new_name: str) -> None` - Updates session name with validation and sets updated_time
100
+ - `mark_activity() -> None` - Marks session as having recent activity by updating timestamp
101
+ - `can_be_deleted_by_user(user_id: UserId) -> bool` - Checks if user can delete this session
102
+ - `can_be_accessed_by_user(user_id: UserId) -> bool` - Checks if user can access this session
103
+ - `id: SessionId` - Unique session identifier
104
+ - `user_id: UserId` - Owner user identifier
105
+ - `name: str | None` - Optional session name
106
+ - `agent_id: AgentId | None` - Optional associated agent identifier
107
+ - `created_time: int` - Session creation timestamp
108
+ - `updated_time: int | None` - Last update timestamp
109
+
110
+ **Usage Examples:**
111
+ ```python
112
+ from solace_agent_mesh.gateway.http_sse.repository.entities import Session
113
+
114
+ # Create a new session
115
+ session = Session(
116
+ id="session_123",
117
+ user_id="user_456",
118
+ name="Customer Support Chat",
119
+ agent_id="agent_789",
120
+ created_time=1640995200000
121
+ )
122
+
123
+ # Update session name
124
+ session.update_name("Updated Chat Name")
125
+
126
+ # Mark activity
127
+ session.mark_activity()
128
+
129
+ # Check permissions
130
+ if session.can_be_accessed_by_user("user_456"):
131
+ print("User can access this session")
132
+ ```
133
+
134
+ ### session_history.py
135
+ **Purpose:** Defines a composite entity that combines a session with its message history
136
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.entities import SessionHistory`
137
+
138
+ **Classes:**
139
+ - `SessionHistory(session: Session, messages: list[Message] = [], total_message_count: int = 0)` - Composite entity representing a session with its messages
140
+ - `session: Session` - The session entity
141
+ - `messages: list[Message]` - List of messages in the session
142
+ - `total_message_count: int` - Total count of messages (may exceed messages list length for pagination)
143
+
144
+ **Usage Examples:**
145
+ ```python
146
+ from solace_agent_mesh.gateway.http_sse.repository.entities import SessionHistory, Session, Message
147
+ from solace_agent_mesh.gateway.http_sse.shared.enums import SenderType
148
+
149
+ # Create session history
150
+ session = Session(
151
+ id="session_123",
152
+ user_id="user_456",
153
+ created_time=1640995200000
154
+ )
155
+
156
+ messages = [
157
+ Message(
158
+ id="msg_1",
159
+ session_id="session_123",
160
+ message="Hello",
161
+ sender_type=SenderType.USER,
162
+ sender_name="John",
163
+ created_time=1640995200000
164
+ )
165
+ ]
166
+
167
+ history = SessionHistory(
168
+ session=session,
169
+ messages=messages,
170
+ total_message_count=1
171
+ )
172
+
173
+ # Access session and messages
174
+ print(f"Session: {history.session.id}")
175
+ print(f"Message count: {len(history.messages)}")
176
+ print(f"Total messages: {history.total_message_count}")
177
+ ```
178
+
179
+ ### task.py
180
+ **Purpose:** Defines the Task domain entity for tracking user tasks with token usage metrics
181
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.entities import Task`
182
+
183
+ **Classes:**
184
+ - `Task(id: str, user_id: str, start_time: int, end_time: int | None = None, status: str | None = None, initial_request_text: str | None = None, total_input_tokens: int | None = None, total_output_tokens: int | None = None, total_cached_input_tokens: int | None = None, token_usage_details: dict | None = None)` - Task domain entity with token usage tracking
185
+ - `id: str` - Unique task identifier
186
+ - `user_id: str` - User who owns the task
187
+ - `start_time: int` - Task start timestamp
188
+ - `end_time: int | None` - Optional task end timestamp
189
+ - `status: str | None` - Optional task status
190
+ - `initial_request_text: str | None` - Optional initial request text
191
+ - `total_input_tokens: int | None` - Total input tokens used
192
+ - `total_output_tokens: int | None` - Total output tokens generated
193
+ - `total_cached_input_tokens: int | None` - Total cached input tokens used
194
+ - `token_usage_details: dict | None` - Detailed token usage information
195
+
196
+ **Usage Examples:**
197
+ ```python
198
+ from solace_agent_mesh.gateway.http_sse.repository.entities import Task
199
+
200
+ # Create a task
201
+ task = Task(
202
+ id="task_123",
203
+ user_id="user_456",
204
+ start_time=1640995200000,
205
+ status="in_progress",
206
+ initial_request_text="Help me with my order"
207
+ )
208
+
209
+ # Task with token usage tracking
210
+ task_with_tokens = Task(
211
+ id="task_124",
212
+ user_id="user_456",
213
+ start_time=1640995200000,
214
+ end_time=1640995800000,
215
+ status="completed",
216
+ total_input_tokens=150,
217
+ total_output_tokens=300,
218
+ total_cached_input_tokens=50,
219
+ token_usage_details={"model": "gpt-4", "cost": 0.05}
220
+ )
221
+ ```
222
+
223
+ ### task_event.py
224
+ **Purpose:** Defines the TaskEvent domain entity for tracking events related to tasks
225
+ **Import:** `from solace_agent_mesh.gateway.http_sse.repository.entities import TaskEvent`
226
+
227
+ **Classes:**
228
+ - `TaskEvent(id: str, task_id: str, user_id: str | None = None, created_time: int, topic: str, direction: str, payload: dict[str, Any])` - TaskEvent domain entity
229
+ - `id: str` - Unique event identifier
230
+ - `task_id: str` - Associated task identifier
231
+ - `user_id: str | None` - Optional user identifier
232
+ - `created_time: int` - Event creation timestamp
233
+ - `topic: str` - Event topic
234
+ - `direction: str` - Event direction
235
+ - `payload: dict[str, Any]` - Event payload data
236
+
237
+ **Usage Examples:**
238
+ ```python
239
+ from solace_agent_mesh.gateway.http_sse.repository.entities import TaskEvent
240
+
241
+ # Create a task event
242
+ event = TaskEvent(
243
+ id="event_123",
244
+ task_id="task_456",
245
+ user_id="user_789",
246
+ created_time=1640995200000,
247
+ topic="task.status.changed",
248
+ direction="outbound",
249
+ payload={"status": "completed", "result": "success"}
250
+ )
251
+
252
+ # Event without user
253
+ system_event = TaskEvent(
254
+ id="event_124",
255
+ task_id="task_456",
256
+ created_time=1640995200000,
257
+ topic="task.system.notification",
258
+ direction="inbound",
259
+ payload={"message": "Task processing started"}
260
+ )
261
+ ```
262
+
263
+ # content_hash: 14f978bcbf2c820db1c7f3185ffa1529a656b3b5fa0f64cff81927eb2f7d12e9
@@ -0,0 +1,20 @@
1
+ """
2
+ Feedback domain entity.
3
+ """
4
+
5
+ from pydantic import BaseModel
6
+
7
+
8
+ class Feedback(BaseModel):
9
+ """Feedback domain entity."""
10
+
11
+ id: str
12
+ session_id: str
13
+ task_id: str
14
+ user_id: str
15
+ rating: str
16
+ comment: str | None = None
17
+ created_time: int
18
+
19
+ class Config:
20
+ from_attributes = True
@@ -1,16 +0,0 @@
1
- """
2
- Session history composite entity.
3
- """
4
-
5
- from pydantic import BaseModel
6
-
7
- from .message import Message
8
- from .session import Session
9
-
10
-
11
- class SessionHistory(BaseModel):
12
- """Composite entity representing a session with its messages."""
13
-
14
- session: Session
15
- messages: list[Message] = []
16
- total_message_count: int = 0
@@ -0,0 +1,25 @@
1
+ """
2
+ Task domain entity.
3
+ """
4
+
5
+ from pydantic import BaseModel
6
+
7
+
8
+ class Task(BaseModel):
9
+ """Task domain entity."""
10
+
11
+ id: str
12
+ user_id: str
13
+ start_time: int
14
+ end_time: int | None = None
15
+ status: str | None = None
16
+ initial_request_text: str | None = None
17
+
18
+ # Token usage fields
19
+ total_input_tokens: int | None = None
20
+ total_output_tokens: int | None = None
21
+ total_cached_input_tokens: int | None = None
22
+ token_usage_details: dict | None = None
23
+
24
+ class Config:
25
+ from_attributes = True
@@ -0,0 +1,21 @@
1
+ """
2
+ Task Event domain entity.
3
+ """
4
+ from typing import Any
5
+
6
+ from pydantic import BaseModel
7
+
8
+
9
+ class TaskEvent(BaseModel):
10
+ """TaskEvent domain entity."""
11
+
12
+ id: str
13
+ task_id: str
14
+ user_id: str | None = None
15
+ created_time: int
16
+ topic: str
17
+ direction: str
18
+ payload: dict[str, Any]
19
+
20
+ class Config:
21
+ from_attributes = True
@@ -0,0 +1,81 @@
1
+ """
2
+ Feedback repository implementation using SQLAlchemy.
3
+ """
4
+
5
+ from sqlalchemy.orm import Session as DBSession
6
+
7
+ from .entities import Feedback
8
+ from .interfaces import IFeedbackRepository
9
+ from .models import FeedbackModel
10
+
11
+
12
+ class FeedbackRepository(IFeedbackRepository):
13
+ """SQLAlchemy implementation of feedback repository."""
14
+
15
+ def __init__(self, db: DBSession):
16
+ self.db = db
17
+
18
+ def save(self, feedback: Feedback) -> Feedback:
19
+ """Save feedback."""
20
+ model = FeedbackModel(
21
+ id=feedback.id,
22
+ session_id=feedback.session_id,
23
+ task_id=feedback.task_id,
24
+ user_id=feedback.user_id,
25
+ rating=feedback.rating,
26
+ comment=feedback.comment,
27
+ created_time=feedback.created_time,
28
+ )
29
+ self.db.add(model)
30
+ self.db.commit()
31
+ self.db.refresh(model)
32
+ return self._model_to_entity(model)
33
+
34
+ def delete_feedback_older_than(self, cutoff_time_ms: int, batch_size: int) -> int:
35
+ """
36
+ Delete feedback records older than the cutoff time.
37
+ Uses batch deletion to avoid long-running transactions.
38
+
39
+ Args:
40
+ cutoff_time_ms: Epoch milliseconds - feedback with created_time before this will be deleted
41
+ batch_size: Number of feedback records to delete per batch
42
+
43
+ Returns:
44
+ Total number of feedback records deleted
45
+ """
46
+ total_deleted = 0
47
+
48
+ while True:
49
+ # Find a batch of feedback IDs to delete
50
+ feedback_ids_to_delete = (
51
+ self.db.query(FeedbackModel.id)
52
+ .filter(FeedbackModel.created_time < cutoff_time_ms)
53
+ .limit(batch_size)
54
+ .all()
55
+ )
56
+
57
+ if not feedback_ids_to_delete:
58
+ break
59
+
60
+ # Extract IDs from the result tuples
61
+ ids = [feedback_id[0] for feedback_id in feedback_ids_to_delete]
62
+
63
+ # Delete this batch
64
+ deleted_count = (
65
+ self.db.query(FeedbackModel)
66
+ .filter(FeedbackModel.id.in_(ids))
67
+ .delete(synchronize_session=False)
68
+ )
69
+
70
+ self.db.commit()
71
+ total_deleted += deleted_count
72
+
73
+ # If we deleted fewer than batch_size, we're done
74
+ if deleted_count < batch_size:
75
+ break
76
+
77
+ return total_deleted
78
+
79
+ def _model_to_entity(self, model: FeedbackModel) -> Feedback:
80
+ """Convert SQLAlchemy model to domain entity."""
81
+ return Feedback.model_validate(model)
@@ -3,9 +3,13 @@ Repository interfaces defining contracts for data access.
3
3
  """
4
4
 
5
5
  from abc import ABC, abstractmethod
6
+ from typing import TYPE_CHECKING, Optional
6
7
 
7
- from ..shared.types import PaginationInfo, SessionId, UserId
8
- from .entities import Message, Session
8
+ from ..shared.types import PaginationInfo, PaginationParams, SessionId, UserId
9
+ from .entities import Feedback, Session, Task, TaskEvent
10
+
11
+ if TYPE_CHECKING:
12
+ from .entities import ChatTask
9
13
 
10
14
 
11
15
  class ISessionRepository(ABC):
@@ -13,7 +17,7 @@ class ISessionRepository(ABC):
13
17
 
14
18
  @abstractmethod
15
19
  def find_by_user(
16
- self, user_id: UserId, pagination: PaginationInfo | None = None
20
+ self, user_id: UserId, pagination: PaginationParams | None = None
17
21
  ) -> list[Session]:
18
22
  """Find all sessions for a specific user."""
19
23
  pass
@@ -40,30 +44,81 @@ class ISessionRepository(ABC):
40
44
  """Delete a session belonging to a user."""
41
45
  pass
42
46
 
47
+
48
+ class ITaskRepository(ABC):
49
+ """Interface for task data access operations."""
50
+
43
51
  @abstractmethod
44
- def find_user_session_with_messages(
45
- self, session_id: SessionId, user_id: UserId, pagination: PaginationInfo | None = None
46
- ) -> tuple[Session, list[Message]] | None:
47
- """Find a session with its messages."""
52
+ def save_task(self, task: Task) -> Task:
53
+ """Create or update a task."""
48
54
  pass
49
55
 
56
+ @abstractmethod
57
+ def save_event(self, event: TaskEvent) -> TaskEvent:
58
+ """Save a task event."""
59
+ pass
60
+
61
+ @abstractmethod
62
+ def find_by_id(self, task_id: str) -> Task | None:
63
+ """Find a task by its ID."""
64
+ pass
65
+
66
+ @abstractmethod
67
+ def find_by_id_with_events(self, task_id: str) -> tuple[Task, list[TaskEvent]] | None:
68
+ """Find a task with all its events."""
69
+ pass
70
+
71
+ @abstractmethod
72
+ def search(
73
+ self,
74
+ user_id: UserId,
75
+ start_date: int | None = None,
76
+ end_date: int | None = None,
77
+ search_query: str | None = None,
78
+ pagination: PaginationParams | None = None,
79
+ ) -> list[Task]:
80
+ """Search for tasks with filters."""
81
+ pass
82
+
83
+ @abstractmethod
84
+ def delete_tasks_older_than(self, cutoff_time_ms: int, batch_size: int) -> int:
85
+ """Delete tasks older than cutoff time using batch deletion."""
86
+ pass
87
+
88
+
89
+ class IFeedbackRepository(ABC):
90
+ """Interface for feedback data access operations."""
91
+
92
+ @abstractmethod
93
+ def save(self, feedback: Feedback) -> Feedback:
94
+ """Save feedback."""
95
+ pass
96
+
97
+ @abstractmethod
98
+ def delete_feedback_older_than(self, cutoff_time_ms: int, batch_size: int) -> int:
99
+ """Delete feedback older than cutoff time using batch deletion."""
100
+ pass
101
+
102
+
103
+ class IChatTaskRepository(ABC):
104
+ """Interface for chat task data access operations."""
50
105
 
51
- class IMessageRepository(ABC):
52
- """Interface for message data access operations."""
53
-
54
106
  @abstractmethod
55
- def find_by_session(
56
- self, session_id: SessionId, pagination: PaginationInfo | None = None
57
- ) -> list[Message]:
58
- """Find all messages in a session."""
107
+ def save(self, task: "ChatTask") -> "ChatTask":
108
+ """Save or update a chat task (upsert)."""
59
109
  pass
60
110
 
61
111
  @abstractmethod
62
- def save(self, message: Message) -> Message:
63
- """Save or update a message."""
112
+ def find_by_session(self, session_id: SessionId, user_id: UserId) -> list["ChatTask"]:
113
+ """Find all tasks for a session."""
114
+ pass
115
+
116
+ @abstractmethod
117
+ def find_by_id(self, task_id: str, user_id: UserId) -> Optional["ChatTask"]:
118
+ """Find a specific task."""
64
119
  pass
65
120
 
66
121
  @abstractmethod
67
122
  def delete_by_session(self, session_id: SessionId) -> bool:
68
- """Delete all messages in a session."""
69
- pass
123
+ """Delete all tasks for a session."""
124
+ pass
@@ -3,15 +3,19 @@ SQLAlchemy models and Pydantic models for database persistence.
3
3
  """
4
4
 
5
5
  from .base import Base
6
- from .message_model import MessageModel, CreateMessageModel, UpdateMessageModel
6
+ from .chat_task_model import ChatTaskModel
7
+ from .feedback_model import FeedbackModel
7
8
  from .session_model import SessionModel, CreateSessionModel, UpdateSessionModel
9
+ from .task_event_model import TaskEventModel
10
+ from .task_model import TaskModel
8
11
 
9
12
  __all__ = [
10
13
  "Base",
11
- "MessageModel",
14
+ "ChatTaskModel",
12
15
  "SessionModel",
13
- "CreateMessageModel",
14
- "UpdateMessageModel",
15
16
  "CreateSessionModel",
16
17
  "UpdateSessionModel",
17
- ]
18
+ "TaskEventModel",
19
+ "TaskModel",
20
+ "FeedbackModel",
21
+ ]
@@ -0,0 +1,31 @@
1
+ """
2
+ ChatTask SQLAlchemy model.
3
+ """
4
+
5
+ from sqlalchemy import BigInteger, Column, ForeignKey, String, Text
6
+ from sqlalchemy.orm import relationship
7
+
8
+ from .base import Base
9
+
10
+
11
+ class ChatTaskModel(Base):
12
+ """SQLAlchemy model for chat tasks."""
13
+
14
+ __tablename__ = "chat_tasks"
15
+
16
+ id = Column(String, primary_key=True)
17
+ session_id = Column(
18
+ String,
19
+ ForeignKey("sessions.id", ondelete="CASCADE"),
20
+ nullable=False,
21
+ index=True
22
+ )
23
+ user_id = Column(String, nullable=False, index=True)
24
+ user_message = Column(Text, nullable=True)
25
+ message_bubbles = Column(Text, nullable=False)
26
+ task_metadata = Column(Text, nullable=True)
27
+ created_time = Column(BigInteger, nullable=False, index=True)
28
+ updated_time = Column(BigInteger, nullable=True)
29
+
30
+ # Relationship to session
31
+ session = relationship("SessionModel", back_populates="chat_tasks")
@@ -0,0 +1,21 @@
1
+ """
2
+ Feedback SQLAlchemy model.
3
+ """
4
+
5
+ from sqlalchemy import BigInteger, Column, String, Text
6
+
7
+ from .base import Base
8
+
9
+
10
+ class FeedbackModel(Base):
11
+ """SQLAlchemy model for user feedback."""
12
+
13
+ __tablename__ = "feedback"
14
+
15
+ id = Column(String, primary_key=True)
16
+ session_id = Column(String, nullable=False)
17
+ task_id = Column(String, nullable=False, index=True)
18
+ user_id = Column(String, nullable=False, index=True)
19
+ rating = Column(String, nullable=False) # e.g., 'up', 'down'
20
+ comment = Column(Text, nullable=True)
21
+ created_time = Column(BigInteger, nullable=False)