solace-agent-mesh 1.6.3__py3-none-any.whl → 1.7.1__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 +12 -18
- solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
- solace_agent_mesh/agent/adk/callbacks.py +138 -20
- solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +2 -0
- solace_agent_mesh/agent/adk/models/lite_llm.py +38 -5
- solace_agent_mesh/agent/adk/models/models_llm.txt +82 -35
- solace_agent_mesh/agent/adk/runner.py +9 -0
- solace_agent_mesh/agent/adk/stream_parser.py +6 -1
- solace_agent_mesh/agent/adk/tool_wrapper.py +3 -0
- solace_agent_mesh/agent/agent_llm.txt +61 -70
- solace_agent_mesh/agent/protocol/event_handlers.py +29 -1
- solace_agent_mesh/agent/protocol/protocol_llm.txt +1 -1
- solace_agent_mesh/agent/proxies/a2a/a2a_llm.txt +190 -0
- solace_agent_mesh/agent/proxies/base/base_llm.txt +148 -0
- solace_agent_mesh/agent/proxies/proxies_llm.txt +283 -0
- solace_agent_mesh/agent/sac/app.py +22 -0
- solace_agent_mesh/agent/sac/component.py +76 -40
- solace_agent_mesh/agent/sac/sac_llm.txt +1 -1
- solace_agent_mesh/agent/sac/task_execution_context.py +21 -0
- solace_agent_mesh/agent/testing/testing_llm.txt +2 -1
- solace_agent_mesh/agent/tools/builtin_artifact_tools.py +13 -148
- solace_agent_mesh/agent/tools/dynamic_tool.py +2 -0
- solace_agent_mesh/agent/tools/tools_llm.txt +93 -80
- solace_agent_mesh/agent/tools/tools_llm_detail.txt +3 -2
- solace_agent_mesh/agent/utils/artifact_helpers.py +4 -0
- solace_agent_mesh/agent/utils/utils_llm.txt +16 -2
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/05749d90.c70b2be9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/15ba94aa.92fea363.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/15e40e79.36003774.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2987107d.a80604f9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3ac1795d.e4870a49.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3ff0015d.b63ee53a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/547e15cc.2f7790c1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5c2bd65f.45b32c2b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/631738c7.fa471607.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/64195356.c498c4d0.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6a520c9d.b6e3f2ce.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6ad8f0bd.a5b36a60.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/71da7b71.374b9d54.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8024126c.fa0e7186.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8b032486.91a91afc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/94e8668d.09ed9234.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{ab9708a8.3e6dd091.js → ab9708a8.245ae0ef.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/ad87452a.9d73dad6.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cbe2e9ea.f902fad8.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/da0b5bad.b62f7b08.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/db5d6442.3daf1696.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/dd817ffc.c37a755e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/dd81e2b8.b682e9c2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/de915948.44a432bc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/e04b235d.c9c50c7b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/e3d9abda.d11c67a7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{e6f9706b.e74a984d.js → e6f9706b.045d0fa1.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/e92d0134.3bda61dd.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f284c35a.5099c51e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ff4d71f2.74710fc1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/main.f213fe0c.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/runtime~main.d9606d6a.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/components/agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/artifact-management/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/audio-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/data-analysis-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/embeds/index.html +18 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/cli/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/gateways/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/components/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/orchestrator/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/plugins/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/projects/index.html +196 -0
- solace_agent_mesh/assets/docs/docs/documentation/components/proxies/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deploying/debugging/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/deploying/deployment-options/index.html +6 -7
- solace_agent_mesh/assets/docs/docs/documentation/deploying/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deploying/kubernetes-deployment/index.html +47 -0
- solace_agent_mesh/assets/docs/docs/documentation/deploying/logging/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deploying/observability/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/create-agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/create-gateways/index.html +160 -169
- solace_agent_mesh/assets/docs/docs/documentation/developing/creating-python-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/creating-service-providers/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/evaluations/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/structure/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/bedrock-agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/custom-agent/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/event-mesh-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mcp-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mongodb-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rag-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rest-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/slack-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/sql-database/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/agent-builder/index.html +59 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/connectors/index.html +62 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +10 -6
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/rbac-setup-guide/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/secure-user-delegated-access/index.html +440 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/single-sign-on/index.html +27 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/wheel-installation/index.html +62 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/architecture/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/index.html +5 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/try-agent-mesh/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/artifact-storage/index.html +290 -0
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/configurations/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/large_language_models/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/run-project/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/session-storage/index.html +251 -0
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/user-feedback/index.html +88 -0
- solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-technical-migration-map/index.html +3 -3
- solace_agent_mesh/assets/docs/lunr-index-1762283454666.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1762283454666.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/assets/docs/sitemap.xml +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/docs_cmd.py +4 -1
- solace_agent_mesh/cli/commands/init_cmd/orchestrator_step.py +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-D4_RMYRh.js → authCallback-tcIFZLis.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{client-UZ3qU6Bq.js → client-CRYdKo2Q.js} +3 -3
- solace_agent_mesh/client/webui/frontend/static/assets/main-CojeY_1w.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-ILja9MCG.js +353 -0
- solace_agent_mesh/client/webui/frontend/static/assets/vendor-CINwxvwV.js +470 -0
- 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 +13 -20
- solace_agent_mesh/common/a2a/protocol.py +5 -0
- solace_agent_mesh/common/a2a/types.py +1 -0
- solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +49 -11
- solace_agent_mesh/common/a2a_spec/schemas/artifact_creation_progress.json +23 -6
- solace_agent_mesh/common/a2a_spec/schemas/feedback_event.json +51 -0
- solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +26 -9
- solace_agent_mesh/common/common_llm.txt +13 -34
- solace_agent_mesh/common/data_parts.py +20 -4
- solace_agent_mesh/common/middleware/middleware_llm.txt +1 -1
- solace_agent_mesh/common/sac/sac_llm.txt +1 -1
- solace_agent_mesh/common/sam_events/sam_events_llm.txt +1 -1
- solace_agent_mesh/common/services/employee_service.py +1 -1
- solace_agent_mesh/common/services/providers/providers_llm.txt +3 -2
- solace_agent_mesh/common/services/services_llm.txt +9 -4
- solace_agent_mesh/common/utils/embeds/constants.py +1 -0
- solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
- solace_agent_mesh/common/utils/embeds/modifiers.py +2 -1
- solace_agent_mesh/common/utils/embeds/resolver.py +58 -6
- solace_agent_mesh/common/utils/embeds/types.py +8 -0
- solace_agent_mesh/common/utils/utils_llm.txt +5 -6
- solace_agent_mesh/core_a2a/core_a2a_llm.txt +1 -1
- solace_agent_mesh/gateway/adapter/__init__.py +1 -0
- solace_agent_mesh/gateway/adapter/base.py +143 -0
- solace_agent_mesh/gateway/adapter/types.py +221 -0
- solace_agent_mesh/gateway/base/app.py +29 -2
- solace_agent_mesh/gateway/base/base_llm.txt +10 -8
- solace_agent_mesh/gateway/base/component.py +573 -142
- solace_agent_mesh/gateway/gateway_llm.txt +55 -59
- solace_agent_mesh/gateway/generic/__init__.py +1 -0
- solace_agent_mesh/gateway/generic/app.py +50 -0
- solace_agent_mesh/gateway/generic/component.py +650 -0
- solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +99 -49
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_fulltext_search_indexes.py +92 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_project_users_table.py +72 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_soft_delete_and_search.py +150 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251024_add_default_agent_to_projects.py +26 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251024_add_projects_table.py +135 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +26 -20
- solace_agent_mesh/gateway/http_sse/app.py +0 -14
- solace_agent_mesh/gateway/http_sse/component.py +17 -56
- solace_agent_mesh/gateway/http_sse/components/components_llm.txt +1 -1
- solace_agent_mesh/gateway/http_sse/dependencies.py +21 -3
- solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +8 -8
- solace_agent_mesh/gateway/http_sse/main.py +23 -5
- solace_agent_mesh/gateway/http_sse/repository/__init__.py +19 -1
- solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +56 -98
- solace_agent_mesh/gateway/http_sse/repository/entities/project.py +81 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/project_user.py +47 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session.py +23 -1
- solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +47 -0
- solace_agent_mesh/gateway/http_sse/repository/interfaces.py +112 -4
- solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -1
- solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +51 -60
- solace_agent_mesh/gateway/http_sse/repository/models/project_model.py +51 -0
- solace_agent_mesh/gateway/http_sse/repository/models/project_user_model.py +75 -0
- solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +7 -1
- solace_agent_mesh/gateway/http_sse/repository/project_repository.py +172 -0
- solace_agent_mesh/gateway/http_sse/repository/project_user_repository.py +186 -0
- solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +125 -157
- solace_agent_mesh/gateway/http_sse/repository/session_repository.py +269 -8
- solace_agent_mesh/gateway/http_sse/routers/artifacts.py +143 -51
- solace_agent_mesh/gateway/http_sse/routers/config.py +69 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +198 -94
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/project_requests.py +48 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +68 -18
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +13 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/project_responses.py +30 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +51 -35
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +2 -0
- solace_agent_mesh/gateway/http_sse/routers/feedback.py +133 -2
- solace_agent_mesh/gateway/http_sse/routers/projects.py +542 -0
- solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +9 -11
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +154 -3
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +296 -4
- solace_agent_mesh/gateway/http_sse/services/project_service.py +403 -0
- solace_agent_mesh/gateway/http_sse/services/services_llm.txt +16 -10
- solace_agent_mesh/gateway/http_sse/services/session_service.py +178 -6
- solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +2 -3
- solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +48 -14
- solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.1.dist-info}/METADATA +3 -5
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.1.dist-info}/RECORD +218 -175
- solace_agent_mesh/assets/docs/assets/js/15ba94aa.932dd2db.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/3ac1795d.76654dd9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/3ff0015d.2be20244.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/547e15cc.2cbb060a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/5c2bd65f.eda4bcb2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/631738c7.7c4594c9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/6a520c9d.ba015d81.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/6ad8f0bd.f4b15f3b.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/71da7b71.ddbdfbe2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/8024126c.56e59919.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/94e8668d.3b883666.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/da0b5bad.d08a9466.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/dd817ffc.0aa9630a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/dd81e2b8.d590bc9e.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/de915948.27d6b065.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/e3d9abda.6b9493d0.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/e92d0134.4f395c6b.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.720d2ef2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ff4d71f2.15b02f97.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/main.ed05b14d.js +0 -2
- solace_agent_mesh/assets/docs/assets/js/runtime~main.a8a75e0b.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1761744323675.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1761744323675.json +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main--3yJYl7S.css +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-DojKHS49.js +0 -342
- solace_agent_mesh/client/webui/frontend/static/assets/vendor-DSqhjwq_.js +0 -405
- /solace_agent_mesh/assets/docs/assets/js/{main.ed05b14d.js.LICENSE.txt → main.f213fe0c.js.LICENSE.txt} +0 -0
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.1.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.1.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -29,7 +29,7 @@ This directory contains Alembic database migration configuration and version fil
|
|
|
29
29
|
### Subdirectory APIs
|
|
30
30
|
|
|
31
31
|
#### versions/
|
|
32
|
-
**Purpose:** Contains sequential Alembic migration files that define database schema changes including core tables, indexes, timestamp modernization, task management, and
|
|
32
|
+
**Purpose:** Contains sequential Alembic migration files that define database schema changes including core tables, indexes, timestamp modernization, task management, and performance optimization
|
|
33
33
|
**Key Exports:** Migration functions for complete schema evolution (upgrade/downgrade operations)
|
|
34
34
|
**Import Examples:**
|
|
35
35
|
```python
|
|
@@ -43,8 +43,8 @@ This directory contains Alembic database migration configuration and version fil
|
|
|
43
43
|
- `d5b3f8f2e9a0` - Initial database schema (sessions and chat_messages tables)
|
|
44
44
|
- `b1c2d3e4f5g6` - Performance indexes for query optimization
|
|
45
45
|
- `f6e7d8c9b0a1` - Timestamp conversion to epoch milliseconds
|
|
46
|
-
- `
|
|
47
|
-
- `
|
|
46
|
+
- `98882922fa59` - Task management tables (tasks, task_events, feedback, chat_tasks)
|
|
47
|
+
- `20251015_session_idx` - Optimized composite indexes for better query performance
|
|
48
48
|
|
|
49
49
|
## Complete Usage Guide
|
|
50
50
|
|
|
@@ -53,8 +53,6 @@ This directory contains Alembic database migration configuration and version fil
|
|
|
53
53
|
```python
|
|
54
54
|
# The env.py automatically imports all repository models for metadata
|
|
55
55
|
from solace_agent_mesh.gateway.http_sse.repository.models.base import Base
|
|
56
|
-
from solace_agent_mesh.gateway.http_sse.repository.models.session_model import SessionModel
|
|
57
|
-
from solace_agent_mesh.gateway.http_sse.repository.models.message_model import MessageModel
|
|
58
56
|
from solace_agent_mesh.gateway.http_sse.repository.models.task_model import TaskModel
|
|
59
57
|
from solace_agent_mesh.gateway.http_sse.repository.models.task_event_model import TaskEventModel
|
|
60
58
|
from solace_agent_mesh.gateway.http_sse.repository.models.feedback_model import FeedbackModel
|
|
@@ -104,12 +102,13 @@ alembic upgrade f6e7d8c9b0a1
|
|
|
104
102
|
# Renames: columns for consistency (created_at → created_time)
|
|
105
103
|
|
|
106
104
|
# Step 4: Add task management features
|
|
107
|
-
alembic upgrade
|
|
108
|
-
# Creates: tasks, task_events, feedback tables
|
|
105
|
+
alembic upgrade 98882922fa59
|
|
106
|
+
# Creates: tasks, task_events, feedback, chat_tasks tables
|
|
107
|
+
# Replaces: chat_messages with chat_tasks for better task tracking
|
|
109
108
|
|
|
110
|
-
# Step 5: Add
|
|
111
|
-
alembic upgrade
|
|
112
|
-
# Adds:
|
|
109
|
+
# Step 5: Add optimized performance indexes
|
|
110
|
+
alembic upgrade 20251015_session_idx
|
|
111
|
+
# Adds: composite indexes for optimal query patterns
|
|
113
112
|
```
|
|
114
113
|
|
|
115
114
|
### 4. Working with Different Database Engines
|
|
@@ -133,8 +132,6 @@ alembic upgrade 20250930_token_usage
|
|
|
133
132
|
```python
|
|
134
133
|
# The migrations work with the repository models
|
|
135
134
|
from solace_agent_mesh.gateway.http_sse.repository.models.base import Base
|
|
136
|
-
from solace_agent_mesh.gateway.http_sse.repository.models.session_model import SessionModel
|
|
137
|
-
from solace_agent_mesh.gateway.http_sse.repository.models.message_model import MessageModel
|
|
138
135
|
from solace_agent_mesh.gateway.http_sse.repository.models.task_model import TaskModel
|
|
139
136
|
from solace_agent_mesh.gateway.http_sse.repository.models.task_event_model import TaskEventModel
|
|
140
137
|
from solace_agent_mesh.gateway.http_sse.repository.models.feedback_model import FeedbackModel
|
|
@@ -144,7 +141,7 @@ from solace_agent_mesh.gateway.http_sse.repository.models.feedback_model import
|
|
|
144
141
|
# - Proper indexes for performance
|
|
145
142
|
# - Standardized column names
|
|
146
143
|
# - Complete task management functionality
|
|
147
|
-
# -
|
|
144
|
+
# - Optimized composite indexes for query performance
|
|
148
145
|
```
|
|
149
146
|
|
|
150
147
|
### 6. Offline Migration Generation
|
|
@@ -159,8 +156,8 @@ alembic upgrade d5b3f8f2e9a0 --sql
|
|
|
159
156
|
# Generate SQL for all pending migrations
|
|
160
157
|
alembic upgrade head --sql
|
|
161
158
|
|
|
162
|
-
# Generate SQL for
|
|
163
|
-
alembic upgrade
|
|
159
|
+
# Generate SQL for performance optimization
|
|
160
|
+
alembic upgrade 20251015_session_idx --sql
|
|
164
161
|
```
|
|
165
162
|
|
|
166
163
|
### 7. Common Development Patterns
|
|
@@ -190,7 +187,7 @@ alembic upgrade head --sql > migration.sql
|
|
|
190
187
|
```sql
|
|
191
188
|
-- Final schema structure after all migrations:
|
|
192
189
|
|
|
193
|
-
-- Core tables:
|
|
190
|
+
-- Core tables with epoch millisecond timestamps:
|
|
194
191
|
-- sessions table:
|
|
195
192
|
-- id (String, Primary Key)
|
|
196
193
|
-- name (String)
|
|
@@ -199,13 +196,15 @@ alembic upgrade head --sql > migration.sql
|
|
|
199
196
|
-- created_time (BigInteger, epoch ms)
|
|
200
197
|
-- updated_time (BigInteger, epoch ms)
|
|
201
198
|
|
|
202
|
-
--
|
|
199
|
+
-- chat_tasks table (replaces chat_messages):
|
|
203
200
|
-- id (String, Primary Key)
|
|
204
201
|
-- session_id (String, Foreign Key to sessions.id)
|
|
205
|
-
--
|
|
206
|
-
--
|
|
207
|
-
--
|
|
208
|
-
--
|
|
202
|
+
-- user_id (String)
|
|
203
|
+
-- user_message (Text)
|
|
204
|
+
-- message_bubbles (Text, JSON)
|
|
205
|
+
-- task_metadata (Text, JSON)
|
|
206
|
+
-- created_time (BigInteger, epoch ms)
|
|
207
|
+
-- updated_time (BigInteger, epoch ms)
|
|
209
208
|
|
|
210
209
|
-- Task management tables:
|
|
211
210
|
-- tasks table:
|
|
@@ -238,18 +237,15 @@ alembic upgrade head --sql > migration.sql
|
|
|
238
237
|
-- comment (Text)
|
|
239
238
|
-- created_time (BigInteger, epoch ms)
|
|
240
239
|
|
|
241
|
-
--
|
|
242
|
-
--
|
|
243
|
-
--
|
|
244
|
-
--
|
|
245
|
-
--
|
|
246
|
-
--
|
|
247
|
-
--
|
|
248
|
-
--
|
|
249
|
-
--
|
|
250
|
-
-- idx_task_events_created_time
|
|
251
|
-
-- idx_feedback_session_id
|
|
252
|
-
-- idx_feedback_task_id
|
|
240
|
+
-- Optimized performance indexes:
|
|
241
|
+
-- ix_sessions_user_id
|
|
242
|
+
-- ix_sessions_user_updated (composite: user_id, updated_time)
|
|
243
|
+
-- ix_chat_tasks_session_user_created (composite: session_id, user_id, created_time)
|
|
244
|
+
-- ix_tasks_user_start_time (composite: user_id, start_time)
|
|
245
|
+
-- ix_task_events_task_created (composite: task_id, created_time)
|
|
246
|
+
-- ix_feedback_task_id
|
|
247
|
+
-- ix_feedback_user_id
|
|
248
|
+
-- ix_feedback_created_time
|
|
253
249
|
```
|
|
254
250
|
|
|
255
251
|
### 9. Cross-Platform Timestamp Handling
|
|
@@ -268,28 +264,82 @@ alembic upgrade head --sql > migration.sql
|
|
|
268
264
|
# - More efficient for large datasets
|
|
269
265
|
```
|
|
270
266
|
|
|
271
|
-
### 10.
|
|
267
|
+
### 10. Performance Optimization Features
|
|
272
268
|
|
|
273
269
|
```python
|
|
274
|
-
# The
|
|
270
|
+
# The migrations include comprehensive performance optimizations:
|
|
271
|
+
|
|
272
|
+
# Single-column indexes for basic filtering:
|
|
273
|
+
# - user_id columns for user-specific queries
|
|
274
|
+
# - timestamp columns for time-based filtering
|
|
275
275
|
|
|
276
|
-
#
|
|
277
|
-
# -
|
|
278
|
-
# -
|
|
279
|
-
# -
|
|
280
|
-
# -
|
|
276
|
+
# Composite indexes for complex queries:
|
|
277
|
+
# - (user_id, updated_time) for recent user sessions
|
|
278
|
+
# - (session_id, user_id, created_time) for session chat history
|
|
279
|
+
# - (task_id, created_time) for task event chronology
|
|
280
|
+
# - (user_id, start_time) for user task history
|
|
281
281
|
|
|
282
|
-
# Usage example after
|
|
282
|
+
# Usage example after all migrations:
|
|
283
283
|
from solace_agent_mesh.gateway.http_sse.repository.models.task_model import TaskModel
|
|
284
284
|
|
|
285
|
-
#
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
# Efficient queries using optimized indexes:
|
|
286
|
+
# Get recent user sessions (uses ix_sessions_user_updated)
|
|
287
|
+
recent_sessions = session.query(SessionModel)\
|
|
288
|
+
.filter_by(user_id="user123")\
|
|
289
|
+
.order_by(SessionModel.updated_time.desc())\
|
|
290
|
+
.limit(10)
|
|
291
|
+
|
|
292
|
+
# Get task events chronologically (uses ix_task_events_task_created)
|
|
293
|
+
task_events = session.query(TaskEventModel)\
|
|
294
|
+
.filter_by(task_id="task456")\
|
|
295
|
+
.order_by(TaskEventModel.created_time)\
|
|
296
|
+
.all()
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### 11. Task Management Integration
|
|
300
|
+
|
|
301
|
+
```python
|
|
302
|
+
# After running all migrations, the complete task management system is available:
|
|
303
|
+
|
|
304
|
+
from solace_agent_mesh.gateway.http_sse.repository.models.task_model import TaskModel
|
|
305
|
+
from solace_agent_mesh.gateway.http_sse.repository.models.task_event_model import TaskEventModel
|
|
306
|
+
from solace_agent_mesh.gateway.http_sse.repository.models.feedback_model import FeedbackModel
|
|
307
|
+
|
|
308
|
+
# Create a new task with token tracking
|
|
309
|
+
task = TaskModel(
|
|
310
|
+
id="task_123",
|
|
311
|
+
user_id="user_456",
|
|
312
|
+
start_time=1634567890000, # epoch milliseconds
|
|
313
|
+
status="in_progress",
|
|
314
|
+
initial_request_text="User's initial request",
|
|
315
|
+
total_input_tokens=150,
|
|
316
|
+
total_output_tokens=300,
|
|
317
|
+
total_cached_input_tokens=50,
|
|
318
|
+
token_usage_details='{"model": "gpt-4", "breakdown": {...}}'
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
# Add task events for tracking
|
|
322
|
+
event = TaskEventModel(
|
|
323
|
+
id="event_789",
|
|
324
|
+
task_id="task_123",
|
|
325
|
+
user_id="user_456",
|
|
326
|
+
created_time=1634567891000,
|
|
327
|
+
topic="ai_response",
|
|
328
|
+
direction="outbound",
|
|
329
|
+
payload='{"response": "AI generated response"}'
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
# Collect user feedback
|
|
333
|
+
feedback = FeedbackModel(
|
|
334
|
+
id="feedback_101",
|
|
335
|
+
task_id="task_123",
|
|
336
|
+
user_id="user_456",
|
|
337
|
+
rating=5,
|
|
338
|
+
comment="Excellent response quality",
|
|
339
|
+
created_time=1634567892000
|
|
340
|
+
)
|
|
291
341
|
```
|
|
292
342
|
|
|
293
|
-
This Alembic configuration provides a comprehensive database migration system that handles schema evolution, performance optimization, cross-database compatibility, complete task management functionality, and
|
|
343
|
+
This Alembic configuration provides a comprehensive database migration system that handles schema evolution, performance optimization, cross-database compatibility, complete task management functionality, and optimized query patterns for the HTTP SSE gateway component.
|
|
294
344
|
|
|
295
|
-
# content_hash:
|
|
345
|
+
# content_hash: 1211a2aee2a0eb3361ee0f61e504f720c4cf454569a46c5f3991507db9a0cab9
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Add full-text search indexes for chat search optimization (PostgreSQL only)
|
|
2
|
+
|
|
3
|
+
Revision ID: fts_indexes_001
|
|
4
|
+
Revises: soft_del_search_001
|
|
5
|
+
Create Date: 2025-10-23
|
|
6
|
+
|
|
7
|
+
This migration adds PostgreSQL full-text search (FTS) indexes to optimize
|
|
8
|
+
chat search performance. It creates GIN indexes on the user_message and
|
|
9
|
+
message_bubbles columns of the chat_tasks table.
|
|
10
|
+
|
|
11
|
+
Database Compatibility:
|
|
12
|
+
- PostgreSQL: Creates GIN indexes for full-text search (10-100x faster)
|
|
13
|
+
- SQLite: Skips index creation (uses ILIKE fallback in repository)
|
|
14
|
+
|
|
15
|
+
Performance Impact (PostgreSQL only):
|
|
16
|
+
- Search queries will be 10-100x faster
|
|
17
|
+
- Supports stemming (e.g., "running" matches "run", "ran")
|
|
18
|
+
- Enables relevance ranking
|
|
19
|
+
- Scales efficiently to millions of records
|
|
20
|
+
|
|
21
|
+
Index Details:
|
|
22
|
+
- Uses 'english' text search configuration
|
|
23
|
+
- GIN (Generalized Inverted Index) for fast lookups
|
|
24
|
+
- Automatically maintained by PostgreSQL
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from alembic import op
|
|
28
|
+
from sqlalchemy import inspect
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# revision identifiers, used by Alembic.
|
|
32
|
+
revision = 'fts_indexes_001'
|
|
33
|
+
down_revision = 'soft_del_search_001'
|
|
34
|
+
branch_labels = None
|
|
35
|
+
depends_on = None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def upgrade() -> None:
|
|
39
|
+
"""
|
|
40
|
+
Add GIN indexes for full-text search on chat_tasks table (PostgreSQL only).
|
|
41
|
+
|
|
42
|
+
Creates three indexes:
|
|
43
|
+
1. idx_chat_tasks_user_message_fts - For searching user messages
|
|
44
|
+
2. idx_chat_tasks_message_bubbles_fts - For searching full conversation content
|
|
45
|
+
3. idx_sessions_name_fts - For searching session names
|
|
46
|
+
|
|
47
|
+
Note: Silently skips index creation for non-PostgreSQL databases (e.g., SQLite).
|
|
48
|
+
"""
|
|
49
|
+
# Get database connection and check dialect
|
|
50
|
+
conn = op.get_bind()
|
|
51
|
+
dialect_name = conn.dialect.name
|
|
52
|
+
|
|
53
|
+
# Only create FTS indexes for PostgreSQL
|
|
54
|
+
if dialect_name == 'postgresql':
|
|
55
|
+
# Create GIN index for user_message full-text search
|
|
56
|
+
op.execute("""
|
|
57
|
+
CREATE INDEX IF NOT EXISTS idx_chat_tasks_user_message_fts
|
|
58
|
+
ON chat_tasks
|
|
59
|
+
USING gin(to_tsvector('english', COALESCE(user_message, '')))
|
|
60
|
+
""")
|
|
61
|
+
|
|
62
|
+
# Create GIN index for message_bubbles full-text search
|
|
63
|
+
op.execute("""
|
|
64
|
+
CREATE INDEX IF NOT EXISTS idx_chat_tasks_message_bubbles_fts
|
|
65
|
+
ON chat_tasks
|
|
66
|
+
USING gin(to_tsvector('english', message_bubbles))
|
|
67
|
+
""")
|
|
68
|
+
|
|
69
|
+
# Create GIN index for session name full-text search
|
|
70
|
+
op.execute("""
|
|
71
|
+
CREATE INDEX IF NOT EXISTS idx_sessions_name_fts
|
|
72
|
+
ON sessions
|
|
73
|
+
USING gin(to_tsvector('english', COALESCE(name, '')))
|
|
74
|
+
""")
|
|
75
|
+
# For SQLite and other databases, skip FTS index creation
|
|
76
|
+
# The repository will automatically use ILIKE-based search instead
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def downgrade() -> None:
|
|
80
|
+
"""
|
|
81
|
+
Remove full-text search indexes (PostgreSQL only).
|
|
82
|
+
|
|
83
|
+
Note: Downgrading will revert to slower ILIKE-based search.
|
|
84
|
+
Silently skips for non-PostgreSQL databases.
|
|
85
|
+
"""
|
|
86
|
+
conn = op.get_bind()
|
|
87
|
+
dialect_name = conn.dialect.name
|
|
88
|
+
|
|
89
|
+
if dialect_name == 'postgresql':
|
|
90
|
+
op.execute("DROP INDEX IF EXISTS idx_chat_tasks_user_message_fts")
|
|
91
|
+
op.execute("DROP INDEX IF EXISTS idx_chat_tasks_message_bubbles_fts")
|
|
92
|
+
op.execute("DROP INDEX IF EXISTS idx_sessions_name_fts")
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""Add project_users table for multi-user project access
|
|
2
|
+
|
|
3
|
+
Revision ID: 20251023_add_project_users
|
|
4
|
+
Revises: 20251023_remove_created_by_user_id
|
|
5
|
+
Create Date: 2025-10-23
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
from alembic import op
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = 'add_project_users_001'
|
|
15
|
+
down_revision: Union[str, None] = 'add_projects_table_001'
|
|
16
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
17
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
"""
|
|
22
|
+
Create project_users table to enable multi-user access to projects.
|
|
23
|
+
|
|
24
|
+
This table tracks which users have access to which projects and their roles.
|
|
25
|
+
It supports future features for collaborative project management.
|
|
26
|
+
"""
|
|
27
|
+
# Create project_users table
|
|
28
|
+
op.create_table(
|
|
29
|
+
'project_users',
|
|
30
|
+
sa.Column('id', sa.String(), nullable=False),
|
|
31
|
+
sa.Column('project_id', sa.String(), nullable=False),
|
|
32
|
+
sa.Column('user_id', sa.String(), nullable=False),
|
|
33
|
+
sa.Column('role', sa.String(), nullable=False),
|
|
34
|
+
sa.Column('added_at', sa.BigInteger(), nullable=False),
|
|
35
|
+
sa.Column('added_by_user_id', sa.String(), nullable=False),
|
|
36
|
+
sa.PrimaryKeyConstraint('id'),
|
|
37
|
+
sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ondelete='CASCADE'),
|
|
38
|
+
sa.UniqueConstraint('project_id', 'user_id', name='uq_project_user')
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Create indexes for efficient queries
|
|
42
|
+
op.create_index(
|
|
43
|
+
'ix_project_users_project_id',
|
|
44
|
+
'project_users',
|
|
45
|
+
['project_id']
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
op.create_index(
|
|
49
|
+
'ix_project_users_user_id',
|
|
50
|
+
'project_users',
|
|
51
|
+
['user_id']
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Create composite index for common query pattern (user accessing specific project)
|
|
55
|
+
op.create_index(
|
|
56
|
+
'ix_project_users_user_project',
|
|
57
|
+
'project_users',
|
|
58
|
+
['user_id', 'project_id']
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def downgrade() -> None:
|
|
63
|
+
"""
|
|
64
|
+
Remove project_users table and related indexes.
|
|
65
|
+
"""
|
|
66
|
+
# Drop indexes first
|
|
67
|
+
op.drop_index('ix_project_users_user_project', table_name='project_users')
|
|
68
|
+
op.drop_index('ix_project_users_user_id', table_name='project_users')
|
|
69
|
+
op.drop_index('ix_project_users_project_id', table_name='project_users')
|
|
70
|
+
|
|
71
|
+
# Drop the table
|
|
72
|
+
op.drop_table('project_users')
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""Add soft delete and search support for sessions and projects
|
|
2
|
+
|
|
3
|
+
Revision ID: add_soft_delete_search_001
|
|
4
|
+
Revises: remove_is_global_001
|
|
5
|
+
Create Date: 2025-10-23 16:20:00.000000
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
from alembic import op
|
|
10
|
+
import sqlalchemy as sa
|
|
11
|
+
from sqlalchemy import inspect
|
|
12
|
+
|
|
13
|
+
# revision identifiers, used by Alembic.
|
|
14
|
+
revision: str = 'soft_del_search_001'
|
|
15
|
+
down_revision: Union[str, Sequence[str], None] = 'add_project_users_001'
|
|
16
|
+
branch_labels: Union[str, Sequence[str], None] = None
|
|
17
|
+
depends_on: Union[str, Sequence[str], None] = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def upgrade() -> None:
|
|
21
|
+
"""Add soft delete columns and search indexes."""
|
|
22
|
+
bind = op.get_bind()
|
|
23
|
+
inspector = inspect(bind)
|
|
24
|
+
|
|
25
|
+
# Add soft delete columns to sessions table
|
|
26
|
+
if 'sessions' in inspector.get_table_names():
|
|
27
|
+
sessions_columns = [col['name'] for col in inspector.get_columns('sessions')]
|
|
28
|
+
|
|
29
|
+
if 'deleted_at' not in sessions_columns:
|
|
30
|
+
op.add_column('sessions', sa.Column('deleted_at', sa.BigInteger(), nullable=True))
|
|
31
|
+
|
|
32
|
+
if 'deleted_by' not in sessions_columns:
|
|
33
|
+
op.add_column('sessions', sa.Column('deleted_by', sa.String(), nullable=True))
|
|
34
|
+
|
|
35
|
+
# Create index on deleted_at for efficient filtering
|
|
36
|
+
try:
|
|
37
|
+
op.create_index('ix_sessions_deleted_at', 'sessions', ['deleted_at'])
|
|
38
|
+
except Exception:
|
|
39
|
+
pass # Index might already exist
|
|
40
|
+
|
|
41
|
+
# Create composite index for user queries with soft delete
|
|
42
|
+
try:
|
|
43
|
+
op.create_index('ix_sessions_user_deleted', 'sessions', ['user_id', 'deleted_at'])
|
|
44
|
+
except Exception:
|
|
45
|
+
pass
|
|
46
|
+
|
|
47
|
+
# Add soft delete columns to projects table
|
|
48
|
+
if 'projects' in inspector.get_table_names():
|
|
49
|
+
projects_columns = [col['name'] for col in inspector.get_columns('projects')]
|
|
50
|
+
|
|
51
|
+
if 'deleted_at' not in projects_columns:
|
|
52
|
+
op.add_column('projects', sa.Column('deleted_at', sa.BigInteger(), nullable=True))
|
|
53
|
+
|
|
54
|
+
if 'deleted_by' not in projects_columns:
|
|
55
|
+
op.add_column('projects', sa.Column('deleted_by', sa.String(), nullable=True))
|
|
56
|
+
|
|
57
|
+
# Create index on deleted_at for efficient filtering
|
|
58
|
+
try:
|
|
59
|
+
op.create_index('ix_projects_deleted_at', 'projects', ['deleted_at'])
|
|
60
|
+
except Exception:
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
# Create composite index for user queries with soft delete
|
|
64
|
+
try:
|
|
65
|
+
op.create_index('ix_projects_user_deleted', 'projects', ['user_id', 'deleted_at'])
|
|
66
|
+
except Exception:
|
|
67
|
+
pass
|
|
68
|
+
|
|
69
|
+
# Enable pg_trgm extension for fuzzy text search (PostgreSQL only)
|
|
70
|
+
try:
|
|
71
|
+
op.execute('CREATE EXTENSION IF NOT EXISTS pg_trgm')
|
|
72
|
+
except Exception:
|
|
73
|
+
# Not PostgreSQL or extension already exists
|
|
74
|
+
pass
|
|
75
|
+
|
|
76
|
+
# Create GIN indexes for text search on sessions
|
|
77
|
+
if 'sessions' in inspector.get_table_names():
|
|
78
|
+
try:
|
|
79
|
+
# Index on session name for fuzzy search
|
|
80
|
+
op.execute(
|
|
81
|
+
'CREATE INDEX IF NOT EXISTS ix_sessions_name_trgm ON sessions '
|
|
82
|
+
'USING gin (name gin_trgm_ops)'
|
|
83
|
+
)
|
|
84
|
+
except Exception:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
# Create GIN indexes for text search on chat_tasks
|
|
88
|
+
if 'chat_tasks' in inspector.get_table_names():
|
|
89
|
+
try:
|
|
90
|
+
# Index on user_message for content search
|
|
91
|
+
op.execute(
|
|
92
|
+
'CREATE INDEX IF NOT EXISTS ix_chat_tasks_user_message_trgm ON chat_tasks '
|
|
93
|
+
'USING gin (user_message gin_trgm_ops)'
|
|
94
|
+
)
|
|
95
|
+
except Exception:
|
|
96
|
+
pass
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def downgrade() -> None:
|
|
100
|
+
"""Remove soft delete columns and search indexes."""
|
|
101
|
+
bind = op.get_bind()
|
|
102
|
+
inspector = inspect(bind)
|
|
103
|
+
|
|
104
|
+
# Drop search indexes from chat_tasks
|
|
105
|
+
if 'chat_tasks' in inspector.get_table_names():
|
|
106
|
+
try:
|
|
107
|
+
op.execute('DROP INDEX IF EXISTS ix_chat_tasks_user_message_trgm')
|
|
108
|
+
except Exception:
|
|
109
|
+
pass
|
|
110
|
+
|
|
111
|
+
# Drop search indexes from sessions
|
|
112
|
+
if 'sessions' in inspector.get_table_names():
|
|
113
|
+
try:
|
|
114
|
+
op.execute('DROP INDEX IF EXISTS ix_sessions_name_trgm')
|
|
115
|
+
except Exception:
|
|
116
|
+
pass
|
|
117
|
+
|
|
118
|
+
try:
|
|
119
|
+
op.drop_index('ix_sessions_user_deleted', table_name='sessions')
|
|
120
|
+
except Exception:
|
|
121
|
+
pass
|
|
122
|
+
|
|
123
|
+
try:
|
|
124
|
+
op.drop_index('ix_sessions_deleted_at', table_name='sessions')
|
|
125
|
+
except Exception:
|
|
126
|
+
pass
|
|
127
|
+
|
|
128
|
+
sessions_columns = [col['name'] for col in inspector.get_columns('sessions')]
|
|
129
|
+
if 'deleted_by' in sessions_columns:
|
|
130
|
+
op.drop_column('sessions', 'deleted_by')
|
|
131
|
+
if 'deleted_at' in sessions_columns:
|
|
132
|
+
op.drop_column('sessions', 'deleted_at')
|
|
133
|
+
|
|
134
|
+
# Drop indexes and columns from projects
|
|
135
|
+
if 'projects' in inspector.get_table_names():
|
|
136
|
+
try:
|
|
137
|
+
op.drop_index('ix_projects_user_deleted', table_name='projects')
|
|
138
|
+
except Exception:
|
|
139
|
+
pass
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
op.drop_index('ix_projects_deleted_at', table_name='projects')
|
|
143
|
+
except Exception:
|
|
144
|
+
pass
|
|
145
|
+
|
|
146
|
+
projects_columns = [col['name'] for col in inspector.get_columns('projects')]
|
|
147
|
+
if 'deleted_by' in projects_columns:
|
|
148
|
+
op.drop_column('projects', 'deleted_by')
|
|
149
|
+
if 'deleted_at' in projects_columns:
|
|
150
|
+
op.drop_column('projects', 'deleted_at')
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""add default agent to projects
|
|
2
|
+
|
|
3
|
+
Revision ID: default_agent_001
|
|
4
|
+
Revises: fts_indexes_001
|
|
5
|
+
Create Date: 2025-01-24 01:13:00.000000
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from alembic import op
|
|
9
|
+
import sqlalchemy as sa
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# revision identifiers, used by Alembic.
|
|
13
|
+
revision = 'default_agent_001'
|
|
14
|
+
down_revision = 'fts_indexes_001'
|
|
15
|
+
branch_labels = None
|
|
16
|
+
depends_on = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def upgrade():
|
|
20
|
+
"""Add default_agent_id column to projects table."""
|
|
21
|
+
op.add_column('projects', sa.Column('default_agent_id', sa.String(), nullable=True))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def downgrade():
|
|
25
|
+
"""Remove default_agent_id column from projects table."""
|
|
26
|
+
op.drop_column('projects', 'default_agent_id')
|