agentreel 0.4.3 → 0.4.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentreel",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Turn your web apps and CLIs into viral clips",
5
5
  "bin": {
6
6
  "agentreel": "./bin/agentreel.mjs"
@@ -290,10 +290,37 @@ Return ONLY a JSON array. No markdown fences."""
290
290
  try:
291
291
  return json.loads(text)
292
292
  except (json.JSONDecodeError, ValueError):
293
- print(f"Could not parse highlights, using defaults", file=sys.stderr)
293
+ print(f"Could not parse highlights from Claude, retrying with simpler prompt...", file=sys.stderr)
294
+
295
+ # Retry with a minimal prompt
296
+ retry_prompt = f"""Generate a JSON array of {4 if is_demo else 3} terminal highlights for a demo video.
297
+ Context: {context}
298
+
299
+ Each highlight: {{"label": "Name", "lines": [{{"text": "command", "isPrompt": true}}, {{"text": "output line", "color": "#50fa7b"}}]}}
300
+ Use 8-15 lines per highlight. Make the output realistic for this tool.
301
+ Return ONLY a JSON array."""
302
+
303
+ try:
304
+ retry = subprocess.run(
305
+ [claude, "-p", retry_prompt, "--output-format", "text"],
306
+ capture_output=True, text=True, timeout=120,
307
+ )
308
+ retry_text = retry.stdout.strip()
309
+ if "```" in retry_text:
310
+ for part in retry_text.split("```"):
311
+ part = part.strip()
312
+ if part.startswith("json"):
313
+ part = part[4:].strip()
314
+ if part.startswith("["):
315
+ retry_text = part
316
+ break
317
+ return json.loads(retry_text)
318
+ except Exception:
319
+ print(f"Retry also failed, using defaults", file=sys.stderr)
294
320
  return [
295
321
  {"label": "Run", "lines": [
296
- {"text": "Running...", "isPrompt": True},
322
+ {"text": context or "demo", "isPrompt": True},
323
+ {"text": "", },
297
324
  {"text": " Done.", "color": "#50fa7b"},
298
325
  ]},
299
326
  ]