pyegeria 5.4.7.6__py3-none-any.whl → 5.4.7.8__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 pyegeria might be problematic. Click here for more details.

@@ -151,7 +151,22 @@ async def _async_run_report(
151
151
  raise TypeError(
152
152
  f"Resolved function '{method_name}' not found in client class '{client_class.__name__}' is not callable."
153
153
  )
154
- token = await egeria_client._async_create_egeria_bearer_token(user_name, user_pwd)
154
+ # Only (re)create a bearer token if one is not already set on the client.
155
+ try:
156
+ existing_token = None
157
+ if hasattr(egeria_client, "get_token"):
158
+ existing_token = egeria_client.get_token()
159
+ if not existing_token:
160
+ print("DEBUG: No existing bearer token; attempting async creation...", file=sys.stderr)
161
+ if user_name and user_pwd:
162
+ await egeria_client._async_create_egeria_bearer_token(user_name, user_pwd)
163
+ else:
164
+ print("DEBUG: Missing credentials; skipping token creation and relying on pre-initialized token.", file=sys.stderr)
165
+ else:
166
+ print("DEBUG: Using existing bearer token.", file=sys.stderr)
167
+ except Exception as auth_err:
168
+ # Do not fail the entire call if token refresh fails; downstream call may still work
169
+ print(f"DEBUG: Token creation/lookup issue: {auth_err}", file=sys.stderr)
155
170
  result = await func(**call_params)
156
171
 
157
172
  if not result or result == NO_ELEMENTS_FOUND:
pyegeria/mcp_server.py CHANGED
@@ -141,11 +141,7 @@ def main() -> None:
141
141
  params=params),
142
142
  timeout=30 # Adjust timeout as needed
143
143
  )
144
- # result = await _async_run_report_tool(
145
- # report=report_name,
146
- # egeria_client=egeria_client,
147
- # params=params
148
- # )
144
+
149
145
  print("DEBUG: run_report completed successfully", file=sys.stderr)
150
146
  return _ok(result)
151
147
  except Exception as e:
@@ -46,7 +46,7 @@ def load_mermaid():
46
46
  <script>
47
47
  document.addEventListener('DOMContentLoaded', function() {
48
48
  mermaid.initialize({startOnLoad: true},
49
- {maxTextSize: 300000});
49
+ {maxTextSize: 300000}, {securityLevel: 'loose'});
50
50
  });
51
51
  </script>
52
52
 
@@ -18,12 +18,14 @@ This function and related data structures have been moved back to _output_format
18
18
  Please import select_output_format_set from pyegeria._output_formats instead of from this module.
19
19
  """
20
20
 
21
- Console = Console(width=settings.Environment.console_width)
21
+ console = Console(width=settings.Environment.console_width)
22
22
 
23
23
 
24
24
  def _extract_referenceable_properties(element: dict[str, Any]) -> dict[str, Any]:
25
25
  # Get general header attributes
26
- guid = element['elementHeader'].get("guid", None)
26
+ guid = element.get('elementHeader', {}).get("guid", None)
27
+ if guid is None:
28
+ return {}
27
29
  metadata_collection_id = element['elementHeader']['origin'].get("homeMetadataCollectionId", None)
28
30
  metadata_collection_name = element['elementHeader']['origin'].get("homeMetadataCollectionName", None)
29
31
  origin_category = element['elementHeader'].get("origin_category", None)
@@ -197,13 +199,13 @@ def make_md_attribute(attribute_name: str, attribute_value: str, output_type: st
197
199
  attribute_title = ""
198
200
 
199
201
  if output_type in ["FORM", "MD"]:
200
- if attribute_name.lower() in [ "mermaid", "links", "implemented by", "sub_components"]:
202
+ if attribute_name.lower() in [ "mermaid", "solutionBlueprintMermaidGraph", "links", "implemented by", "sub_components"]:
201
203
  return '\n'
202
204
 
203
205
  output = f"## {attribute_title}\n{attribute_value}\n\n"
204
206
  elif output_type in ["REPORT", "MERMAID"]:
205
- if attribute_title in ['Mermaid Graph', 'Mermaid']:
206
- output = f"## Mermaid Graph\n\n```mermaid\n{attribute_value}\n```\n"
207
+ if attribute_title in ['Mermaid Graph', 'Mermaid', 'Solution Blueprint Mermaid Graph']:
208
+ output = f"## {attribute_title}\n\n```mermaid\n{attribute_value}\n```\n"
207
209
  elif attribute_value:
208
210
  output = f"## {attribute_title}\n{attribute_value}\n\n"
209
211
  return output
@@ -863,7 +865,7 @@ def extract_mermaid_only(elements: Union[Dict, List[Dict]]) -> Union[str, List[s
863
865
  result = []
864
866
  for element in elements:
865
867
  mer = element.get('mermaidGraph', "---")
866
- mer_out = f"\n\n```mermaid\n{mer}\n\n```" if mer else "---"
868
+ mer_out = f"\n\n```mermaid\n{mer}\n```" if mer else "---"
867
869
  result.append(mer_out)
868
870
  return result
869
871