solace-agent-mesh 0.2.3__py3-none-any.whl → 1.0.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 +93 -0
- solace_agent_mesh/agent/adk/app_llm_agent.py +26 -0
- solace_agent_mesh/agent/adk/callbacks.py +1694 -0
- solace_agent_mesh/agent/adk/filesystem_artifact_service.py +381 -0
- solace_agent_mesh/agent/adk/invocation_monitor.py +295 -0
- solace_agent_mesh/agent/adk/models/lite_llm.py +872 -0
- solace_agent_mesh/agent/adk/models/models_llm.txt +94 -0
- solace_agent_mesh/agent/adk/runner.py +353 -0
- solace_agent_mesh/agent/adk/services.py +240 -0
- solace_agent_mesh/agent/adk/setup.py +751 -0
- solace_agent_mesh/agent/adk/stream_parser.py +214 -0
- solace_agent_mesh/agent/adk/tool_wrapper.py +139 -0
- solace_agent_mesh/agent/agent_llm.txt +41 -0
- solace_agent_mesh/agent/protocol/event_handlers.py +1469 -0
- solace_agent_mesh/agent/protocol/protocol_llm.txt +21 -0
- solace_agent_mesh/agent/sac/app.py +640 -0
- solace_agent_mesh/agent/sac/component.py +3388 -0
- solace_agent_mesh/agent/sac/patch_adk.py +111 -0
- solace_agent_mesh/agent/sac/sac_llm.txt +105 -0
- solace_agent_mesh/agent/sac/task_execution_context.py +176 -0
- solace_agent_mesh/agent/testing/__init__.py +3 -0
- solace_agent_mesh/agent/testing/debug_utils.py +135 -0
- solace_agent_mesh/agent/testing/testing_llm.txt +90 -0
- solace_agent_mesh/agent/tools/__init__.py +14 -0
- solace_agent_mesh/agent/tools/audio_tools.py +1622 -0
- solace_agent_mesh/agent/tools/builtin_artifact_tools.py +1954 -0
- solace_agent_mesh/agent/tools/builtin_data_analysis_tools.py +238 -0
- solace_agent_mesh/agent/tools/general_agent_tools.py +569 -0
- solace_agent_mesh/agent/tools/image_tools.py +1184 -0
- solace_agent_mesh/agent/tools/peer_agent_tool.py +289 -0
- solace_agent_mesh/agent/tools/registry.py +36 -0
- solace_agent_mesh/agent/tools/test_tools.py +135 -0
- solace_agent_mesh/agent/tools/tool_definition.py +45 -0
- solace_agent_mesh/agent/tools/tools_llm.txt +104 -0
- solace_agent_mesh/agent/tools/web_tools.py +381 -0
- solace_agent_mesh/agent/utils/artifact_helpers.py +927 -0
- solace_agent_mesh/agent/utils/config_parser.py +47 -0
- solace_agent_mesh/agent/utils/context_helpers.py +60 -0
- solace_agent_mesh/agent/utils/utils_llm.txt +153 -0
- solace_agent_mesh/assets/docs/404.html +16 -0
- solace_agent_mesh/assets/docs/assets/css/styles.906a1503.css +1 -0
- solace_agent_mesh/assets/docs/assets/images/Solace_AI_Framework_With_Broker-85f0a306a9bcdd20b390b7a949f6d862.png +0 -0
- solace_agent_mesh/assets/docs/assets/images/sac-flows-80d5b603c6aafd33e87945680ce0abf3.png +0 -0
- solace_agent_mesh/assets/docs/assets/images/sac_parts_of_a_component-cb3d0424b1d0c17734c5435cca6b4082.png +0 -0
- solace_agent_mesh/assets/docs/assets/js/04989206.674a8007.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/0e682baa.79f0ab22.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1001.0182a8bd.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1023fc19.015679ca.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1039.0bd46aa1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/149.b797a808.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.91c7bc01.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/165.6a39807d.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/165.6a39807d.js.LICENSE.txt +9 -0
- solace_agent_mesh/assets/docs/assets/js/166ab619.7d97ccaf.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/17896441.a5e82f9b.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/17896441.a5e82f9b.js.LICENSE.txt +7 -0
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.23bccffb.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2130.ab9fd314.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/21ceee5f.614fa8dd.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2237.5e477fc6.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2334.622a6395.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.8909df92.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3219.adc1d663.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/332e10b5.7a103f42.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3624.b524e433.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/375.708d48db.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3834.b6cd790e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3d406171.f722eaf5.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4250.95455b28.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.36090198.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4356.d169ab5b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/442a8107.5ba94b65.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4458.518e66fa.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4488.c7cc3442.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4494.6ee23046.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4855.fc4444b6.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4866.22daefc0.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4950.ca4caeda.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/4c2787c2.66ee00e9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5388.7a136447.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/55f47984.c484bf96.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5607.081356f8.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5864.b0d0e9de.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.bda20761.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5e95c892.558d5167.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6143.0a1464c9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6395.e9c73649.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6796.51d2c9b7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6976.379be23b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6978.ee0b945c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7040.cb436723.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7195.412f418a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7280.3fb73bdb.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/768e31b0.a12673db.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7845.e33e7c4c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/7900.69516146.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8356.8a379c04.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/85387663.6bf41934.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8567.4732c6b7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8573.cb04eda5.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8577.1d54e766.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8591.d7c16be6.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/8591.d7c16be6.js.LICENSE.txt +61 -0
- solace_agent_mesh/assets/docs/assets/js/8709.7ecd4047.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8731.49e930c2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8908.f9d1b506.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9157.b4093d07.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9278.a4fd875d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/945fb41e.74d728aa.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9616.b75c2f6d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9793.c6d16376.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.1bf8f61c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.26ca071f.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a7bd4aaa.2204d2f7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a94703ab.0438dbc2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/aba21aa0.c42a534c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/aba87c2f.d3e2dcc3.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ae4415af.8e279b5d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/b7006a3a.40b10c9d.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/bac0be12.f50d9bac.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/bb2ef573.207e6990.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c2c06897.63b76e9e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cc969b05.954186d4.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.ca6eed8c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ced92a13.fb92e7ca.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cee5d587.f5b73ca1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f284c35a.ecc3d195.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f897a61a.2c2e152c.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/fbfa3e75.aca209c9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/main.7ed3319f.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/main.7ed3319f.js.LICENSE.txt +81 -0
- solace_agent_mesh/assets/docs/assets/js/runtime~main.d9520ae2.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +128 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +91 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +201 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +91 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +55 -0
- solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +82 -0
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +60 -0
- solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +48 -0
- solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +54 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +17 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +45 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +76 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +150 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +54 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +267 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +136 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +116 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +80 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +164 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +57 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +72 -0
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +102 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +99 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +90 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +107 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +152 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +103 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +170 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +200 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +54 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +69 -0
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +59 -0
- solace_agent_mesh/assets/docs/img/Solace_AI_Framework_README.png +0 -0
- solace_agent_mesh/assets/docs/img/Solace_AI_Framework_With_Broker.png +0 -0
- solace_agent_mesh/assets/docs/img/logo.png +0 -0
- solace_agent_mesh/assets/docs/img/sac-flows.png +0 -0
- solace_agent_mesh/assets/docs/img/sac_parts_of_a_component.png +0 -0
- solace_agent_mesh/assets/docs/img/solace-logo.png +0 -0
- solace_agent_mesh/assets/docs/lunr-index-1753813536522.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -0
- solace_agent_mesh/assets/docs/search-doc-1753813536522.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -0
- solace_agent_mesh/assets/docs/sitemap.xml +1 -0
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/add_cmd/__init__.py +15 -0
- solace_agent_mesh/cli/commands/add_cmd/add_cmd_llm.txt +250 -0
- solace_agent_mesh/cli/commands/add_cmd/agent_cmd.py +659 -0
- solace_agent_mesh/cli/commands/add_cmd/gateway_cmd.py +322 -0
- solace_agent_mesh/cli/commands/add_cmd/web_add_agent_step.py +93 -0
- solace_agent_mesh/cli/commands/add_cmd/web_add_gateway_step.py +118 -0
- solace_agent_mesh/cli/commands/docs_cmd.py +57 -0
- solace_agent_mesh/cli/commands/eval_cmd.py +64 -0
- solace_agent_mesh/cli/commands/init_cmd/__init__.py +404 -0
- solace_agent_mesh/cli/commands/init_cmd/broker_step.py +201 -0
- solace_agent_mesh/cli/commands/init_cmd/directory_step.py +28 -0
- solace_agent_mesh/cli/commands/init_cmd/env_step.py +197 -0
- solace_agent_mesh/cli/commands/init_cmd/init_cmd_llm.txt +365 -0
- solace_agent_mesh/cli/commands/init_cmd/orchestrator_step.py +387 -0
- solace_agent_mesh/cli/commands/init_cmd/project_files_step.py +38 -0
- solace_agent_mesh/cli/commands/init_cmd/web_init_step.py +110 -0
- solace_agent_mesh/cli/commands/init_cmd/webui_gateway_step.py +183 -0
- solace_agent_mesh/cli/commands/plugin_cmd/__init__.py +18 -0
- solace_agent_mesh/cli/commands/plugin_cmd/add_cmd.py +372 -0
- solace_agent_mesh/cli/commands/plugin_cmd/build_cmd.py +86 -0
- solace_agent_mesh/cli/commands/plugin_cmd/catalog_cmd.py +138 -0
- solace_agent_mesh/cli/commands/plugin_cmd/create_cmd.py +309 -0
- solace_agent_mesh/cli/commands/plugin_cmd/official_registry.py +174 -0
- solace_agent_mesh/cli/commands/plugin_cmd/plugin_cmd_llm.txt +305 -0
- solace_agent_mesh/cli/commands/run_cmd.py +158 -0
- solace_agent_mesh/cli/main.py +17 -294
- solace_agent_mesh/cli/utils.py +135 -204
- solace_agent_mesh/client/webui/frontend/static/assets/authCallback-DvlO62me.js +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/client-bp6u3qVZ.js +49 -0
- solace_agent_mesh/client/webui/frontend/static/assets/favicon-BLgzUch9.ico +0 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-An0a5j5k.js +663 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-Bu5-4Bac.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +14 -0
- solace_agent_mesh/client/webui/frontend/static/index.html +15 -0
- solace_agent_mesh/common/__init__.py +1 -0
- solace_agent_mesh/common/a2a_protocol.py +564 -0
- solace_agent_mesh/common/agent_registry.py +42 -0
- solace_agent_mesh/common/client/__init__.py +4 -0
- solace_agent_mesh/common/client/card_resolver.py +21 -0
- solace_agent_mesh/common/client/client.py +85 -0
- solace_agent_mesh/common/client/client_llm.txt +133 -0
- solace_agent_mesh/common/common_llm.txt +144 -0
- solace_agent_mesh/common/constants.py +1 -14
- solace_agent_mesh/common/middleware/__init__.py +12 -0
- solace_agent_mesh/common/middleware/config_resolver.py +130 -0
- solace_agent_mesh/common/middleware/middleware_llm.txt +174 -0
- solace_agent_mesh/common/middleware/registry.py +125 -0
- solace_agent_mesh/common/server/__init__.py +4 -0
- solace_agent_mesh/common/server/server.py +122 -0
- solace_agent_mesh/common/server/server_llm.txt +169 -0
- solace_agent_mesh/common/server/task_manager.py +291 -0
- solace_agent_mesh/common/server/utils.py +28 -0
- solace_agent_mesh/common/services/__init__.py +4 -0
- solace_agent_mesh/common/services/employee_service.py +162 -0
- solace_agent_mesh/common/services/identity_service.py +129 -0
- solace_agent_mesh/common/services/providers/__init__.py +4 -0
- solace_agent_mesh/common/services/providers/local_file_identity_service.py +148 -0
- solace_agent_mesh/common/services/providers/providers_llm.txt +113 -0
- solace_agent_mesh/common/services/services_llm.txt +132 -0
- solace_agent_mesh/common/types.py +411 -0
- solace_agent_mesh/common/utils/__init__.py +7 -0
- solace_agent_mesh/common/utils/asyncio_macos_fix.py +86 -0
- solace_agent_mesh/common/utils/embeds/__init__.py +33 -0
- solace_agent_mesh/common/utils/embeds/constants.py +55 -0
- solace_agent_mesh/common/utils/embeds/converter.py +452 -0
- solace_agent_mesh/common/utils/embeds/embeds_llm.txt +124 -0
- solace_agent_mesh/common/utils/embeds/evaluators.py +394 -0
- solace_agent_mesh/common/utils/embeds/modifiers.py +816 -0
- solace_agent_mesh/common/utils/embeds/resolver.py +865 -0
- solace_agent_mesh/common/utils/embeds/types.py +14 -0
- solace_agent_mesh/common/utils/in_memory_cache.py +108 -0
- solace_agent_mesh/common/utils/log_formatters.py +44 -0
- solace_agent_mesh/common/utils/mime_helpers.py +106 -0
- solace_agent_mesh/common/utils/push_notification_auth.py +134 -0
- solace_agent_mesh/common/utils/utils_llm.txt +67 -0
- solace_agent_mesh/config_portal/backend/common.py +66 -24
- solace_agent_mesh/config_portal/backend/plugin_catalog/constants.py +23 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog/models.py +49 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog/registry_manager.py +160 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog/scraper.py +525 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog_server.py +216 -0
- solace_agent_mesh/config_portal/backend/server.py +550 -140
- solace_agent_mesh/config_portal/frontend/static/client/assets/_index-DNxCwAGB.js +48 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/components-B7lKcHVY.js +140 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/{entry.client-DX1misIU.js → entry.client-CEumGClk.js} +3 -3
- solace_agent_mesh/config_portal/frontend/static/client/assets/index-DSo1AH_7.js +68 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-d2b54a97.js +1 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/{root-BApq5dPK.js → root-C4XmHinv.js} +2 -2
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-DxRwaWiE.css +1 -0
- solace_agent_mesh/config_portal/frontend/static/client/index.html +3 -3
- solace_agent_mesh/core_a2a/__init__.py +1 -0
- solace_agent_mesh/core_a2a/core_a2a_llm.txt +88 -0
- solace_agent_mesh/core_a2a/service.py +331 -0
- solace_agent_mesh/evaluation/config_loader.py +657 -0
- solace_agent_mesh/evaluation/evaluator.py +667 -0
- solace_agent_mesh/evaluation/message_organizer.py +568 -0
- solace_agent_mesh/evaluation/report/benchmark_info.html +35 -0
- solace_agent_mesh/evaluation/report/chart_section.html +141 -0
- solace_agent_mesh/evaluation/report/detailed_breakdown.html +28 -0
- solace_agent_mesh/evaluation/report/modal.html +59 -0
- solace_agent_mesh/evaluation/report/modal_chart_functions.js +411 -0
- solace_agent_mesh/evaluation/report/modal_script.js +296 -0
- solace_agent_mesh/evaluation/report/modal_styles.css +340 -0
- solace_agent_mesh/evaluation/report/performance_metrics_styles.css +93 -0
- solace_agent_mesh/evaluation/report/templates/footer.html +2 -0
- solace_agent_mesh/evaluation/report/templates/header.html +340 -0
- solace_agent_mesh/evaluation/report_data_processor.py +972 -0
- solace_agent_mesh/evaluation/report_generator.py +613 -0
- solace_agent_mesh/evaluation/run.py +613 -0
- solace_agent_mesh/evaluation/subscriber.py +872 -0
- solace_agent_mesh/evaluation/summary_builder.py +775 -0
- solace_agent_mesh/evaluation/test_case_loader.py +714 -0
- solace_agent_mesh/gateway/base/__init__.py +1 -0
- solace_agent_mesh/gateway/base/app.py +266 -0
- solace_agent_mesh/gateway/base/base_llm.txt +119 -0
- solace_agent_mesh/gateway/base/component.py +1542 -0
- solace_agent_mesh/gateway/base/task_context.py +74 -0
- solace_agent_mesh/gateway/gateway_llm.txt +125 -0
- solace_agent_mesh/gateway/http_sse/app.py +190 -0
- solace_agent_mesh/gateway/http_sse/component.py +1602 -0
- solace_agent_mesh/gateway/http_sse/components/__init__.py +7 -0
- solace_agent_mesh/gateway/http_sse/components/components_llm.txt +65 -0
- solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +108 -0
- solace_agent_mesh/gateway/http_sse/dependencies.py +316 -0
- solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +63 -0
- solace_agent_mesh/gateway/http_sse/main.py +442 -0
- solace_agent_mesh/gateway/http_sse/routers/__init__.py +4 -0
- solace_agent_mesh/gateway/http_sse/routers/agents.py +41 -0
- solace_agent_mesh/gateway/http_sse/routers/artifacts.py +821 -0
- solace_agent_mesh/gateway/http_sse/routers/auth.py +212 -0
- solace_agent_mesh/gateway/http_sse/routers/config.py +55 -0
- solace_agent_mesh/gateway/http_sse/routers/people.py +69 -0
- solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +37 -0
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +80 -0
- solace_agent_mesh/gateway/http_sse/routers/sse.py +138 -0
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +294 -0
- solace_agent_mesh/gateway/http_sse/routers/users.py +59 -0
- solace_agent_mesh/gateway/http_sse/routers/visualization.py +1131 -0
- solace_agent_mesh/gateway/http_sse/services/__init__.py +4 -0
- solace_agent_mesh/gateway/http_sse/services/agent_service.py +69 -0
- solace_agent_mesh/gateway/http_sse/services/people_service.py +158 -0
- solace_agent_mesh/gateway/http_sse/services/services_llm.txt +179 -0
- solace_agent_mesh/gateway/http_sse/services/task_service.py +121 -0
- solace_agent_mesh/gateway/http_sse/session_manager.py +187 -0
- solace_agent_mesh/gateway/http_sse/sse_manager.py +328 -0
- solace_agent_mesh/llm.txt +228 -0
- solace_agent_mesh/llm_detail.txt +2835 -0
- solace_agent_mesh/templates/agent_template.yaml +53 -0
- solace_agent_mesh/templates/eval_backend_template.yaml +54 -0
- solace_agent_mesh/templates/gateway_app_template.py +73 -0
- solace_agent_mesh/templates/gateway_component_template.py +400 -0
- solace_agent_mesh/templates/gateway_config_template.yaml +43 -0
- solace_agent_mesh/templates/main_orchestrator.yaml +55 -0
- solace_agent_mesh/templates/plugin_agent_config_template.yaml +122 -0
- solace_agent_mesh/templates/plugin_custom_config_template.yaml +27 -0
- solace_agent_mesh/templates/plugin_custom_template.py +10 -0
- solace_agent_mesh/templates/plugin_gateway_config_template.yaml +63 -0
- solace_agent_mesh/templates/plugin_pyproject_template.toml +33 -0
- solace_agent_mesh/templates/plugin_readme_template.md +34 -0
- solace_agent_mesh/templates/plugin_tools_template.py +224 -0
- solace_agent_mesh/templates/shared_config.yaml +66 -0
- solace_agent_mesh/templates/templates_llm.txt +147 -0
- solace_agent_mesh/templates/webui.yaml +53 -0
- solace_agent_mesh-1.0.1.dist-info/METADATA +432 -0
- solace_agent_mesh-1.0.1.dist-info/RECORD +359 -0
- solace_agent_mesh-1.0.1.dist-info/entry_points.txt +3 -0
- {solace_agent_mesh-0.2.3.dist-info → solace_agent_mesh-1.0.1.dist-info}/licenses/LICENSE +1 -1
- solace_agent_mesh/agents/base_agent_component.py +0 -226
- solace_agent_mesh/agents/global/actions/agent_state_change.py +0 -54
- solace_agent_mesh/agents/global/actions/clear_history.py +0 -32
- solace_agent_mesh/agents/global/actions/convert_file_to_markdown.py +0 -160
- solace_agent_mesh/agents/global/actions/create_file.py +0 -70
- solace_agent_mesh/agents/global/actions/error_action.py +0 -45
- solace_agent_mesh/agents/global/actions/plantuml_diagram.py +0 -163
- solace_agent_mesh/agents/global/actions/plotly_graph.py +0 -152
- solace_agent_mesh/agents/global/actions/retrieve_file.py +0 -51
- solace_agent_mesh/agents/global/global_agent_component.py +0 -38
- solace_agent_mesh/agents/image_processing/actions/create_image.py +0 -75
- solace_agent_mesh/agents/image_processing/actions/describe_image.py +0 -115
- solace_agent_mesh/agents/image_processing/image_processing_agent_component.py +0 -23
- solace_agent_mesh/agents/slack/__init__.py +0 -1
- solace_agent_mesh/agents/slack/actions/__init__.py +0 -1
- solace_agent_mesh/agents/slack/actions/post_message.py +0 -177
- solace_agent_mesh/agents/slack/slack_agent_component.py +0 -59
- solace_agent_mesh/agents/web_request/actions/do_image_search.py +0 -84
- solace_agent_mesh/agents/web_request/actions/do_news_search.py +0 -47
- solace_agent_mesh/agents/web_request/actions/do_suggestion_search.py +0 -34
- solace_agent_mesh/agents/web_request/actions/do_web_request.py +0 -135
- solace_agent_mesh/agents/web_request/actions/download_file.py +0 -69
- solace_agent_mesh/agents/web_request/web_request_agent_component.py +0 -33
- solace_agent_mesh/assets/web-visualizer/assets/index-D0qORgkg.css +0 -1
- solace_agent_mesh/assets/web-visualizer/assets/index-DnDr1pnu.js +0 -109
- solace_agent_mesh/assets/web-visualizer/index.html +0 -14
- solace_agent_mesh/assets/web-visualizer/vite.svg +0 -1
- solace_agent_mesh/cli/commands/add/__init__.py +0 -3
- solace_agent_mesh/cli/commands/add/add.py +0 -88
- solace_agent_mesh/cli/commands/add/agent.py +0 -110
- solace_agent_mesh/cli/commands/add/copy_from_plugin.py +0 -92
- solace_agent_mesh/cli/commands/add/gateway.py +0 -374
- solace_agent_mesh/cli/commands/build.py +0 -670
- solace_agent_mesh/cli/commands/chat/__init__.py +0 -3
- solace_agent_mesh/cli/commands/chat/chat.py +0 -361
- solace_agent_mesh/cli/commands/config.py +0 -29
- solace_agent_mesh/cli/commands/init/__init__.py +0 -3
- solace_agent_mesh/cli/commands/init/ai_provider_step.py +0 -93
- solace_agent_mesh/cli/commands/init/broker_step.py +0 -99
- solace_agent_mesh/cli/commands/init/builtin_agent_step.py +0 -83
- solace_agent_mesh/cli/commands/init/check_if_already_done.py +0 -13
- solace_agent_mesh/cli/commands/init/create_config_file_step.py +0 -65
- solace_agent_mesh/cli/commands/init/create_other_project_files_step.py +0 -147
- solace_agent_mesh/cli/commands/init/file_service_step.py +0 -73
- solace_agent_mesh/cli/commands/init/init.py +0 -92
- solace_agent_mesh/cli/commands/init/project_structure_step.py +0 -16
- solace_agent_mesh/cli/commands/init/web_init_step.py +0 -32
- solace_agent_mesh/cli/commands/plugin/__init__.py +0 -3
- solace_agent_mesh/cli/commands/plugin/add.py +0 -100
- solace_agent_mesh/cli/commands/plugin/build.py +0 -268
- solace_agent_mesh/cli/commands/plugin/create.py +0 -117
- solace_agent_mesh/cli/commands/plugin/plugin.py +0 -124
- solace_agent_mesh/cli/commands/plugin/remove.py +0 -73
- solace_agent_mesh/cli/commands/run.py +0 -68
- solace_agent_mesh/cli/commands/visualizer.py +0 -138
- solace_agent_mesh/cli/config.py +0 -85
- solace_agent_mesh/common/action.py +0 -91
- solace_agent_mesh/common/action_list.py +0 -37
- solace_agent_mesh/common/action_response.py +0 -340
- solace_agent_mesh/common/mysql_database.py +0 -40
- solace_agent_mesh/common/postgres_database.py +0 -85
- solace_agent_mesh/common/prompt_templates.py +0 -28
- solace_agent_mesh/common/stimulus_utils.py +0 -152
- solace_agent_mesh/common/time.py +0 -24
- solace_agent_mesh/common/utils.py +0 -712
- solace_agent_mesh/config_portal/frontend/static/client/assets/_index-DMmCawWe.js +0 -42
- solace_agent_mesh/config_portal/frontend/static/client/assets/components-ZIfdTbrV.js +0 -191
- solace_agent_mesh/config_portal/frontend/static/client/assets/index-BJHAE5s4.js +0 -17
- solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-dd988f05.js +0 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-DX4gQ516.css +0 -1
- solace_agent_mesh/configs/agent_global.yaml +0 -74
- solace_agent_mesh/configs/agent_image_processing.yaml +0 -82
- solace_agent_mesh/configs/agent_slack.yaml +0 -64
- solace_agent_mesh/configs/agent_web_request.yaml +0 -75
- solace_agent_mesh/configs/conversation_to_file.yaml +0 -56
- solace_agent_mesh/configs/error_catcher.yaml +0 -56
- solace_agent_mesh/configs/monitor.yaml +0 -0
- solace_agent_mesh/configs/monitor_stim_and_errors_to_slack.yaml +0 -109
- solace_agent_mesh/configs/monitor_user_feedback.yaml +0 -58
- solace_agent_mesh/configs/orchestrator.yaml +0 -241
- solace_agent_mesh/configs/service_embedding.yaml +0 -81
- solace_agent_mesh/configs/service_llm.yaml +0 -265
- solace_agent_mesh/configs/visualize_websocket.yaml +0 -55
- solace_agent_mesh/gateway/components/gateway_base.py +0 -47
- solace_agent_mesh/gateway/components/gateway_input.py +0 -278
- solace_agent_mesh/gateway/components/gateway_output.py +0 -298
- solace_agent_mesh/gateway/identity/bamboohr_identity.py +0 -18
- solace_agent_mesh/gateway/identity/identity_base.py +0 -10
- solace_agent_mesh/gateway/identity/identity_provider.py +0 -60
- solace_agent_mesh/gateway/identity/no_identity.py +0 -9
- solace_agent_mesh/gateway/identity/passthru_identity.py +0 -9
- solace_agent_mesh/monitors/base_monitor_component.py +0 -26
- solace_agent_mesh/monitors/feedback/user_feedback_monitor.py +0 -75
- solace_agent_mesh/monitors/stim_and_errors/stim_and_error_monitor.py +0 -560
- solace_agent_mesh/orchestrator/__init__.py +0 -0
- solace_agent_mesh/orchestrator/action_manager.py +0 -237
- solace_agent_mesh/orchestrator/components/__init__.py +0 -0
- solace_agent_mesh/orchestrator/components/orchestrator_action_manager_timeout_component.py +0 -58
- solace_agent_mesh/orchestrator/components/orchestrator_action_response_component.py +0 -179
- solace_agent_mesh/orchestrator/components/orchestrator_register_component.py +0 -107
- solace_agent_mesh/orchestrator/components/orchestrator_stimulus_processor_component.py +0 -527
- solace_agent_mesh/orchestrator/components/orchestrator_streaming_output_component.py +0 -260
- solace_agent_mesh/orchestrator/orchestrator_main.py +0 -172
- solace_agent_mesh/orchestrator/orchestrator_prompt.py +0 -539
- solace_agent_mesh/services/__init__.py +0 -0
- solace_agent_mesh/services/authorization/providers/base_authorization_provider.py +0 -56
- solace_agent_mesh/services/bamboo_hr_service/__init__.py +0 -3
- solace_agent_mesh/services/bamboo_hr_service/bamboo_hr.py +0 -182
- solace_agent_mesh/services/common/__init__.py +0 -4
- solace_agent_mesh/services/common/auto_expiry.py +0 -45
- solace_agent_mesh/services/common/singleton.py +0 -18
- solace_agent_mesh/services/file_service/__init__.py +0 -14
- solace_agent_mesh/services/file_service/file_manager/__init__.py +0 -0
- solace_agent_mesh/services/file_service/file_manager/bucket_file_manager.py +0 -149
- solace_agent_mesh/services/file_service/file_manager/file_manager_base.py +0 -162
- solace_agent_mesh/services/file_service/file_manager/memory_file_manager.py +0 -64
- solace_agent_mesh/services/file_service/file_manager/volume_file_manager.py +0 -106
- solace_agent_mesh/services/file_service/file_service.py +0 -437
- solace_agent_mesh/services/file_service/file_service_constants.py +0 -54
- solace_agent_mesh/services/file_service/file_transformations.py +0 -141
- solace_agent_mesh/services/file_service/file_utils.py +0 -324
- solace_agent_mesh/services/file_service/transformers/__init__.py +0 -5
- solace_agent_mesh/services/history_service/__init__.py +0 -3
- solace_agent_mesh/services/history_service/history_providers/__init__.py +0 -0
- solace_agent_mesh/services/history_service/history_providers/base_history_provider.py +0 -54
- solace_agent_mesh/services/history_service/history_providers/file_history_provider.py +0 -74
- solace_agent_mesh/services/history_service/history_providers/index.py +0 -40
- solace_agent_mesh/services/history_service/history_providers/memory_history_provider.py +0 -33
- solace_agent_mesh/services/history_service/history_providers/mongodb_history_provider.py +0 -66
- solace_agent_mesh/services/history_service/history_providers/redis_history_provider.py +0 -66
- solace_agent_mesh/services/history_service/history_providers/sql_history_provider.py +0 -93
- solace_agent_mesh/services/history_service/history_service.py +0 -413
- solace_agent_mesh/services/history_service/long_term_memory/__init__.py +0 -0
- solace_agent_mesh/services/history_service/long_term_memory/long_term_memory.py +0 -399
- solace_agent_mesh/services/llm_service/components/llm_request_component.py +0 -340
- solace_agent_mesh/services/llm_service/components/llm_service_component_base.py +0 -152
- solace_agent_mesh/services/middleware_service/__init__.py +0 -0
- solace_agent_mesh/services/middleware_service/middleware_service.py +0 -20
- solace_agent_mesh/templates/action.py +0 -38
- solace_agent_mesh/templates/agent.py +0 -29
- solace_agent_mesh/templates/agent.yaml +0 -70
- solace_agent_mesh/templates/gateway-config-template.yaml +0 -6
- solace_agent_mesh/templates/gateway-default-config.yaml +0 -28
- solace_agent_mesh/templates/gateway-flows.yaml +0 -78
- solace_agent_mesh/templates/gateway-header.yaml +0 -16
- solace_agent_mesh/templates/gateway_base.py +0 -15
- solace_agent_mesh/templates/gateway_input.py +0 -98
- solace_agent_mesh/templates/gateway_output.py +0 -71
- solace_agent_mesh/templates/plugin-gateway-default-config.yaml +0 -29
- solace_agent_mesh/templates/plugin-pyproject.toml +0 -30
- solace_agent_mesh/templates/rest-api-default-config.yaml +0 -31
- solace_agent_mesh/templates/rest-api-flows.yaml +0 -81
- solace_agent_mesh/templates/slack-default-config.yaml +0 -16
- solace_agent_mesh/templates/slack-flows.yaml +0 -81
- solace_agent_mesh/templates/solace-agent-mesh-default.yaml +0 -86
- solace_agent_mesh/templates/solace-agent-mesh-plugin-default.yaml +0 -8
- solace_agent_mesh/templates/web-default-config.yaml +0 -10
- solace_agent_mesh/templates/web-flows.yaml +0 -76
- solace_agent_mesh/tools/__init__.py +0 -0
- solace_agent_mesh/tools/components/__init__.py +0 -0
- solace_agent_mesh/tools/components/conversation_formatter.py +0 -111
- solace_agent_mesh/tools/components/file_resolver_component.py +0 -58
- solace_agent_mesh/tools/config/runtime_config.py +0 -26
- solace_agent_mesh-0.2.3.dist-info/METADATA +0 -172
- solace_agent_mesh-0.2.3.dist-info/RECORD +0 -193
- solace_agent_mesh-0.2.3.dist-info/entry_points.txt +0 -3
- /solace_agent_mesh/{agents → agent}/__init__.py +0 -0
- /solace_agent_mesh/{agents/global → agent/adk}/__init__.py +0 -0
- /solace_agent_mesh/{agents/global/actions → agent/protocol}/__init__.py +0 -0
- /solace_agent_mesh/{agents/image_processing → agent/sac}/__init__.py +0 -0
- /solace_agent_mesh/{agents/image_processing/actions → agent/utils}/__init__.py +0 -0
- /solace_agent_mesh/{agents/web_request → config_portal/backend/plugin_catalog}/__init__.py +0 -0
- /solace_agent_mesh/{agents/web_request/actions → evaluation}/__init__.py +0 -0
- /solace_agent_mesh/gateway/{components → http_sse}/__init__.py +0 -0
- {solace_agent_mesh-0.2.3.dist-info → solace_agent_mesh-1.0.1.dist-info}/WHEEL +0 -0
|
@@ -1,712 +0,0 @@
|
|
|
1
|
-
"""Grab-bag of common utility functions."""
|
|
2
|
-
|
|
3
|
-
import re
|
|
4
|
-
import yaml
|
|
5
|
-
import xml.etree.ElementTree as ET
|
|
6
|
-
from solace_ai_connector.common.log import log
|
|
7
|
-
|
|
8
|
-
from ..services.file_service import FileService
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def escape_special_characters(xml_string):
|
|
12
|
-
"""
|
|
13
|
-
Escapes special characters in an XML string.
|
|
14
|
-
"""
|
|
15
|
-
# Escape & if it's not part of an entity like &
|
|
16
|
-
xml_string = re.sub(r"&(?!amp;|lt;|gt;|apos;|quot;)", "&", xml_string)
|
|
17
|
-
return xml_string
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def extract_and_ignore_tag_content(xml_string, tag):
|
|
21
|
-
"""
|
|
22
|
-
Extracts a tag and ignores its content.
|
|
23
|
-
"""
|
|
24
|
-
# Find the first <data> tag and the last </data> tag
|
|
25
|
-
start_index = xml_string.find(f"<{tag}")
|
|
26
|
-
end_index = xml_string.rfind(f"</{tag}>")
|
|
27
|
-
|
|
28
|
-
if start_index == -1 or end_index == -1:
|
|
29
|
-
# If no <data> or </data> is found, return the original string and empty data content
|
|
30
|
-
return xml_string, {}
|
|
31
|
-
|
|
32
|
-
# Extract attributes of the first <data> tag
|
|
33
|
-
open_tag_end = xml_string.find(">", start_index) + 1
|
|
34
|
-
data_open_tag = xml_string[start_index:open_tag_end]
|
|
35
|
-
|
|
36
|
-
# Extract the content of the first <data> tag
|
|
37
|
-
open_tag_xml_string = data_open_tag + f"</{tag}>"
|
|
38
|
-
data_attributes = xml_to_dict(open_tag_xml_string, None)[tag]
|
|
39
|
-
|
|
40
|
-
# Extract content between the first <data> and the last </data>
|
|
41
|
-
data_content = xml_string[open_tag_end:end_index].strip()
|
|
42
|
-
|
|
43
|
-
# Remove the <data>...</data> section from the XML string
|
|
44
|
-
xml_string = xml_string[:start_index] + xml_string[end_index + len(f"</{tag}>") :]
|
|
45
|
-
|
|
46
|
-
data_attributes[tag] = data_content
|
|
47
|
-
|
|
48
|
-
return xml_string, data_attributes
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def xml_to_dict(xml_string, ignore_content_tags=[], strip_uniquifier_tag_prefix=False):
|
|
52
|
-
"""
|
|
53
|
-
Converts an XML string to a dictionary.
|
|
54
|
-
|
|
55
|
-
Parameters:
|
|
56
|
-
- xml_string (str): The XML string.
|
|
57
|
-
- ignore_content_tags (list): A list of tags whose content should be ignored (content is returned as a string).
|
|
58
|
-
"""
|
|
59
|
-
# Extract the <data> block, its content, and its attributes
|
|
60
|
-
ignore_contents = {}
|
|
61
|
-
if ignore_content_tags and len(ignore_content_tags) > 0:
|
|
62
|
-
for escape_tag in ignore_content_tags:
|
|
63
|
-
xml_string, data_content = extract_and_ignore_tag_content(
|
|
64
|
-
xml_string, escape_tag
|
|
65
|
-
)
|
|
66
|
-
ignore_contents[escape_tag] = data_content
|
|
67
|
-
|
|
68
|
-
# Escape special characters in the XML string
|
|
69
|
-
xml_string = escape_special_characters(xml_string)
|
|
70
|
-
|
|
71
|
-
def parse_element(element):
|
|
72
|
-
parsed_dict = {}
|
|
73
|
-
|
|
74
|
-
# Get the tag of the element
|
|
75
|
-
element_tag = element.tag
|
|
76
|
-
if strip_uniquifier_tag_prefix:
|
|
77
|
-
element_tag = element_tag.split("_", 1)[-1]
|
|
78
|
-
|
|
79
|
-
# Add element attributes
|
|
80
|
-
if element.attrib:
|
|
81
|
-
parsed_dict.update(element.attrib)
|
|
82
|
-
|
|
83
|
-
# If the element has children, recursively parse them
|
|
84
|
-
if list(element):
|
|
85
|
-
for child in element:
|
|
86
|
-
tag = child.tag
|
|
87
|
-
if strip_uniquifier_tag_prefix:
|
|
88
|
-
tag = tag.split("_", 1)[-1]
|
|
89
|
-
child_dict = parse_element(child)
|
|
90
|
-
if tag in parsed_dict:
|
|
91
|
-
# If tag already exists, convert it into a list of values
|
|
92
|
-
if not isinstance(parsed_dict[tag], list):
|
|
93
|
-
parsed_dict[tag] = [parsed_dict[tag]]
|
|
94
|
-
parsed_dict[tag].append(child_dict[tag])
|
|
95
|
-
else:
|
|
96
|
-
parsed_dict[tag] = child_dict[tag]
|
|
97
|
-
|
|
98
|
-
# If the element contains text, store it
|
|
99
|
-
if element.text and element.text.strip():
|
|
100
|
-
parsed_dict[element_tag] = element.text.strip()
|
|
101
|
-
|
|
102
|
-
return {element_tag: parsed_dict}
|
|
103
|
-
|
|
104
|
-
# Parse the remaining XML string
|
|
105
|
-
root = ET.fromstring(xml_string)
|
|
106
|
-
|
|
107
|
-
# Convert the root element to dictionary
|
|
108
|
-
parsed_dict = parse_element(root)
|
|
109
|
-
|
|
110
|
-
# Add the ignored <data> content and attributes back into the dictionary
|
|
111
|
-
if ignore_contents:
|
|
112
|
-
parsed_dict.update(ignore_contents)
|
|
113
|
-
|
|
114
|
-
return parsed_dict
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def parse_yaml_response(response: str) -> dict:
|
|
118
|
-
"""Parse a YAML response that came back from an LLM."""
|
|
119
|
-
# Need to deal with the possibility of a None response or the
|
|
120
|
-
# yaml is surrounded by ```yaml...```
|
|
121
|
-
if not response:
|
|
122
|
-
return {}
|
|
123
|
-
if "<response" in response:
|
|
124
|
-
tag_name = re.search(r"<response[^>]*>", response).group(0)
|
|
125
|
-
response = response.split(tag_name, 1)[1]
|
|
126
|
-
response = response.rsplit(f"</{tag_name[1:]}", 1)[0]
|
|
127
|
-
if "```yaml" in response:
|
|
128
|
-
response = response.split("```yaml", 1)[1]
|
|
129
|
-
response = response.rsplit("```", 1)[0]
|
|
130
|
-
return yaml.safe_load(response)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
def split_text(text, max_len=2000):
|
|
134
|
-
pattern = r".{1,%d}(?:\n|\.|\s|$)" % max_len
|
|
135
|
-
return re.findall(pattern, text, re.DOTALL)
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def parse_file_content(file_xml: str) -> dict:
|
|
139
|
-
"""
|
|
140
|
-
Parse the xml tags in the content and return a dictionary of the content.
|
|
141
|
-
"""
|
|
142
|
-
try:
|
|
143
|
-
# It is possible that the content of the file mistakenly has t###_ prefixes on the
|
|
144
|
-
# tags, so we need to strip them off. This is a bit of a hack to work around LLM errors
|
|
145
|
-
|
|
146
|
-
file_xml = re.sub(r"<t\d+_", "<", file_xml)
|
|
147
|
-
file_xml = re.sub(r"</t\d+_", "</", file_xml)
|
|
148
|
-
|
|
149
|
-
ignore_content_tags = ["data"]
|
|
150
|
-
file_dict = xml_to_dict(file_xml, ignore_content_tags)
|
|
151
|
-
dict_keys = list(file_dict.keys())
|
|
152
|
-
top_key = [key for key in dict_keys if key not in ignore_content_tags][0]
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
"data": file_dict.get("data", {}).get("data", ""),
|
|
156
|
-
"url": file_dict.get(top_key, {}).get("url", {}).get("url", ""),
|
|
157
|
-
"mime_type": file_dict.get(top_key, {}).get("mime_type", ""),
|
|
158
|
-
"name": file_dict.get(top_key, {}).get("name", ""),
|
|
159
|
-
}
|
|
160
|
-
except Exception as e:
|
|
161
|
-
result = {"data": "", "url": "", "mime_type": "", "name": ""}
|
|
162
|
-
log.error("Error parsing file content: %s", e)
|
|
163
|
-
return result
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
def parse_llm_output(llm_output: str) -> dict:
|
|
167
|
-
# The response has <<< and >>> around the parameter string values
|
|
168
|
-
# We want to replace these strings with placeholders that we will
|
|
169
|
-
# replace with the actual values later. This removes long strings from the
|
|
170
|
-
# yaml that might cause parsing issues.
|
|
171
|
-
# We need to save all the strings that we replace so that we can put them back
|
|
172
|
-
# after we parse the yaml. Use a sequence number to create a unique placeholder
|
|
173
|
-
# for each string.
|
|
174
|
-
|
|
175
|
-
string_placeholders = {}
|
|
176
|
-
string_count = 0
|
|
177
|
-
sanity = 100
|
|
178
|
-
while "<<<" in llm_output and sanity > 0:
|
|
179
|
-
sanity -= 1
|
|
180
|
-
start = llm_output.index("<<<")
|
|
181
|
-
if not ">>>" in llm_output:
|
|
182
|
-
# set the end to the end of the string
|
|
183
|
-
end = len(llm_output)
|
|
184
|
-
else:
|
|
185
|
-
end = llm_output.index(">>>")
|
|
186
|
-
string = llm_output[start + 3 : end]
|
|
187
|
-
llm_output = (
|
|
188
|
-
llm_output[:start] + f"___STRING{string_count}___" + llm_output[end + 3 :]
|
|
189
|
-
)
|
|
190
|
-
# Also replace an newline characters in the string with a real newline
|
|
191
|
-
string = string.replace("\\n", "\n")
|
|
192
|
-
string_placeholders[f"___STRING{string_count}___"] = string
|
|
193
|
-
string_count += 1
|
|
194
|
-
|
|
195
|
-
# Sometimes the response comes back surrounded by <response-schema> tags
|
|
196
|
-
if "<response-schema>" in llm_output:
|
|
197
|
-
llm_output = llm_output.split("<response-schema>", 1)[1]
|
|
198
|
-
llm_output = llm_output.rsplit("</response-schema>", 1)[0]
|
|
199
|
-
|
|
200
|
-
if "<response>" in llm_output:
|
|
201
|
-
llm_output = llm_output.split("<response>", 1)[1]
|
|
202
|
-
llm_output = llm_output.rsplit("</response>", 1)[0]
|
|
203
|
-
|
|
204
|
-
if "<response-yaml>" in llm_output:
|
|
205
|
-
llm_output = llm_output.split("<response-yaml>", 1)[1]
|
|
206
|
-
llm_output = llm_output.rsplit("</response-yaml>", 1)[0]
|
|
207
|
-
|
|
208
|
-
# The llm_output should be yaml - it might be contained in ```yaml``` tags
|
|
209
|
-
if "```yaml" in llm_output:
|
|
210
|
-
# Get the text between the ```yaml and the final ```
|
|
211
|
-
# Note that there might be nesting of ``` tags, so don't
|
|
212
|
-
# just go to the next ```, but instead find the last one
|
|
213
|
-
llm_output = llm_output.split("```yaml", 1)[1]
|
|
214
|
-
llm_output = llm_output.rsplit("```", 1)[0]
|
|
215
|
-
|
|
216
|
-
obj = None
|
|
217
|
-
try:
|
|
218
|
-
obj = yaml.safe_load(llm_output)
|
|
219
|
-
except Exception:
|
|
220
|
-
# Remove the last line and try again
|
|
221
|
-
llm_output = llm_output.split("\n")[:-1]
|
|
222
|
-
try:
|
|
223
|
-
obj = yaml.safe_load("\n".join(llm_output))
|
|
224
|
-
except Exception:
|
|
225
|
-
return None
|
|
226
|
-
|
|
227
|
-
def replace_placeholder(value):
|
|
228
|
-
# Find all the placeholders in the string and replace them
|
|
229
|
-
def replace(match):
|
|
230
|
-
placeholder = match.group(0)
|
|
231
|
-
if placeholder in string_placeholders:
|
|
232
|
-
return string_placeholders[placeholder]
|
|
233
|
-
return match.group(0)
|
|
234
|
-
|
|
235
|
-
return re.sub(r"___STRING\d+___", replace, value)
|
|
236
|
-
|
|
237
|
-
# Replace the string placeholders in obj with the actual strings
|
|
238
|
-
def replace_strings(obj):
|
|
239
|
-
if isinstance(obj, dict):
|
|
240
|
-
for key, value in obj.items():
|
|
241
|
-
if isinstance(value, str):
|
|
242
|
-
obj[key] = replace_placeholder(value)
|
|
243
|
-
else:
|
|
244
|
-
replace_strings(value)
|
|
245
|
-
elif isinstance(obj, list):
|
|
246
|
-
for i, value in enumerate(obj):
|
|
247
|
-
if isinstance(value, str):
|
|
248
|
-
obj[i] = replace_placeholder(value)
|
|
249
|
-
else:
|
|
250
|
-
replace_strings(value)
|
|
251
|
-
|
|
252
|
-
replace_strings(obj)
|
|
253
|
-
return obj
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
def parse_orchestrator_response(
|
|
257
|
-
response, last_chunk=False, tag_prefix="", check_reasoning=True
|
|
258
|
-
):
|
|
259
|
-
tp = tag_prefix
|
|
260
|
-
parsed_data = {
|
|
261
|
-
"actions": [],
|
|
262
|
-
"current_subject_starting_id": None,
|
|
263
|
-
"errors": [],
|
|
264
|
-
"reasoning": None,
|
|
265
|
-
"content": [],
|
|
266
|
-
"status_updates": [],
|
|
267
|
-
"send_last_status_update": False,
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
if not response:
|
|
271
|
-
return parsed_data
|
|
272
|
-
|
|
273
|
-
if not tp:
|
|
274
|
-
# Learn the tag prefix from the response
|
|
275
|
-
match = re.search(r"<(t[\d]+_)", response)
|
|
276
|
-
if match:
|
|
277
|
-
tp = match.group(1)
|
|
278
|
-
else:
|
|
279
|
-
tp = ""
|
|
280
|
-
|
|
281
|
-
if not last_chunk:
|
|
282
|
-
response = remove_incomplete_tags_at_end(response)
|
|
283
|
-
|
|
284
|
-
# Parse out the <reasoning> tag - they are always first, so just do a
|
|
285
|
-
# simple search and remove them from the response
|
|
286
|
-
reasoning_match = re.search(
|
|
287
|
-
"<" + tp + r"reasoning>(.*?)</" + tp + "reasoning>", response, re.DOTALL
|
|
288
|
-
)
|
|
289
|
-
if reasoning_match:
|
|
290
|
-
parsed_data["reasoning"] = reasoning_match.group(1).strip()
|
|
291
|
-
response = re.sub(
|
|
292
|
-
"<" + tp + r"reasoning>.*?</" + tp + "reasoning>",
|
|
293
|
-
"",
|
|
294
|
-
response,
|
|
295
|
-
flags=re.DOTALL,
|
|
296
|
-
)
|
|
297
|
-
elif f"<{tp}reasoning>" in response:
|
|
298
|
-
parsed_data["errors"].append("Incomplete <reasoning> tag")
|
|
299
|
-
return parsed_data
|
|
300
|
-
else:
|
|
301
|
-
parsed_data["reasoning"] = None
|
|
302
|
-
|
|
303
|
-
# Get all the <{tp}status_update> tags
|
|
304
|
-
status_updates = []
|
|
305
|
-
status_matches = re.finditer(
|
|
306
|
-
f"<{tp}status_update>(.*?)</{tp}status_update>", response, re.DOTALL
|
|
307
|
-
)
|
|
308
|
-
for match in status_matches:
|
|
309
|
-
status_updates.append(match.group(1).strip())
|
|
310
|
-
response = response.replace(match.group(0), "", 1)
|
|
311
|
-
|
|
312
|
-
# Remove all complete status_update tags
|
|
313
|
-
response = re.sub(
|
|
314
|
-
f"<{tp}status_update>.*?</{tp}status_update>" + r"\s*",
|
|
315
|
-
"",
|
|
316
|
-
response,
|
|
317
|
-
flags=re.DOTALL,
|
|
318
|
-
)
|
|
319
|
-
|
|
320
|
-
# Remove any incomplete status_update tags
|
|
321
|
-
response = re.sub(f"<{tp}status_update>.*?($|<)", "", response, flags=re.DOTALL)
|
|
322
|
-
|
|
323
|
-
if status_updates:
|
|
324
|
-
parsed_data["status_updates"] = status_updates
|
|
325
|
-
|
|
326
|
-
# Parse out <file> tags and other elements
|
|
327
|
-
in_file = False
|
|
328
|
-
current_file = {}
|
|
329
|
-
file_content = []
|
|
330
|
-
current_action = {}
|
|
331
|
-
in_invoke_action = False
|
|
332
|
-
current_param_name = None
|
|
333
|
-
current_param_value = []
|
|
334
|
-
open_tags = []
|
|
335
|
-
current_text = []
|
|
336
|
-
seen_invoke_action = False
|
|
337
|
-
|
|
338
|
-
for line in response.split("\n"):
|
|
339
|
-
|
|
340
|
-
if f"<{tp}current_subject" in line:
|
|
341
|
-
id_match = re.search(r'starting_id\s*=\s*[\'"](\w+)[\'"]\s*\/?>', line)
|
|
342
|
-
if id_match:
|
|
343
|
-
parsed_data["current_subject_starting_id"] = id_match.group(1)
|
|
344
|
-
|
|
345
|
-
elif f"<{tp}file" in line:
|
|
346
|
-
in_file = True
|
|
347
|
-
# We can't guarantee the order of the attributes, so we need to parse them separately
|
|
348
|
-
name_match = re.search(r'name\s*=\s*[\'"]([^\'"]+)[\'"]', line)
|
|
349
|
-
mime_type_match = re.search(r'mime_type\s*=\s*[\'"]([^\'"]+)[\'"]', line)
|
|
350
|
-
current_file = {
|
|
351
|
-
"name": name_match.group(1) if name_match else "",
|
|
352
|
-
"mime_type": mime_type_match.group(1) if mime_type_match else "",
|
|
353
|
-
"url": "",
|
|
354
|
-
"data": "",
|
|
355
|
-
}
|
|
356
|
-
file_start_index = line.index(f"<{tp}file")
|
|
357
|
-
file_line = line[file_start_index:]
|
|
358
|
-
if f"</{tp}file>" in line:
|
|
359
|
-
file_end_index = line.index(f"</{tp}file>")
|
|
360
|
-
file_line = line[: file_end_index + len(f"</{tp}file>")]
|
|
361
|
-
file_content = [file_line]
|
|
362
|
-
current_file = parse_file_content("\n".join(file_content))
|
|
363
|
-
if not seen_invoke_action:
|
|
364
|
-
add_content_entry(parsed_data["content"], "file", current_file)
|
|
365
|
-
in_file = False
|
|
366
|
-
current_file = {}
|
|
367
|
-
file_content = []
|
|
368
|
-
else:
|
|
369
|
-
file_content.append(file_line)
|
|
370
|
-
|
|
371
|
-
elif f"</{tp}file>" in line:
|
|
372
|
-
if in_file:
|
|
373
|
-
if current_text:
|
|
374
|
-
add_content_entry(
|
|
375
|
-
parsed_data["content"], "text", current_text, add_newline=True
|
|
376
|
-
)
|
|
377
|
-
current_text = []
|
|
378
|
-
file_end_index = line.index(f"</{tp}file>")
|
|
379
|
-
file_line = line[: file_end_index + len(f"</{tp}file>")]
|
|
380
|
-
file_content.append(file_line)
|
|
381
|
-
current_file = parse_file_content("\n".join(file_content))
|
|
382
|
-
if not seen_invoke_action:
|
|
383
|
-
add_content_entry(parsed_data["content"], "file", current_file)
|
|
384
|
-
in_file = False
|
|
385
|
-
current_file = {}
|
|
386
|
-
file_content = []
|
|
387
|
-
else:
|
|
388
|
-
parsed_data["errors"].append("Unmatched </file> tag")
|
|
389
|
-
elif in_file:
|
|
390
|
-
file_content.append(line)
|
|
391
|
-
|
|
392
|
-
elif f"<{tp}invoke_action" in line:
|
|
393
|
-
if in_invoke_action:
|
|
394
|
-
parsed_data["errors"].append("Nested <invoke_action> tags")
|
|
395
|
-
in_invoke_action = True
|
|
396
|
-
seen_invoke_action = True
|
|
397
|
-
open_tags.append("invoke_action")
|
|
398
|
-
current_action = {
|
|
399
|
-
"agent": None,
|
|
400
|
-
"action": None,
|
|
401
|
-
"parameters": {},
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
for attr in ["agent", "action"]:
|
|
405
|
-
attr_match = re.search(rf'{attr}\s*=\s*[\'"]([_\-\.\w]+)[\'"]', line)
|
|
406
|
-
if attr_match:
|
|
407
|
-
current_action[attr] = attr_match.group(1)
|
|
408
|
-
|
|
409
|
-
elif f"</{tp}invoke_action>" in line:
|
|
410
|
-
if not in_invoke_action:
|
|
411
|
-
parsed_data["errors"].append("Unmatched </invoke_action> tag")
|
|
412
|
-
else:
|
|
413
|
-
in_invoke_action = False
|
|
414
|
-
if "invoke_action" in open_tags:
|
|
415
|
-
open_tags.remove("invoke_action")
|
|
416
|
-
if current_param_name:
|
|
417
|
-
current_action["parameters"][current_param_name] = "\n".join(
|
|
418
|
-
current_param_value
|
|
419
|
-
)
|
|
420
|
-
parsed_data["actions"].append(current_action)
|
|
421
|
-
current_action = {}
|
|
422
|
-
current_param_name = None
|
|
423
|
-
current_param_value = []
|
|
424
|
-
|
|
425
|
-
elif in_invoke_action and f"<{tp}parameter" in line:
|
|
426
|
-
if current_param_name:
|
|
427
|
-
param_value = "\n".join(current_param_value)
|
|
428
|
-
current_action["parameters"][current_param_name] = (
|
|
429
|
-
clean_parameter_value(param_value)
|
|
430
|
-
)
|
|
431
|
-
current_param_value = []
|
|
432
|
-
|
|
433
|
-
param_name_match = re.search(r'name\s*=\s*[\'"](\w+)[\'"]', line)
|
|
434
|
-
if param_name_match:
|
|
435
|
-
current_param_name = param_name_match.group(1)
|
|
436
|
-
open_tags.append("parameter")
|
|
437
|
-
|
|
438
|
-
# Handle content on the same line as opening tag
|
|
439
|
-
content_after_open = re.search(
|
|
440
|
-
r">(.*?)(?:</" + tp + "parameter>|$)", line
|
|
441
|
-
)
|
|
442
|
-
if content_after_open:
|
|
443
|
-
initial_content = content_after_open.group(1)
|
|
444
|
-
if initial_content:
|
|
445
|
-
current_param_value.append(initial_content)
|
|
446
|
-
|
|
447
|
-
# Check if parameter closes on same line
|
|
448
|
-
if f"</{tp}parameter>" in line:
|
|
449
|
-
param_value = "\n".join(current_param_value)
|
|
450
|
-
current_action["parameters"][current_param_name] = (
|
|
451
|
-
clean_parameter_value(param_value)
|
|
452
|
-
)
|
|
453
|
-
current_param_name = None
|
|
454
|
-
current_param_value = []
|
|
455
|
-
|
|
456
|
-
if "parameter" in open_tags:
|
|
457
|
-
open_tags.remove("parameter")
|
|
458
|
-
elif line.endswith("/>"):
|
|
459
|
-
current_action["parameters"][current_param_name] = ""
|
|
460
|
-
current_param_name = None
|
|
461
|
-
if "parameter" in open_tags:
|
|
462
|
-
open_tags.remove("parameter")
|
|
463
|
-
elif not ">" in line:
|
|
464
|
-
parsed_data["errors"].append("Incomplete <parameter> tag")
|
|
465
|
-
|
|
466
|
-
elif in_invoke_action and current_param_name:
|
|
467
|
-
if f"</{tp}parameter>" in line:
|
|
468
|
-
# Handle content before closing tag on final line
|
|
469
|
-
content_before_close = re.sub(f"</{tp}parameter>.*", "", line)
|
|
470
|
-
if content_before_close:
|
|
471
|
-
current_param_value.append(content_before_close)
|
|
472
|
-
param_value = "\n".join(current_param_value)
|
|
473
|
-
current_action["parameters"][current_param_name] = (
|
|
474
|
-
clean_parameter_value(param_value)
|
|
475
|
-
)
|
|
476
|
-
current_param_name = None
|
|
477
|
-
current_param_value = []
|
|
478
|
-
if "parameter" in open_tags:
|
|
479
|
-
open_tags.remove("parameter")
|
|
480
|
-
else:
|
|
481
|
-
current_param_value.append(line)
|
|
482
|
-
|
|
483
|
-
else:
|
|
484
|
-
# NOTE that we are intentionally ignoring all output text that occurs
|
|
485
|
-
# after any <invoke_action> tag. It has been told to never do this and
|
|
486
|
-
# if it does, then there is a good chance it is hallucinating responses
|
|
487
|
-
if not seen_invoke_action:
|
|
488
|
-
current_text.append(line)
|
|
489
|
-
|
|
490
|
-
if open_tags:
|
|
491
|
-
parsed_data["errors"].append(f"Unclosed tags: {', '.join(open_tags)}")
|
|
492
|
-
|
|
493
|
-
if in_file and not seen_invoke_action:
|
|
494
|
-
content = "\n".join(file_content)
|
|
495
|
-
# Add a status update for this
|
|
496
|
-
parsed_data["status_updates"].append(
|
|
497
|
-
f"File {current_file['name']} loading ({len(content)} characters)..."
|
|
498
|
-
)
|
|
499
|
-
parsed_data["send_last_status_update"] = True
|
|
500
|
-
parsed_data["errors"].append("Unclosed <file> tag")
|
|
501
|
-
|
|
502
|
-
if len(current_text) > 0:
|
|
503
|
-
add_content_entry(parsed_data["content"], "text", current_text)
|
|
504
|
-
|
|
505
|
-
# Final check - if there is no reasoning, then the LLM is not complying with the
|
|
506
|
-
# request and we should return an error
|
|
507
|
-
if check_reasoning and not parsed_data["reasoning"]:
|
|
508
|
-
parsed_data["errors"].append("No <t###_reasoning> tag found")
|
|
509
|
-
parsed_data["content"] = []
|
|
510
|
-
|
|
511
|
-
return parsed_data
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
def strip_text_after_invoke_action(text):
|
|
515
|
-
"""
|
|
516
|
-
Remove any text after the last </invoke_action> tag.
|
|
517
|
-
This is to prevent hallucinations from the LLM.
|
|
518
|
-
"""
|
|
519
|
-
# Find the last instance of </t\d+_invoke_action> regexp and remove everything after it.
|
|
520
|
-
matches = list(re.finditer(r"</t\d+_invoke_action>", text))
|
|
521
|
-
if matches:
|
|
522
|
-
last_match_end = matches[-1].end()
|
|
523
|
-
return text[:last_match_end]
|
|
524
|
-
return text
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
def remove_incomplete_tags_at_end(text):
|
|
528
|
-
"""If the end of the text is in the middle of a <tag> or </tag> then remove it."""
|
|
529
|
-
# remove any open tags at the end
|
|
530
|
-
last_open_tag = text.rfind("<")
|
|
531
|
-
last_open_end_tag = text.rfind("</")
|
|
532
|
-
last_close_tag = text.rfind(">")
|
|
533
|
-
if last_close_tag >= last_open_tag and last_close_tag >= last_open_end_tag:
|
|
534
|
-
return text
|
|
535
|
-
# Knock off the last line
|
|
536
|
-
return text.rsplit("\n", 1)[0]
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
def add_content_entry(content_list, entry_type, body, add_newline=False):
|
|
540
|
-
if body:
|
|
541
|
-
if entry_type == "text":
|
|
542
|
-
body = clean_text(body)
|
|
543
|
-
if add_newline:
|
|
544
|
-
body += "\n"
|
|
545
|
-
content_list.append({"type": entry_type, "body": body})
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
def match_solace_topic_level(pattern: str, topic_level: str) -> bool:
|
|
549
|
-
"""Match a single topic level with potential * wildcard prefix matching"""
|
|
550
|
-
if pattern == "*":
|
|
551
|
-
return True
|
|
552
|
-
if pattern.endswith("*"):
|
|
553
|
-
return topic_level.startswith(pattern[:-1])
|
|
554
|
-
return pattern == topic_level
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
def match_solace_topic(subscription: str, topic: str) -> bool:
|
|
558
|
-
"""
|
|
559
|
-
Match a Solace topic against a subscription pattern.
|
|
560
|
-
Handles * for prefix matching within a level and > for matching one or more levels.
|
|
561
|
-
Case sensitive matching.
|
|
562
|
-
|
|
563
|
-
Examples:
|
|
564
|
-
match_solace_topic("a/b*/c", "a/bob/c") -> True
|
|
565
|
-
match_solace_topic("a/*/c", "a/b/c") -> True
|
|
566
|
-
match_solace_topic("a/>", "a/b") -> True
|
|
567
|
-
match_solace_topic("a/>", "a/b/c") -> True
|
|
568
|
-
match_solace_topic("a/>", "a") -> False
|
|
569
|
-
"""
|
|
570
|
-
if not subscription or not topic:
|
|
571
|
-
return False
|
|
572
|
-
|
|
573
|
-
sub_levels = subscription.split("/")
|
|
574
|
-
topic_levels = topic.split("/")
|
|
575
|
-
|
|
576
|
-
# Handle > wildcard
|
|
577
|
-
if sub_levels[-1] == ">":
|
|
578
|
-
# > must match at least one level
|
|
579
|
-
if len(topic_levels) <= len(sub_levels) - 1:
|
|
580
|
-
return False
|
|
581
|
-
# Match all levels before the >
|
|
582
|
-
return all(
|
|
583
|
-
match_solace_topic_level(sub_levels[i], topic_levels[i])
|
|
584
|
-
for i in range(len(sub_levels) - 1)
|
|
585
|
-
)
|
|
586
|
-
|
|
587
|
-
# Without >, levels must match exactly
|
|
588
|
-
if len(sub_levels) != len(topic_levels):
|
|
589
|
-
return False
|
|
590
|
-
|
|
591
|
-
# Match each level
|
|
592
|
-
return all(
|
|
593
|
-
match_solace_topic_level(sub_levels[i], topic_levels[i])
|
|
594
|
-
for i in range(len(sub_levels))
|
|
595
|
-
)
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
def clean_parameter_value(param_value):
|
|
599
|
-
"""
|
|
600
|
-
Cleans a parameter value by:
|
|
601
|
-
1. Removing CDATA wrapper if present
|
|
602
|
-
2. Resolving XML entities like >, <, etc.
|
|
603
|
-
|
|
604
|
-
Parameters:
|
|
605
|
-
- param_value (str): The parameter value that might contain a CDATA wrapper
|
|
606
|
-
and/or XML entities
|
|
607
|
-
|
|
608
|
-
Returns:
|
|
609
|
-
- str: The cleaned parameter value
|
|
610
|
-
"""
|
|
611
|
-
if isinstance(param_value, str):
|
|
612
|
-
# Remove CDATA wrapper if present
|
|
613
|
-
cdata_match = re.match(r"\s*<!\[CDATA\[(.*?)\]\]>\s*$", param_value, re.DOTALL)
|
|
614
|
-
if cdata_match:
|
|
615
|
-
param_value = cdata_match.group(1)
|
|
616
|
-
|
|
617
|
-
# Resolve XML entities
|
|
618
|
-
param_value = param_value.replace("<", "<")
|
|
619
|
-
param_value = param_value.replace(">", ">")
|
|
620
|
-
param_value = param_value.replace("&", "&")
|
|
621
|
-
param_value = param_value.replace(""", '"')
|
|
622
|
-
param_value = param_value.replace("'", "'")
|
|
623
|
-
|
|
624
|
-
return param_value
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
def clean_text(text_array):
|
|
628
|
-
# Any leading blank lines are removed
|
|
629
|
-
while text_array and not text_array[0]:
|
|
630
|
-
text_array.pop(0)
|
|
631
|
-
|
|
632
|
-
# Look for multiple blank lines in a row and collapse them into a single blank line
|
|
633
|
-
i = 0
|
|
634
|
-
while i < len(text_array) - 1:
|
|
635
|
-
if not text_array[i] and not text_array[i + 1]:
|
|
636
|
-
text_array.pop(i)
|
|
637
|
-
else:
|
|
638
|
-
i += 1
|
|
639
|
-
|
|
640
|
-
return "\n".join(text_array)
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
def files_to_block_text(files):
|
|
644
|
-
blocks = []
|
|
645
|
-
text = ""
|
|
646
|
-
if files:
|
|
647
|
-
for file in files:
|
|
648
|
-
try:
|
|
649
|
-
block = FileService.get_file_block_by_metadata(file)
|
|
650
|
-
blocks.append(block)
|
|
651
|
-
except Exception as e:
|
|
652
|
-
log.warning("Could not get file block: %s", e)
|
|
653
|
-
if blocks:
|
|
654
|
-
text += (
|
|
655
|
-
"\n\nAttached files:\n\n" if len(blocks) > 1 else "\n\nAttached file:\n\n"
|
|
656
|
-
)
|
|
657
|
-
text += "\n\n".join(blocks)
|
|
658
|
-
return text
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
def remove_config_parameter(info, parameter_name):
|
|
662
|
-
"""
|
|
663
|
-
Remove a parameter from the config of a component.
|
|
664
|
-
"""
|
|
665
|
-
if "config_parameters" in info:
|
|
666
|
-
index = info["config_parameters"].index(
|
|
667
|
-
next(
|
|
668
|
-
(
|
|
669
|
-
item
|
|
670
|
-
for item in info["config_parameters"]
|
|
671
|
-
if item.get("name") == parameter_name
|
|
672
|
-
),
|
|
673
|
-
None,
|
|
674
|
-
)
|
|
675
|
-
)
|
|
676
|
-
|
|
677
|
-
# Remove the parameter from the list
|
|
678
|
-
if index is not None:
|
|
679
|
-
info["config_parameters"].pop(index)
|
|
680
|
-
|
|
681
|
-
return info
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
def format_agent_response(actions):
|
|
685
|
-
"""Format the action response for the AI"""
|
|
686
|
-
ai_response = (
|
|
687
|
-
"Results for the requested actions. NOTE: these are generated internally in the "
|
|
688
|
-
"system. A user was not involved, so there is no need to respond to them or thank them.\n"
|
|
689
|
-
)
|
|
690
|
-
found_ai_response = False
|
|
691
|
-
files = []
|
|
692
|
-
for action in actions:
|
|
693
|
-
found_ai_response = True
|
|
694
|
-
ai_response += f"\n {action.get('action_idx')}: {action.get('agent_name')}.{action.get('action_name')}:\n"
|
|
695
|
-
params = action.get("action_params", {})
|
|
696
|
-
response_files = action.get("response", {}).get("files", [])
|
|
697
|
-
for param, value in params.items():
|
|
698
|
-
if isinstance(value, str):
|
|
699
|
-
ai_response += f" {param}: {value[:100]}\n"
|
|
700
|
-
else:
|
|
701
|
-
ai_response += f" {param}: {value}\n"
|
|
702
|
-
ai_response += " Response:\n"
|
|
703
|
-
ai_response += f" <<<{action.get('response', {'text':'<No response>'}).get('text')}>>>\n"
|
|
704
|
-
if response_files:
|
|
705
|
-
ai_response += " Files:\n"
|
|
706
|
-
for file in response_files:
|
|
707
|
-
ai_response += f" {file.get('url')}\n"
|
|
708
|
-
files.extend(action.get("response", {}).get("files", []))
|
|
709
|
-
|
|
710
|
-
if not found_ai_response:
|
|
711
|
-
return None
|
|
712
|
-
return ai_response, files
|