@danhachuel/thunderbolt 0.5.22 → 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.
@@ -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 = _first_id(exported, ("url", "download_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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.22",
3
+ "version": "0.5.23",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",