@danhachuel/thunderbolt 0.5.20 → 0.5.22

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.
@@ -27,10 +27,10 @@ def _payload(result: Mapping[str, Any]) -> Any:
27
27
 
28
28
  def _items(value: Any) -> list[dict[str, Any]]:
29
29
  if isinstance(value, Mapping):
30
- for key in ("items", "designs", "results", "candidates"):
30
+ for key in ("items", "designs", "results", "candidates", "generated_designs"):
31
31
  if isinstance(value.get(key), list):
32
32
  return [dict(item) for item in value[key] if isinstance(item, Mapping)]
33
- for key in ("data", "result", "response"):
33
+ for key in ("data", "result", "response", "job"):
34
34
  if isinstance(value.get(key), (Mapping, list)):
35
35
  nested = _items(value[key])
36
36
  if nested:
@@ -57,6 +57,17 @@ def _first_named_id(value: Any, keys: tuple[str, ...]) -> str:
57
57
  return ""
58
58
 
59
59
 
60
+ def _generation_job_id(value: Any) -> str:
61
+ if isinstance(value, Mapping):
62
+ job = value.get("job")
63
+ if isinstance(job, Mapping):
64
+ candidate = str(job.get("id") or "").strip()
65
+ if candidate:
66
+ return candidate
67
+ return _first_named_id(value, ("job_id", "jobId"))
68
+ return ""
69
+
70
+
60
71
  def _design_id(value: Any) -> str:
61
72
  """Extract a Canva design identifier from REST/MCP result variants."""
62
73
  if isinstance(value, Mapping):
@@ -64,7 +75,7 @@ def _design_id(value: Any) -> str:
64
75
  candidate = str(value.get(key) or "").strip()
65
76
  if candidate:
66
77
  return candidate
67
- for key in ("design", "resource", "data"):
78
+ for key in ("design", "design_summary", "resource", "data"):
68
79
  if isinstance(value.get(key), Mapping):
69
80
  found = _design_id(value[key])
70
81
  if found:
@@ -202,7 +213,7 @@ def run_direct_canva_thumbnail(
202
213
  ),
203
214
  "user_intent": "Create an editable YouTube thumbnail with text boxes and visual elements when searched designs are not editable.",
204
215
  }))
205
- job_id = _first_named_id(generated, ("job_id", "jobId"))
216
+ job_id = _generation_job_id(generated)
206
217
  generated_candidates = _items(generated)
207
218
  candidate_id = _first_named_id(generated_candidates[0] if generated_candidates else {}, ("candidate_id", "candidateId"))
208
219
  if not job_id or not candidate_id:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.20",
3
+ "version": "0.5.22",
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",