solace-agent-mesh 0.2.1__py3-none-any.whl → 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solace-agent-mesh might be problematic. Click here for more details.
- solace_agent_mesh/agents/global/actions/plantuml_diagram.py +94 -36
- solace_agent_mesh/assets/web-visualizer/assets/{index-C5awueeJ.js → index-DnDr1pnu.js} +33 -33
- solace_agent_mesh/assets/web-visualizer/index.html +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/add/agent.py +1 -1
- solace_agent_mesh/cli/commands/add/copy_from_plugin.py +1 -1
- solace_agent_mesh/cli/commands/add/gateway.py +2 -2
- solace_agent_mesh/cli/commands/init/check_if_already_done.py +1 -1
- solace_agent_mesh/cli/commands/init/init.py +17 -48
- solace_agent_mesh/cli/commands/init/web_init_step.py +32 -0
- solace_agent_mesh/cli/commands/plugin/create.py +3 -3
- solace_agent_mesh/cli/main.py +6 -0
- solace_agent_mesh/config_portal/frontend/static/client/Solace_community_logo.png +0 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/_index-DMmCawWe.js +42 -0
- solace_agent_mesh/config_portal/frontend/static/client/assets/{manifest-8147e469.js → manifest-dd988f05.js} +1 -1
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-DX4gQ516.css +1 -0
- solace_agent_mesh/config_portal/frontend/static/client/index.html +2 -2
- solace_agent_mesh/orchestrator/components/orchestrator_stimulus_processor_component.py +18 -1
- solace_agent_mesh/services/history_service/history_providers/sql_history_provider.py +1 -1
- solace_agent_mesh/services/llm_service/components/llm_request_component.py +54 -31
- solace_agent_mesh/templates/rest-api-default-config.yaml +4 -2
- solace_agent_mesh/templates/web-default-config.yaml +4 -2
- {solace_agent_mesh-0.2.1.dist-info → solace_agent_mesh-0.2.3.dist-info}/METADATA +2 -2
- {solace_agent_mesh-0.2.1.dist-info → solace_agent_mesh-0.2.3.dist-info}/RECORD +28 -26
- solace_agent_mesh/config_portal/frontend/static/client/assets/_index-DRPGOzHj.js +0 -42
- solace_agent_mesh/config_portal/frontend/static/client/assets/root-hhS5izs8.css +0 -1
- /solace_agent_mesh/config_portal/frontend/static/client/assets/{root-DgMDqKDc.js → root-BApq5dPK.js} +0 -0
- {solace_agent_mesh-0.2.1.dist-info → solace_agent_mesh-0.2.3.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-0.2.1.dist-info → solace_agent_mesh-0.2.3.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-0.2.1.dist-info → solace_agent_mesh-0.2.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import platform
|
|
4
4
|
import os
|
|
5
5
|
import tempfile
|
|
6
|
+
import uuid
|
|
7
|
+
import shutil
|
|
6
8
|
import subprocess
|
|
7
9
|
|
|
8
10
|
from solace_ai_connector.common.log import log
|
|
@@ -11,11 +13,51 @@ from ....common.action_response import ActionResponse
|
|
|
11
13
|
from ....services.file_service import FileService
|
|
12
14
|
|
|
13
15
|
PLANTUML_PROMPT = """Generate a PlantUML markup language for the given description by the user. Supports sequence diagrams, class diagrams, use case diagrams, activity diagrams, component diagrams, state diagrams, and timing diagrams. Newlines must be escaped with a backslash and put quotes around participants names. Respond only with PlantUML markup, do not include any other text, symbols or quotes.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
|
|
17
|
+
Rules to follow for all diagrams:
|
|
18
|
+
- Always include @startuml at the beginning and @enduml at the end
|
|
19
|
+
- Use simple quotes for names, not double quotes
|
|
20
|
+
- Avoid using <<stereotype>> syntax in state diagrams unless absolutely necessary
|
|
21
|
+
- For state diagrams, use simple state names without spaces (like LoginScreen instead of "Login Screen")
|
|
22
|
+
- If you need descriptive names, use the 'as' keyword (e.g., [*] --> LoginScreen as "Login Screen")
|
|
23
|
+
- Don't use variables if they are not declared
|
|
24
|
+
- Never skip lines
|
|
25
|
+
- For notes in all diagrams:
|
|
26
|
+
- Use the simple syntax: `note over Participant: Text` without any positioning numbers
|
|
27
|
+
- Do not use positioning numbers (like `at 25`) in note commands
|
|
28
|
+
- Never combine multiple participants in a single note
|
|
29
|
+
|
|
30
|
+
Rules for sequence diagrams:
|
|
31
|
+
- Only use notes to cover one or two participants per line
|
|
32
|
+
- Do not use the `activate` or `deactivate` commands directly after a delay notation (`...`), whether directly or with a note in between
|
|
33
|
+
- Do not use the `activate` or `deactivate` commands twice in a row, whether directly or with a note in between
|
|
34
|
+
|
|
35
|
+
Rules for activity diagrams:
|
|
36
|
+
- Do not use the `backward:` keyword for loops or returning to previous steps
|
|
37
|
+
- Instead, use the label and goto pattern:
|
|
38
|
+
1. Add a label to the target activity: `label label_name`
|
|
39
|
+
2. Use goto to reference that label: `goto label_name`
|
|
40
|
+
- Always place labels immediately after the activity they refer to
|
|
41
|
+
- Labels should use lowercase with underscores for readability (e.g., `label browse_products`)
|
|
42
|
+
|
|
43
|
+
Rules for state diagrams:
|
|
44
|
+
- Use simple state names without spaces and without quotes
|
|
45
|
+
- When stereotypes are absolutely necessary, use the correct syntax:
|
|
46
|
+
- For existing states: `state StateName <<stereotype>>`
|
|
47
|
+
- For new states with descriptions: `state "Description" as StateName <<stereotype>>`
|
|
48
|
+
- Always place stereotypes after the state name, not before
|
|
49
|
+
- If using skinparam for stereotype styling, ensure it's properly defined: `skinparam state \{ BackgroundColor<<stereotype>> Color\}
|
|
50
|
+
- For notes in state diagrams:
|
|
51
|
+
- Do NOT use `note over StateName` syntax (this is for sequence diagrams)
|
|
52
|
+
- Instead use directional positioning: `note left of StateName`, `note right of StateName`, `note top of StateName`, or `note bottom of StateName`
|
|
53
|
+
- Example: `note left of OrderCreated : Initial customer order`
|
|
54
|
+
|
|
55
|
+
Rules for timing diagrams:
|
|
56
|
+
- Never include notes
|
|
57
|
+
- For 'robust' participants, use named states instead of symbolic states
|
|
58
|
+
- CORRECT: `PS is "ON"` or `PS is ON`
|
|
59
|
+
- INCORRECT: `PS is {+}` or `PS is {-}`
|
|
60
|
+
- For 'concise' participants, use numeric values (e.g., `BP is 10`)
|
|
19
61
|
"""
|
|
20
62
|
|
|
21
63
|
|
|
@@ -42,10 +84,6 @@ class PlantUmlDiagram(Action):
|
|
|
42
84
|
)
|
|
43
85
|
|
|
44
86
|
def invoke(self, params, meta={}) -> ActionResponse:
|
|
45
|
-
if platform.system() == "Windows":
|
|
46
|
-
return ActionResponse(
|
|
47
|
-
message=f"Unfortunately, the PlantUML is not available on {platform.system()}"
|
|
48
|
-
)
|
|
49
87
|
# Do a local command to run plantuml -tpng
|
|
50
88
|
description = params.get("diagram_description")
|
|
51
89
|
agent = self.get_agent()
|
|
@@ -70,34 +108,54 @@ class PlantUmlDiagram(Action):
|
|
|
70
108
|
if not expression.endswith("@enduml"):
|
|
71
109
|
expression = f"{expression}\n@enduml"
|
|
72
110
|
log.debug("PlantUML expression: %s", expression)
|
|
73
|
-
img_path = None
|
|
74
111
|
files = []
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
|
|
113
|
+
try:
|
|
114
|
+
temp_dir = tempfile.mkdtemp()
|
|
115
|
+
# Create a unique filename with .puml extension
|
|
116
|
+
diagram_id = str(uuid.uuid4())
|
|
117
|
+
puml_filename = f"diagram_{diagram_id}.puml"
|
|
118
|
+
puml_path = os.path.join(temp_dir, puml_filename)
|
|
119
|
+
png_path = os.path.join(temp_dir, f"diagram_{diagram_id}.png")
|
|
120
|
+
|
|
121
|
+
# Write PlantUML content to input file
|
|
122
|
+
with open(puml_path, 'w', encoding='utf-8') as f:
|
|
123
|
+
f.write(expression)
|
|
124
|
+
|
|
125
|
+
# Run PlantUML
|
|
126
|
+
subprocess.run(
|
|
127
|
+
["plantuml", "-tpng", puml_path, "-o", temp_dir],
|
|
128
|
+
shell=platform.system() == "Windows",
|
|
129
|
+
check=True,
|
|
130
|
+
capture_output=True,
|
|
131
|
+
text=True,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Upload the generated image
|
|
135
|
+
file_service = FileService()
|
|
136
|
+
file_meta = file_service.upload_from_file(
|
|
137
|
+
png_path,
|
|
138
|
+
meta.get("session_id"),
|
|
139
|
+
data_source="Global Agent - PlantUML Action",
|
|
140
|
+
)
|
|
141
|
+
files.append(file_meta)
|
|
142
|
+
|
|
143
|
+
except FileNotFoundError as e:
|
|
144
|
+
log.error("PlantUML executable not found: %s", str(e))
|
|
145
|
+
return ActionResponse(
|
|
146
|
+
message="PlantUML executable not found. Please ensure PlantUML is installed and available in PATH.",
|
|
147
|
+
)
|
|
148
|
+
except subprocess.CalledProcessError as e:
|
|
149
|
+
log.error("Subprocess failed with stderr: %s", str(e))
|
|
150
|
+
return ActionResponse(
|
|
151
|
+
message=f"Failed to create diagram: {str(e)}",
|
|
152
|
+
)
|
|
153
|
+
finally:
|
|
154
|
+
if 'temp_dir' in locals() and os.path.exists(temp_dir):
|
|
155
|
+
try:
|
|
156
|
+
shutil.rmtree(temp_dir) # Remove directory and all contents
|
|
157
|
+
except:
|
|
158
|
+
pass
|
|
101
159
|
|
|
102
160
|
return ActionResponse(
|
|
103
161
|
message=f"diagram created with the plantUML: \n```\n{expression}\n```",
|