@danhachuel/thunderbolt 0.5.21 → 0.5.23
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.
|
@@ -75,7 +75,7 @@ def _design_id(value: Any) -> str:
|
|
|
75
75
|
candidate = str(value.get(key) or "").strip()
|
|
76
76
|
if candidate:
|
|
77
77
|
return candidate
|
|
78
|
-
for key in ("design", "resource", "data"):
|
|
78
|
+
for key in ("design", "design_summary", "resource", "data"):
|
|
79
79
|
if isinstance(value.get(key), Mapping):
|
|
80
80
|
found = _design_id(value[key])
|
|
81
81
|
if found:
|
|
@@ -101,6 +101,30 @@ def _first_id(value: Any, keys: tuple[str, ...]) -> str:
|
|
|
101
101
|
return ""
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
def _download_url(value: Any) -> str:
|
|
105
|
+
if isinstance(value, Mapping):
|
|
106
|
+
for key in ("url", "download_url", "downloadUrl"):
|
|
107
|
+
candidate = str(value.get(key) or "").strip()
|
|
108
|
+
if candidate.startswith(("http://", "https://")):
|
|
109
|
+
return candidate
|
|
110
|
+
urls = value.get("urls")
|
|
111
|
+
if isinstance(urls, list):
|
|
112
|
+
for url in urls:
|
|
113
|
+
candidate = str(url or "").strip()
|
|
114
|
+
if candidate.startswith(("http://", "https://")):
|
|
115
|
+
return candidate
|
|
116
|
+
for child in value.values():
|
|
117
|
+
found = _download_url(child)
|
|
118
|
+
if found:
|
|
119
|
+
return found
|
|
120
|
+
elif isinstance(value, list):
|
|
121
|
+
for child in value:
|
|
122
|
+
found = _download_url(child)
|
|
123
|
+
if found:
|
|
124
|
+
return found
|
|
125
|
+
return ""
|
|
126
|
+
|
|
127
|
+
|
|
104
128
|
def _first_text_element(value: Any, *, text_context: bool = False) -> str:
|
|
105
129
|
if isinstance(value, Mapping):
|
|
106
130
|
# The MCP returns rich text elements with slightly different ID
|
|
@@ -286,7 +310,7 @@ def run_direct_canva_thumbnail(
|
|
|
286
310
|
},
|
|
287
311
|
"user_intent": "Export the finished Thunderbolt thumbnail as PNG.",
|
|
288
312
|
}))
|
|
289
|
-
url =
|
|
313
|
+
url = _download_url(exported)
|
|
290
314
|
if not url:
|
|
291
315
|
raise CanvaMCPError("Canva não devolveu URL de download do PNG.")
|
|
292
316
|
response = requests.get(url, timeout=90)
|
package/package.json
CHANGED