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.
- solace_agent_mesh/agent/adk/adk_llm.txt +3 -4
- solace_agent_mesh/agent/adk/adk_llm_detail.txt +566 -0
- solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
- solace_agent_mesh/agent/adk/artifacts/s3_artifact_service.py +1 -0
- solace_agent_mesh/agent/adk/callbacks.py +51 -2
- solace_agent_mesh/agent/adk/models/lite_llm.py +1 -0
- solace_agent_mesh/agent/adk/models/models_llm.txt +1 -2
- solace_agent_mesh/agent/adk/services.py +30 -15
- solace_agent_mesh/agent/adk/setup.py +4 -0
- solace_agent_mesh/agent/agent_llm.txt +1 -1
- solace_agent_mesh/agent/agent_llm_detail.txt +1702 -0
- solace_agent_mesh/agent/protocol/event_handlers.py +2 -13
- solace_agent_mesh/agent/protocol/protocol_llm.txt +15 -2
- solace_agent_mesh/agent/protocol/protocol_llm_detail.txt +92 -0
- solace_agent_mesh/agent/sac/component.py +51 -21
- solace_agent_mesh/agent/sac/sac_llm.txt +15 -1
- solace_agent_mesh/agent/sac/sac_llm_detail.txt +200 -0
- solace_agent_mesh/agent/sac/task_execution_context.py +73 -0
- solace_agent_mesh/agent/testing/testing_llm_detail.txt +68 -0
- solace_agent_mesh/agent/tools/tools_llm.txt +148 -154
- solace_agent_mesh/agent/tools/tools_llm_detail.txt +274 -0
- solace_agent_mesh/agent/utils/utils_llm.txt +1 -1
- solace_agent_mesh/agent/utils/utils_llm_detail.txt +149 -0
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/0e682baa.d54b8668.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/483cef9a.bf9398af.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{main.dc155742.js → main.0c149855.js} +2 -2
- solace_agent_mesh/assets/docs/assets/js/{runtime~main.0d2ff2b6.js → runtime~main.c66557e4.js} +1 -1
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/rbac-setup-guilde/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +8 -4
- 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
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +3 -3
- 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 +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +3 -3
- 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 +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/litellm_models/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +7 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +3 -3
- 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 +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +3 -3
- 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 +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-python-tools/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +3 -3
- 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 +3 -3
- solace_agent_mesh/assets/docs/lunr-index-1760032255022.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1760032255022.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/{authCallback-j1LW-wlq.js → authCallback-DwrxZE0E.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{client-B9p_nFNA.js → client-DarGQzyw.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-CZbpmwfA.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-C__uuUkB.js +339 -0
- solace_agent_mesh/client/webui/frontend/static/assets/{vendor-CS5YMf8a.js → vendor-BKIeiHj_.js} +80 -70
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
- solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
- solace_agent_mesh/common/a2a/a2a_llm.txt +1 -1
- solace_agent_mesh/common/a2a/a2a_llm_detail.txt +193 -0
- solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +1 -1
- solace_agent_mesh/common/a2a_spec/a2a_spec_llm_detail.txt +736 -0
- solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +23 -0
- solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +93 -15
- solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +23 -0
- solace_agent_mesh/common/common_llm.txt +24 -39
- solace_agent_mesh/common/common_llm_detail.txt +2562 -0
- solace_agent_mesh/common/data_parts.py +9 -1
- solace_agent_mesh/common/middleware/middleware_llm_detail.txt +185 -0
- solace_agent_mesh/common/sac/sac_llm.txt +1 -1
- solace_agent_mesh/common/sac/sac_llm_detail.txt +82 -0
- solace_agent_mesh/common/sam_events/sam_events_llm.txt +104 -0
- solace_agent_mesh/common/sam_events/sam_events_llm_detail.txt +115 -0
- solace_agent_mesh/common/services/identity_service.py +7 -4
- solace_agent_mesh/common/services/providers/local_file_identity_service.py +4 -2
- solace_agent_mesh/common/services/services_llm.txt +57 -6
- solace_agent_mesh/common/services/services_llm_detail.txt +459 -0
- solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
- solace_agent_mesh/common/utils/utils_llm.txt +75 -87
- solace_agent_mesh/common/utils/utils_llm_detail.txt +572 -0
- solace_agent_mesh/core_a2a/core_a2a_llm_detail.txt +101 -0
- solace_agent_mesh/gateway/base/app.py +1 -1
- solace_agent_mesh/gateway/base/base_llm.txt +1 -1
- solace_agent_mesh/gateway/base/base_llm_detail.txt +235 -0
- solace_agent_mesh/gateway/base/component.py +1 -1
- solace_agent_mesh/gateway/gateway_llm.txt +242 -235
- solace_agent_mesh/gateway/gateway_llm_detail.txt +3885 -0
- solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +295 -0
- solace_agent_mesh/gateway/http_sse/alembic/env.py +10 -1
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251006_98882922fa59_add_tasks_events_feedback_chat_tasks.py +190 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +155 -0
- solace_agent_mesh/gateway/http_sse/alembic.ini +1 -1
- solace_agent_mesh/gateway/http_sse/app.py +148 -2
- solace_agent_mesh/gateway/http_sse/component.py +368 -60
- solace_agent_mesh/gateway/http_sse/components/components_llm.txt +46 -6
- solace_agent_mesh/gateway/http_sse/components/task_logger_forwarder.py +108 -0
- solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +1 -1
- solace_agent_mesh/gateway/http_sse/dependencies.py +116 -26
- solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +172 -172
- solace_agent_mesh/gateway/http_sse/http_sse_llm_detail.txt +3278 -0
- solace_agent_mesh/gateway/http_sse/main.py +146 -41
- solace_agent_mesh/gateway/http_sse/repository/__init__.py +3 -12
- solace_agent_mesh/gateway/http_sse/repository/chat_task_repository.py +103 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/__init__.py +5 -3
- solace_agent_mesh/gateway/http_sse/repository/entities/chat_task.py +75 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +263 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/feedback.py +20 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session_history.py +0 -16
- solace_agent_mesh/gateway/http_sse/repository/entities/task.py +25 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/task_event.py +21 -0
- solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +81 -0
- solace_agent_mesh/gateway/http_sse/repository/interfaces.py +73 -18
- solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -5
- solace_agent_mesh/gateway/http_sse/repository/models/chat_task_model.py +31 -0
- solace_agent_mesh/gateway/http_sse/repository/models/feedback_model.py +21 -0
- solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +266 -0
- solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +3 -3
- solace_agent_mesh/gateway/http_sse/repository/models/task_event_model.py +25 -0
- solace_agent_mesh/gateway/http_sse/repository/models/task_model.py +32 -0
- solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +340 -0
- solace_agent_mesh/gateway/http_sse/repository/session_repository.py +4 -53
- solace_agent_mesh/gateway/http_sse/repository/task_repository.py +173 -0
- solace_agent_mesh/gateway/http_sse/routers/artifacts.py +1 -1
- solace_agent_mesh/gateway/http_sse/routers/config.py +26 -4
- solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +346 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/__init__.py +3 -3
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +83 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +2 -10
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/task_requests.py +58 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/__init__.py +5 -3
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +107 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +1 -15
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/task_responses.py +30 -0
- solace_agent_mesh/gateway/http_sse/routers/feedback.py +37 -0
- solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +255 -204
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +220 -40
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +168 -42
- solace_agent_mesh/gateway/http_sse/services/data_retention_service.py +272 -0
- solace_agent_mesh/gateway/http_sse/services/feedback_service.py +241 -0
- solace_agent_mesh/gateway/http_sse/services/people_service.py +0 -80
- solace_agent_mesh/gateway/http_sse/services/services_llm.txt +177 -13
- solace_agent_mesh/gateway/http_sse/services/session_service.py +151 -84
- solace_agent_mesh/gateway/http_sse/services/task_logger_service.py +317 -0
- solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +25 -14
- solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +285 -0
- solace_agent_mesh/gateway/http_sse/shared/types.py +7 -0
- solace_agent_mesh/gateway/http_sse/utils/__init__.py +1 -0
- solace_agent_mesh/gateway/http_sse/utils/stim_utils.py +32 -0
- solace_agent_mesh/gateway/http_sse/utils/utils_llm.txt +47 -0
- solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
- solace_agent_mesh/solace_agent_mesh_llm_detail.txt +8599 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/METADATA +1 -1
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/RECORD +179 -131
- solace_agent_mesh/agent/adk/invocation_monitor.py +0 -295
- solace_agent_mesh/assets/docs/assets/js/0e682baa.d054e1d8.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/483cef9a.4736f2d8.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1759514789087.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1759514789087.json +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-ChRwcV89.css +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-DnnE01OM.js +0 -339
- solace_agent_mesh/gateway/http_sse/repository/entities/message.py +0 -41
- solace_agent_mesh/gateway/http_sse/repository/message_repository.py +0 -84
- solace_agent_mesh/gateway/http_sse/repository/models/message_model.py +0 -45
- /solace_agent_mesh/assets/docs/assets/js/{main.dc155742.js.LICENSE.txt → main.0c149855.js.LICENSE.txt} +0 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.4.11.dist-info → solace_agent_mesh-1.5.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# DEVELOPER GUIDE: shared
|
|
2
|
+
|
|
3
|
+
## Quick Summary
|
|
4
|
+
The `shared` directory contains common utilities, constants, enums, types, and exception handling used across all layers of the HTTP SSE gateway. It provides authentication helpers, timestamp utilities, standardized exception handling, database utilities, pagination support, and response formatting for consistent API behavior.
|
|
5
|
+
|
|
6
|
+
## Files Overview
|
|
7
|
+
- `__init__.py` - Central exports for all shared utilities and components
|
|
8
|
+
- `auth_utils.py` - Authentication utilities for FastAPI applications
|
|
9
|
+
- `timestamp_utils.py` - Epoch timestamp utilities matching Java backend patterns
|
|
10
|
+
- `exceptions.py` - Generic web exceptions for HTTP/REST APIs
|
|
11
|
+
- `error_dto.py` - Standardized error response DTOs
|
|
12
|
+
- `exception_handlers.py` - FastAPI exception handlers for consistent HTTP error responses
|
|
13
|
+
- `base_repository.py` - Base repository classes with proper transaction management
|
|
14
|
+
- `pagination.py` - Pagination utilities for API responses
|
|
15
|
+
- `database_exceptions.py` - Database exception handling and conversion
|
|
16
|
+
- `database_helpers.py` - Database utility functions and custom types
|
|
17
|
+
- `response_utils.py` - Standardized response formatting utilities
|
|
18
|
+
- `enums.py` - Enumerations for message types, task status, and validation errors
|
|
19
|
+
- `types.py` - Custom types and type aliases for better type safety
|
|
20
|
+
- `utils.py` - Generic utility functions
|
|
21
|
+
|
|
22
|
+
## Developer API Reference
|
|
23
|
+
|
|
24
|
+
### auth_utils.py
|
|
25
|
+
**Purpose:** Provides authentication utilities for FastAPI controllers
|
|
26
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import get_current_user`
|
|
27
|
+
|
|
28
|
+
**Functions:**
|
|
29
|
+
- `get_current_user(request: FastAPIRequest) -> dict` - Extracts authenticated user from request state, returns user info or anonymous default
|
|
30
|
+
|
|
31
|
+
**Usage Examples:**
|
|
32
|
+
```python
|
|
33
|
+
from fastapi import Depends
|
|
34
|
+
from solace_agent_mesh.gateway.http_sse.shared import get_current_user
|
|
35
|
+
|
|
36
|
+
@app.get("/protected")
|
|
37
|
+
async def protected_endpoint(user: dict = Depends(get_current_user)):
|
|
38
|
+
return {"user_id": user["id"], "name": user["name"]}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### timestamp_utils.py
|
|
42
|
+
**Purpose:** Provides epoch timestamp utilities for database portability and timezone handling
|
|
43
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import now_epoch_ms, epoch_ms_to_iso8601, iso8601_to_epoch_ms`
|
|
44
|
+
|
|
45
|
+
**Functions:**
|
|
46
|
+
- `now_epoch_ms() -> int` - Get current time as milliseconds since epoch
|
|
47
|
+
- `epoch_ms_to_iso8601(epoch_ms: int) -> str` - Convert epoch milliseconds to ISO 8601 string
|
|
48
|
+
- `iso8601_to_epoch_ms(iso8601_string: str) -> int` - Convert ISO 8601 string to epoch milliseconds
|
|
49
|
+
- `datetime_to_epoch_ms(dt: datetime) -> int` - Convert datetime object to epoch milliseconds
|
|
50
|
+
- `epoch_ms_to_datetime(epoch_ms: int) -> datetime` - Convert epoch milliseconds to datetime object
|
|
51
|
+
- `validate_epoch_ms(epoch_ms: int | None) -> bool` - Validate that an epoch milliseconds value is reasonable
|
|
52
|
+
|
|
53
|
+
**Usage Examples:**
|
|
54
|
+
```python
|
|
55
|
+
from solace_agent_mesh.gateway.http_sse.shared import (
|
|
56
|
+
now_epoch_ms, epoch_ms_to_iso8601, iso8601_to_epoch_ms
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Get current timestamp for database storage
|
|
60
|
+
created_time = now_epoch_ms()
|
|
61
|
+
|
|
62
|
+
# Convert for API response
|
|
63
|
+
iso_string = epoch_ms_to_iso8601(created_time)
|
|
64
|
+
|
|
65
|
+
# Parse from API request
|
|
66
|
+
timestamp = iso8601_to_epoch_ms("2024-01-01T00:00:00Z")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### exceptions.py
|
|
70
|
+
**Purpose:** Generic web exceptions for HTTP/REST APIs
|
|
71
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import ValidationError, EntityNotFoundError, EntityAlreadyExistsError`
|
|
72
|
+
|
|
73
|
+
**Classes:**
|
|
74
|
+
- `WebUIBackendException(message: str, details: Optional[Dict[str, Any]] = None)` - Base exception for all web UI backend errors
|
|
75
|
+
- `ValidationError(message: str, validation_details: Optional[Dict[str, List[str]]] = None, entity_type: Optional[str] = None, entity_identifier: Optional[str] = None)` - Exception for validation errors with field-level details
|
|
76
|
+
- `EntityNotFoundError(entity_type: str, entity_id: str)` - Generic exception for when an entity is not found
|
|
77
|
+
- `EntityAlreadyExistsError(entity_type: str, identifier: str, value: Any = None)` - Exception for when an entity already exists
|
|
78
|
+
- `BusinessRuleViolationError(rule: str, message: str)` - Exception for business rule violations
|
|
79
|
+
- `ConfigurationError(component: str, message: str)` - Exception for configuration-related errors
|
|
80
|
+
- `DataIntegrityError(constraint: str, message: str)` - Exception for data integrity violations
|
|
81
|
+
- `ExternalServiceError(service: str, message: str, status_code: Optional[int] = None)` - Exception for external service communication errors
|
|
82
|
+
- `ValidationErrorBuilder()` - Builder for constructing ValidationError instances with fluent API
|
|
83
|
+
|
|
84
|
+
**Usage Examples:**
|
|
85
|
+
```python
|
|
86
|
+
from solace_agent_mesh.gateway.http_sse.shared import (
|
|
87
|
+
ValidationError, EntityNotFoundError, ValidationErrorBuilder
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Simple validation error
|
|
91
|
+
raise ValidationError("Invalid input data")
|
|
92
|
+
|
|
93
|
+
# Entity not found
|
|
94
|
+
raise EntityNotFoundError("User", "123")
|
|
95
|
+
|
|
96
|
+
# Complex validation with builder
|
|
97
|
+
error = ValidationError.builder() \
|
|
98
|
+
.message("Invalid user data") \
|
|
99
|
+
.validation_detail("email", ["Invalid email format"]) \
|
|
100
|
+
.entity_type("User") \
|
|
101
|
+
.build()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### error_dto.py
|
|
105
|
+
**Purpose:** Standardized error response DTOs for HTTP APIs
|
|
106
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import EventErrorDTO`
|
|
107
|
+
|
|
108
|
+
**Classes:**
|
|
109
|
+
- `EventErrorDTO(message: str, validationDetails: Optional[Dict[str, List[str]]] = None)` - Simplified and standardized error response format
|
|
110
|
+
- `create(message: str, validation_details: Optional[Dict[str, List[str]]] = None) -> EventErrorDTO` - Create a new EventErrorDTO
|
|
111
|
+
- `not_found(entity_type: str, entity_id: str) -> EventErrorDTO` - Create a 404 Not Found error
|
|
112
|
+
- `validation_error(message: str, validation_details: Dict[str, List[str]]) -> EventErrorDTO` - Create a validation error
|
|
113
|
+
|
|
114
|
+
**Usage Examples:**
|
|
115
|
+
```python
|
|
116
|
+
from solace_agent_mesh.gateway.http_sse.shared import EventErrorDTO
|
|
117
|
+
|
|
118
|
+
# Simple error
|
|
119
|
+
error = EventErrorDTO.create("Something went wrong")
|
|
120
|
+
|
|
121
|
+
# Not found error
|
|
122
|
+
error = EventErrorDTO.not_found("User", "123")
|
|
123
|
+
|
|
124
|
+
# Validation error
|
|
125
|
+
error = EventErrorDTO.validation_error(
|
|
126
|
+
"Invalid data",
|
|
127
|
+
{"email": ["Invalid format"], "age": ["Must be positive"]}
|
|
128
|
+
)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### exception_handlers.py
|
|
132
|
+
**Purpose:** FastAPI exception handlers for consistent HTTP error responses
|
|
133
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import register_exception_handlers`
|
|
134
|
+
|
|
135
|
+
**Functions:**
|
|
136
|
+
- `register_exception_handlers(app)` - Register all exception handlers with a FastAPI app
|
|
137
|
+
- `create_error_response(status_code: int, message: str, validation_details: dict = None) -> JSONResponse` - Create standardized error response
|
|
138
|
+
|
|
139
|
+
**Usage Examples:**
|
|
140
|
+
```python
|
|
141
|
+
from fastapi import FastAPI
|
|
142
|
+
from solace_agent_mesh.gateway.http_sse.shared import register_exception_handlers
|
|
143
|
+
|
|
144
|
+
app = FastAPI()
|
|
145
|
+
register_exception_handlers(app)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### base_repository.py
|
|
149
|
+
**Purpose:** Base repository classes with proper transaction management
|
|
150
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import BaseRepository, PaginatedRepository, ValidationMixin`
|
|
151
|
+
|
|
152
|
+
**Classes:**
|
|
153
|
+
- `BaseRepository(model_class: Type[ModelType], entity_class: Type[EntityType])` - Abstract base class for repositories
|
|
154
|
+
- `create(session: Session, create_data: Dict[str, Any]) -> EntityType` - Create a new entity
|
|
155
|
+
- `get_by_id(session: Session, entity_id: Any) -> EntityType` - Get entity by ID
|
|
156
|
+
- `get_all(session: Session, limit: Optional[int] = None, offset: Optional[int] = None) -> List[EntityType]` - Get all entities
|
|
157
|
+
- `update(session: Session, entity_id: Any, update_data: Dict[str, Any]) -> EntityType` - Update an entity
|
|
158
|
+
- `delete(session: Session, entity_id: Any) -> None` - Delete an entity
|
|
159
|
+
- `PaginatedRepository(model_class: Type[ModelType], entity_class: Type[EntityType])` - Base repository with enhanced pagination support
|
|
160
|
+
- `get_paginated(session: Session, page_number: int, page_size: int) -> tuple[List[EntityType], int]` - Get paginated results
|
|
161
|
+
- `ValidationMixin` - Mixin for repositories that need validation logic
|
|
162
|
+
|
|
163
|
+
**Usage Examples:**
|
|
164
|
+
```python
|
|
165
|
+
from solace_agent_mesh.gateway.http_sse.shared import BaseRepository
|
|
166
|
+
from sqlalchemy.orm import Session
|
|
167
|
+
|
|
168
|
+
class UserRepository(BaseRepository[UserModel, UserEntity]):
|
|
169
|
+
@property
|
|
170
|
+
def entity_name(self) -> str:
|
|
171
|
+
return "User"
|
|
172
|
+
|
|
173
|
+
# Usage
|
|
174
|
+
repo = UserRepository(UserModel, UserEntity)
|
|
175
|
+
user = repo.create(session, {"name": "John", "email": "john@example.com"})
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### pagination.py
|
|
179
|
+
**Purpose:** Pagination utilities for API responses
|
|
180
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import PaginationParams, PaginatedResponse, DataResponse`
|
|
181
|
+
|
|
182
|
+
**Classes:**
|
|
183
|
+
- `PaginationParams(page_number: int = 1, page_size: int = 20)` - Request parameters for pagination
|
|
184
|
+
- `offset: int` - Calculate the offset for database queries
|
|
185
|
+
- `PaginatedResponse[T](data: list[T], meta: Meta)` - Generic paginated response with data and metadata
|
|
186
|
+
- `create(data: list[T], total_count: int, pagination: PaginationParams) -> PaginatedResponse[T]` - Create paginated response
|
|
187
|
+
- `DataResponse[T](data: T)` - Simple data response wrapper
|
|
188
|
+
- `create(data: T) -> DataResponse[T]` - Create data response
|
|
189
|
+
|
|
190
|
+
**Usage Examples:**
|
|
191
|
+
```python
|
|
192
|
+
from solace_agent_mesh.gateway.http_sse.shared import PaginationParams, PaginatedResponse
|
|
193
|
+
|
|
194
|
+
# Create pagination params
|
|
195
|
+
pagination = PaginationParams(page_number=1, page_size=20)
|
|
196
|
+
|
|
197
|
+
# Create paginated response
|
|
198
|
+
response = PaginatedResponse.create(users, total_count=100, pagination=pagination)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### response_utils.py
|
|
202
|
+
**Purpose:** Standardized response formatting utilities
|
|
203
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import create_data_response, create_paginated_response, StandardResponseMixin`
|
|
204
|
+
|
|
205
|
+
**Functions:**
|
|
206
|
+
- `create_data_response(data: T) -> DataResponse[T]` - Create a standardized data response
|
|
207
|
+
- `create_paginated_response(data: List[T], total_count: int, pagination_params: PaginationParams) -> PaginatedResponse[T]` - Create a standardized paginated response
|
|
208
|
+
- `create_success_response(message: str = "Success") -> DataResponse[Dict[str, str]]` - Create a standardized success response
|
|
209
|
+
- `create_list_response(items: List[T]) -> DataResponse[List[T]]` - Create a standardized list response
|
|
210
|
+
|
|
211
|
+
**Classes:**
|
|
212
|
+
- `StandardResponseMixin` - Mixin class to add standard response methods to services or controllers
|
|
213
|
+
|
|
214
|
+
**Usage Examples:**
|
|
215
|
+
```python
|
|
216
|
+
from solace_agent_mesh.gateway.http_sse.shared import create_data_response, create_paginated_response
|
|
217
|
+
|
|
218
|
+
# Simple data response
|
|
219
|
+
response = create_data_response({"id": 1, "name": "test"})
|
|
220
|
+
|
|
221
|
+
# Paginated response
|
|
222
|
+
response = create_paginated_response(users, 100, pagination_params)
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### database_exceptions.py
|
|
226
|
+
**Purpose:** Database exception handling and conversion
|
|
227
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import DatabaseExceptionHandler, handle_database_errors`
|
|
228
|
+
|
|
229
|
+
**Classes:**
|
|
230
|
+
- `DatabaseExceptionHandler` - Centralized handler for converting SQLAlchemy exceptions to domain exceptions
|
|
231
|
+
- `handle_integrity_error(e: IntegrityError, entity_type: str = "Resource") -> ValidationError` - Convert integrity constraint violations
|
|
232
|
+
- `handle_operational_error(e: OperationalError, entity_type: str = "Resource") -> DataIntegrityError` - Handle operational errors
|
|
233
|
+
|
|
234
|
+
**Functions:**
|
|
235
|
+
- `handle_database_errors(entity_type: str = "Resource")` - Convenience decorator for database exception handling
|
|
236
|
+
|
|
237
|
+
**Usage Examples:**
|
|
238
|
+
```python
|
|
239
|
+
from solace_agent_mesh.gateway.http_sse.shared import handle_database_errors
|
|
240
|
+
|
|
241
|
+
class UserRepository:
|
|
242
|
+
@handle_database_errors("User")
|
|
243
|
+
def create_user(self, session, data):
|
|
244
|
+
# Repository method implementation
|
|
245
|
+
pass
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### database_helpers.py
|
|
249
|
+
**Purpose:** Database utility functions and custom types
|
|
250
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import SimpleJSON`
|
|
251
|
+
|
|
252
|
+
**Classes:**
|
|
253
|
+
- `SimpleJSON(TypeDecorator)` - Simple JSON type using Text storage for all databases
|
|
254
|
+
|
|
255
|
+
**Usage Examples:**
|
|
256
|
+
```python
|
|
257
|
+
from sqlalchemy import Column, String
|
|
258
|
+
from solace_agent_mesh.gateway.http_sse.shared import SimpleJSON
|
|
259
|
+
|
|
260
|
+
class MyModel(Base):
|
|
261
|
+
id = Column(String, primary_key=True)
|
|
262
|
+
metadata = Column(SimpleJSON) # Stores JSON as text
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### utils.py
|
|
266
|
+
**Purpose:** Generic utility functions
|
|
267
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.shared import generate_uuid, to_snake_case, to_pascal_case`
|
|
268
|
+
|
|
269
|
+
**Functions:**
|
|
270
|
+
- `generate_uuid() -> str` - Generate a UUID string for database storage
|
|
271
|
+
- `to_snake_case(name: str) -> str` - Convert a string to snake_case
|
|
272
|
+
- `to_pascal_case(name: str) -> str` - Convert a string to PascalCase
|
|
273
|
+
|
|
274
|
+
**Usage Examples:**
|
|
275
|
+
```python
|
|
276
|
+
from solace_agent_mesh.gateway.http_sse.shared import generate_uuid, to_snake_case
|
|
277
|
+
|
|
278
|
+
# Generate unique ID
|
|
279
|
+
user_id = generate_uuid()
|
|
280
|
+
|
|
281
|
+
# Convert naming
|
|
282
|
+
snake_name = to_snake_case("User Name") # "user_name"
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
# content_hash: 0e33735691fb4637243f4fe61acbba78a388e654834903e34be22e3ce6f3c3bc
|
|
@@ -35,6 +35,13 @@ class LegacyTimestamp(BaseModel):
|
|
|
35
35
|
updated_at: datetime | None = None
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
class PaginationParams(BaseModel):
|
|
39
|
+
"""Pagination parameters for list requests."""
|
|
40
|
+
|
|
41
|
+
page: int
|
|
42
|
+
page_size: int
|
|
43
|
+
|
|
44
|
+
|
|
38
45
|
class PaginationInfo(BaseModel):
|
|
39
46
|
"""Pagination information for list responses."""
|
|
40
47
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Utilities for the HTTP SSE Gateway."""
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Utility functions for creating .stim file structures.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import List
|
|
6
|
+
|
|
7
|
+
from ..repository.entities import Task, TaskEvent
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def create_stim_from_task_data(task: Task, events: List[TaskEvent]) -> dict:
|
|
11
|
+
"""
|
|
12
|
+
Formats a task and its events into the .stim file structure.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
task: The task entity.
|
|
16
|
+
events: A list of task event entities.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
A dictionary representing the .stim file content.
|
|
20
|
+
"""
|
|
21
|
+
return {
|
|
22
|
+
"invocation_details": {
|
|
23
|
+
"log_file_version": "2.0", # New version for gateway-generated logs
|
|
24
|
+
"task_id": task.id,
|
|
25
|
+
"user_id": task.user_id,
|
|
26
|
+
"start_time": task.start_time,
|
|
27
|
+
"end_time": task.end_time,
|
|
28
|
+
"status": task.status,
|
|
29
|
+
"initial_request_text": task.initial_request_text,
|
|
30
|
+
},
|
|
31
|
+
"invocation_flow": [event.model_dump() for event in events],
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
## Quick Summary
|
|
2
|
+
The `utils` directory provides utility functions for the HTTP SSE Gateway, specifically for creating .stim file structures from task and event data.
|
|
3
|
+
|
|
4
|
+
## Files Overview
|
|
5
|
+
- `__init__.py` - Package initialization file for HTTP SSE Gateway utilities
|
|
6
|
+
- `stim_utils.py` - Utility functions for formatting task data into .stim file structures
|
|
7
|
+
|
|
8
|
+
## Developer API Reference
|
|
9
|
+
|
|
10
|
+
### __init__.py
|
|
11
|
+
**Purpose:** Package initialization for HTTP SSE Gateway utilities
|
|
12
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.utils import *`
|
|
13
|
+
|
|
14
|
+
This file serves as the package entry point and contains no public interfaces.
|
|
15
|
+
|
|
16
|
+
### stim_utils.py
|
|
17
|
+
**Purpose:** Provides utility functions for creating .stim file structures from task and event data
|
|
18
|
+
**Import:** `from solace_agent_mesh.gateway.http_sse.utils.stim_utils import create_stim_from_task_data`
|
|
19
|
+
|
|
20
|
+
**Functions:**
|
|
21
|
+
- `create_stim_from_task_data(task: Task, events: List[TaskEvent]) -> dict` - Formats a task and its events into the .stim file structure with version 2.0 format for gateway-generated logs
|
|
22
|
+
|
|
23
|
+
**Usage Examples:**
|
|
24
|
+
```python
|
|
25
|
+
from solace_agent_mesh.gateway.http_sse.utils.stim_utils import create_stim_from_task_data
|
|
26
|
+
from solace_agent_mesh.gateway.http_sse.repository.entities import Task, TaskEvent
|
|
27
|
+
|
|
28
|
+
# Create a .stim file structure from task and events
|
|
29
|
+
task = Task(
|
|
30
|
+
id="task_123",
|
|
31
|
+
user_id="user_456",
|
|
32
|
+
start_time="2024-01-01T10:00:00Z",
|
|
33
|
+
end_time="2024-01-01T10:05:00Z",
|
|
34
|
+
status="completed",
|
|
35
|
+
initial_request_text="Process this data"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
events = [
|
|
39
|
+
TaskEvent(event_type="start", timestamp="2024-01-01T10:00:00Z"),
|
|
40
|
+
TaskEvent(event_type="complete", timestamp="2024-01-01T10:05:00Z")
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
stim_data = create_stim_from_task_data(task, events)
|
|
44
|
+
# Returns a dictionary with 'invocation_details' and 'invocation_flow' keys
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
# content_hash: 7fdc4ad8bbcefb07ee40f84c438f988cda4fdfb812dab55c6a064d1b38b0c83f
|
|
@@ -359,4 +359,4 @@ async def client_integration_example():
|
|
|
359
359
|
if hasattr(response.result, 'text_delta'):
|
|
360
360
|
print(response.result.text_delta,
|
|
361
361
|
|
|
362
|
-
# content_hash:
|
|
362
|
+
# content_hash: ce6554bc70f746507a86e0faa0836fe1b338161b5f72a7923df30de5f23ac84e
|