solace-agent-mesh 1.3.1__py3-none-any.whl → 1.3.3__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.
- solace_agent_mesh/agent/adk/artifacts/filesystem_artifact_service.py +16 -8
- solace_agent_mesh/agent/protocol/event_handlers.py +91 -0
- solace_agent_mesh/agent/sac/app.py +2 -0
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/0e682baa.da822665.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1023fc19.8a8a9309.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.2645ef68.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.43771adc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.2afaee76.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/332e10b5.f7629851.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3d406171.5560fdf9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.3f34bf76.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/442a8107.b5c2532a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/483cef9a.8d318c2f.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/55f47984.bcd00a86.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.dff11eca.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/664b740a.ba305a89.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/75384d09.abdf9cf9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/768e31b0.9abcdc48.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/945fb41e.abf2be91.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9a09e75d.5a319fd4.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.d62aad71.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.1d029b81.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{aba87c2f.071e2d94.js → aba87c2f.4ddf32f2.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/ae0e903d.abca774a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ae4415af.24cdc514.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/bac0be12.27ee2c26.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c2c06897.87cb1f47.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c835a94d.ce21f0bf.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cc969b05.feef7dcc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.a19e7d78.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{cee5d587.f5b73ca1.js → cee5d587.f1e1ca86.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.cad4dbf2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f897a61a.bc634a3e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{main.1c79039d.js → main.e82b32e6.js} +2 -2
- solace_agent_mesh/assets/docs/assets/js/runtime~main.aad1f874.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +18 -18
- solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +23 -23
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +8 -8
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +18 -18
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-python-tools/index.html +8 -8
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +4 -4
- solace_agent_mesh/assets/docs/lunr-index-1757873594308.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1757873594308.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{main-C1k9E0aC.js → main-DjoMeldu.js} +8 -8
- solace_agent_mesh/client/webui/frontend/static/index.html +1 -1
- solace_agent_mesh/common/a2a/__init__.py +4 -0
- solace_agent_mesh/common/a2a/protocol.py +20 -0
- solace_agent_mesh/common/sac/sam_component_base.py +29 -9
- solace_agent_mesh/common/sam_events/__init__.py +9 -0
- solace_agent_mesh/common/sam_events/event_service.py +207 -0
- solace_agent_mesh/gateway/http_sse/alembic/env.py +1 -1
- solace_agent_mesh/gateway/http_sse/component.py +45 -35
- solace_agent_mesh/gateway/http_sse/dependencies.py +123 -60
- solace_agent_mesh/gateway/http_sse/main.py +20 -33
- solace_agent_mesh/gateway/http_sse/repository/__init__.py +37 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/__init__.py +9 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/message.py +41 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session.py +45 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session_history.py +16 -0
- solace_agent_mesh/gateway/http_sse/repository/interfaces.py +64 -0
- solace_agent_mesh/gateway/http_sse/repository/message_repository.py +78 -0
- solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -0
- solace_agent_mesh/gateway/http_sse/repository/models/base.py +7 -0
- solace_agent_mesh/gateway/http_sse/repository/models/message_model.py +27 -0
- solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +27 -0
- solace_agent_mesh/gateway/http_sse/repository/session_repository.py +139 -0
- solace_agent_mesh/gateway/http_sse/routers/config.py +1 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/__init__.py +20 -0
- solace_agent_mesh/gateway/http_sse/{api → routers}/dto/requests/session_requests.py +1 -8
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/__init__.py +16 -0
- solace_agent_mesh/gateway/http_sse/{api → routers}/dto/responses/session_responses.py +3 -30
- solace_agent_mesh/gateway/http_sse/{api/controllers/session_controller.py → routers/sessions.py} +20 -77
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +42 -49
- solace_agent_mesh/gateway/http_sse/{api/controllers/user_controller.py → routers/users.py} +1 -1
- solace_agent_mesh/gateway/http_sse/services/session_service.py +245 -0
- solace_agent_mesh/gateway/http_sse/session_manager.py +0 -3
- solace_agent_mesh/gateway/http_sse/shared/enums.py +0 -5
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/METADATA +1 -1
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/RECORD +120 -128
- solace_agent_mesh/assets/docs/assets/js/0e682baa.b3bbde9a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1023fc19.364235d5.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.1b0ec6f9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.a8c5ce5a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.8909df92.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/332e10b5.7a103f42.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/3d406171.0b9eeed1.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.d97b8e94.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/442a8107.b3159bb2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/483cef9a.4e972867.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/55f47984.cf3781c4.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.0d080cd9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/664b740a.1b744a32.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/75384d09.c193a8f0.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/768e31b0.8b51cd70.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/945fb41e.c63791d1.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/9a09e75d.d6607c56.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.472b0310.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.4b7fa6a2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ae0e903d.4d8dda10.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ae4415af.7a2f0bbf.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/bac0be12.f50d9bac.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/c2c06897.587b4af5.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/c835a94d.146e3186.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/cc969b05.bd3e0d6c.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.b6535013.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.7334119c.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f897a61a.0aa29dbb.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/runtime~main.858117b7.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1757531604543.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1757531604543.json +0 -1
- solace_agent_mesh/gateway/http_sse/ARCHITECTURE_GUIDE.md +0 -676
- solace_agent_mesh/gateway/http_sse/api/__init__.py +0 -11
- solace_agent_mesh/gateway/http_sse/api/controllers/__init__.py +0 -9
- solace_agent_mesh/gateway/http_sse/api/controllers/task_controller.py +0 -279
- solace_agent_mesh/gateway/http_sse/api/dto/requests/__init__.py +0 -37
- solace_agent_mesh/gateway/http_sse/api/dto/requests/task_requests.py +0 -66
- solace_agent_mesh/gateway/http_sse/api/dto/responses/__init__.py +0 -43
- solace_agent_mesh/gateway/http_sse/api/dto/responses/task_responses.py +0 -74
- solace_agent_mesh/gateway/http_sse/application/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/application/services/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/application/services/session_service.py +0 -135
- solace_agent_mesh/gateway/http_sse/domain/entities/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/domain/entities/session.py +0 -90
- solace_agent_mesh/gateway/http_sse/domain/repositories/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/domain/repositories/session_repository.py +0 -54
- solace_agent_mesh/gateway/http_sse/infrastructure/__init__.py +0 -4
- solace_agent_mesh/gateway/http_sse/infrastructure/dependency_injection/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/infrastructure/dependency_injection/container.py +0 -123
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/__init__.py +0 -4
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/database_persistence_service.py +0 -16
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/database_service.py +0 -119
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence/models.py +0 -31
- solace_agent_mesh/gateway/http_sse/infrastructure/persistence_service.py +0 -12
- solace_agent_mesh/gateway/http_sse/infrastructure/repositories/__init__.py +0 -3
- solace_agent_mesh/gateway/http_sse/infrastructure/repositories/session_repository.py +0 -174
- /solace_agent_mesh/assets/docs/assets/js/{main.1c79039d.js.LICENSE.txt → main.e82b32e6.js.LICENSE.txt} +0 -0
- /solace_agent_mesh/gateway/http_sse/{api → routers}/dto/__init__.py +0 -0
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.3.1.dist-info → solace_agent_mesh-1.3.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import uuid
|
|
2
|
+
from datetime import datetime, timezone
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from solace_ai_connector.common.log import log
|
|
6
|
+
|
|
7
|
+
from ..repository import (
|
|
8
|
+
IMessageRepository,
|
|
9
|
+
ISessionRepository,
|
|
10
|
+
Message,
|
|
11
|
+
Session,
|
|
12
|
+
SessionHistory,
|
|
13
|
+
)
|
|
14
|
+
from ..shared.enums import MessageType, SenderType
|
|
15
|
+
from ..shared.types import PaginationInfo, SessionId, UserId
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from ..component import WebUIBackendComponent
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SessionService:
|
|
22
|
+
def __init__(
|
|
23
|
+
self,
|
|
24
|
+
session_repository: ISessionRepository,
|
|
25
|
+
message_repository: IMessageRepository,
|
|
26
|
+
component: "WebUIBackendComponent" = None,
|
|
27
|
+
):
|
|
28
|
+
self.session_repository = session_repository
|
|
29
|
+
self.message_repository = message_repository
|
|
30
|
+
self.component = component
|
|
31
|
+
|
|
32
|
+
def get_user_sessions(
|
|
33
|
+
self, user_id: UserId, pagination: PaginationInfo | None = None
|
|
34
|
+
) -> list[Session]:
|
|
35
|
+
if not user_id or user_id.strip() == "":
|
|
36
|
+
raise ValueError("User ID cannot be empty")
|
|
37
|
+
|
|
38
|
+
return self.session_repository.find_by_user(user_id, pagination)
|
|
39
|
+
|
|
40
|
+
def get_session_details(
|
|
41
|
+
self, session_id: SessionId, user_id: UserId
|
|
42
|
+
) -> Session | None:
|
|
43
|
+
if not self._is_valid_session_id(session_id):
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
return self.session_repository.find_user_session(session_id, user_id)
|
|
47
|
+
|
|
48
|
+
def get_session_history(
|
|
49
|
+
self,
|
|
50
|
+
session_id: SessionId,
|
|
51
|
+
user_id: UserId,
|
|
52
|
+
pagination: PaginationInfo | None = None,
|
|
53
|
+
) -> SessionHistory | None:
|
|
54
|
+
if not self._is_valid_session_id(session_id):
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
result = self.session_repository.find_user_session_with_messages(
|
|
58
|
+
session_id, user_id, pagination
|
|
59
|
+
)
|
|
60
|
+
if not result:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
session, messages = result
|
|
64
|
+
return SessionHistory(
|
|
65
|
+
session=session,
|
|
66
|
+
messages=messages,
|
|
67
|
+
total_message_count=len(messages),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
def create_session(
|
|
71
|
+
self,
|
|
72
|
+
user_id: UserId,
|
|
73
|
+
name: str | None = None,
|
|
74
|
+
agent_id: str | None = None,
|
|
75
|
+
session_id: str | None = None,
|
|
76
|
+
) -> Session:
|
|
77
|
+
if not user_id or user_id.strip() == "":
|
|
78
|
+
raise ValueError("User ID cannot be empty")
|
|
79
|
+
|
|
80
|
+
if not session_id:
|
|
81
|
+
session_id = str(uuid.uuid4())
|
|
82
|
+
|
|
83
|
+
# Leave name as None/empty - frontend will generate display name if needed
|
|
84
|
+
|
|
85
|
+
now = datetime.now(timezone.utc)
|
|
86
|
+
session = Session(
|
|
87
|
+
id=session_id,
|
|
88
|
+
user_id=user_id,
|
|
89
|
+
name=name,
|
|
90
|
+
agent_id=agent_id,
|
|
91
|
+
created_at=now,
|
|
92
|
+
updated_at=now,
|
|
93
|
+
last_activity=now,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
created_session = self.session_repository.save(session)
|
|
97
|
+
log.info("Created new session %s for user %s", created_session.id, user_id)
|
|
98
|
+
|
|
99
|
+
return created_session
|
|
100
|
+
|
|
101
|
+
def update_session_name(
|
|
102
|
+
self, session_id: SessionId, user_id: UserId, name: str
|
|
103
|
+
) -> Session | None:
|
|
104
|
+
if not self._is_valid_session_id(session_id):
|
|
105
|
+
raise ValueError("Invalid session ID")
|
|
106
|
+
|
|
107
|
+
if not name or len(name.strip()) == 0:
|
|
108
|
+
raise ValueError("Session name cannot be empty")
|
|
109
|
+
|
|
110
|
+
if len(name.strip()) > 255:
|
|
111
|
+
raise ValueError("Session name cannot exceed 255 characters")
|
|
112
|
+
|
|
113
|
+
session = self.session_repository.find_user_session(session_id, user_id)
|
|
114
|
+
if not session:
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
session.update_name(name)
|
|
118
|
+
updated_session = self.session_repository.save(session)
|
|
119
|
+
|
|
120
|
+
log.info("Updated session %s name to '%s'", session_id, name)
|
|
121
|
+
return updated_session
|
|
122
|
+
|
|
123
|
+
def delete_session_with_notifications(
|
|
124
|
+
self, session_id: SessionId, user_id: UserId
|
|
125
|
+
) -> bool:
|
|
126
|
+
if not self._is_valid_session_id(session_id):
|
|
127
|
+
raise ValueError("Invalid session ID")
|
|
128
|
+
|
|
129
|
+
session = self.session_repository.find_user_session(session_id, user_id)
|
|
130
|
+
if not session:
|
|
131
|
+
log.warning(
|
|
132
|
+
"Attempted to delete non-existent session %s by user %s",
|
|
133
|
+
session_id,
|
|
134
|
+
user_id,
|
|
135
|
+
)
|
|
136
|
+
return False
|
|
137
|
+
|
|
138
|
+
agent_id = session.agent_id
|
|
139
|
+
|
|
140
|
+
if not session.can_be_deleted_by_user(user_id):
|
|
141
|
+
log.warning(
|
|
142
|
+
"User %s not authorized to delete session %s", user_id, session_id
|
|
143
|
+
)
|
|
144
|
+
return False
|
|
145
|
+
|
|
146
|
+
deleted = self.session_repository.delete(session_id, user_id)
|
|
147
|
+
if not deleted:
|
|
148
|
+
return False
|
|
149
|
+
|
|
150
|
+
log.info("Session %s deleted successfully by user %s", session_id, user_id)
|
|
151
|
+
|
|
152
|
+
if agent_id and self.component:
|
|
153
|
+
self._notify_agent_of_session_deletion(session_id, user_id, agent_id)
|
|
154
|
+
|
|
155
|
+
return True
|
|
156
|
+
|
|
157
|
+
def add_message_to_session(
|
|
158
|
+
self,
|
|
159
|
+
session_id: SessionId,
|
|
160
|
+
user_id: UserId,
|
|
161
|
+
message: str,
|
|
162
|
+
sender_type: SenderType,
|
|
163
|
+
sender_name: str,
|
|
164
|
+
agent_id: str | None = None,
|
|
165
|
+
message_type: MessageType = MessageType.TEXT,
|
|
166
|
+
) -> Message:
|
|
167
|
+
if not self._is_valid_session_id(session_id):
|
|
168
|
+
raise ValueError("Invalid session ID")
|
|
169
|
+
|
|
170
|
+
if not message or message.strip() == "":
|
|
171
|
+
raise ValueError("Message cannot be empty")
|
|
172
|
+
|
|
173
|
+
session = self.session_repository.find_user_session(session_id, user_id)
|
|
174
|
+
if not session:
|
|
175
|
+
session = self.create_session(
|
|
176
|
+
user_id=user_id,
|
|
177
|
+
agent_id=agent_id,
|
|
178
|
+
session_id=session_id,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
message_entity = Message(
|
|
182
|
+
id=str(uuid.uuid4()),
|
|
183
|
+
session_id=session_id,
|
|
184
|
+
message=message.strip(),
|
|
185
|
+
sender_type=sender_type,
|
|
186
|
+
sender_name=sender_name,
|
|
187
|
+
message_type=message_type,
|
|
188
|
+
created_at=datetime.now(timezone.utc),
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
saved_message = self.message_repository.save(message_entity)
|
|
192
|
+
|
|
193
|
+
session.mark_activity()
|
|
194
|
+
self.session_repository.save(session)
|
|
195
|
+
|
|
196
|
+
log.info("Added message to session %s from %s", session_id, sender_name)
|
|
197
|
+
return saved_message
|
|
198
|
+
|
|
199
|
+
def _is_valid_session_id(self, session_id: SessionId) -> bool:
|
|
200
|
+
return (
|
|
201
|
+
session_id is not None
|
|
202
|
+
and session_id.strip() != ""
|
|
203
|
+
and session_id not in ["null", "undefined"]
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
def _notify_agent_of_session_deletion(
|
|
207
|
+
self, session_id: SessionId, user_id: UserId, agent_id: str
|
|
208
|
+
) -> None:
|
|
209
|
+
try:
|
|
210
|
+
log.info(
|
|
211
|
+
"Publishing session deletion event for session %s (agent %s, user %s)",
|
|
212
|
+
session_id,
|
|
213
|
+
agent_id,
|
|
214
|
+
user_id,
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
if hasattr(self.component, "sam_events"):
|
|
218
|
+
success = self.component.sam_events.publish_session_deleted(
|
|
219
|
+
session_id=session_id,
|
|
220
|
+
user_id=user_id,
|
|
221
|
+
agent_id=agent_id,
|
|
222
|
+
gateway_id=self.component.gateway_id,
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
if success:
|
|
226
|
+
log.info(
|
|
227
|
+
"Successfully published session deletion event for session %s",
|
|
228
|
+
session_id,
|
|
229
|
+
)
|
|
230
|
+
else:
|
|
231
|
+
log.warning(
|
|
232
|
+
"Failed to publish session deletion event for session %s",
|
|
233
|
+
session_id,
|
|
234
|
+
)
|
|
235
|
+
else:
|
|
236
|
+
log.warning(
|
|
237
|
+
"SAM Events not available for session deletion notification"
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
except Exception as e:
|
|
241
|
+
log.warning(
|
|
242
|
+
"Failed to publish session deletion event to agent %s: %s",
|
|
243
|
+
agent_id,
|
|
244
|
+
e,
|
|
245
|
+
)
|
|
@@ -9,7 +9,6 @@ from typing import Any
|
|
|
9
9
|
from solace_ai_connector.common.log import log
|
|
10
10
|
from starlette.requests import Request
|
|
11
11
|
|
|
12
|
-
from .infrastructure.persistence_service import PersistenceService
|
|
13
12
|
|
|
14
13
|
SESSION_KEY_CLIENT_ID = "a2a_client_id"
|
|
15
14
|
SESSION_KEY_SESSION_ID = "a2a_session_id"
|
|
@@ -28,14 +27,12 @@ class SessionManager:
|
|
|
28
27
|
self,
|
|
29
28
|
secret_key: str,
|
|
30
29
|
app_config: dict[str, Any],
|
|
31
|
-
persistence_service: "PersistenceService",
|
|
32
30
|
):
|
|
33
31
|
if not secret_key:
|
|
34
32
|
raise ValueError("Session secret key cannot be empty.")
|
|
35
33
|
self.secret_key = secret_key
|
|
36
34
|
self.force_user_identity = app_config.get("force_user_identity")
|
|
37
35
|
self.use_authorization = app_config.get("frontend_use_authorization", False)
|
|
38
|
-
self.persistence_service = persistence_service
|
|
39
36
|
self._temp_code_cache = {}
|
|
40
37
|
log.info("[SessionManager] Initialized.")
|
|
41
38
|
if self.force_user_identity:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: solace-agent-mesh
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Solace Agent Mesh is an open-source framework for building event-driven, multi-agent AI systems where specialized agents collaborate on complex tasks.
|
|
5
5
|
Project-URL: Homepage, https://github.com/SolaceLabs/solace-agent-mesh
|
|
6
6
|
Project-URL: Repository, https://github.com/SolaceLabs/solace-agent-mesh
|