The "Unterminated string" JSON parse error is likely caused by Gemini
output truncation at 1024 tokens. Increases scaffold max_tokens to 2048
and adds logging for: raw response text, finish_reason (truncation
detection), and JSON parse failures.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The google-genai SDK uses `client.aio.models.generate_content()` for
async calls, not `client.models.generate_content_async()` which doesn't
exist. Also removes the temporary /ai/provider-debug endpoint.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shows which provider is selected and whether keys are loaded.
Remove after debugging the 502 on PR env.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The generic "AI provider error" message made debugging impossible.
Now logs the full exception traceback and includes the error class
name in the 502 response detail.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- New ai-fix.ts types for request/response
- fixTree() method on treesApi
- "Fix with AI" button in ValidationSummary (shows for fixable errors)
- AIFixReviewModal with per-fix apply/skip and apply-all
- TreeEditorPage orchestrates the fix flow
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds AI_PROVIDER, GOOGLE_AI_API_KEY, AI_MODEL_GEMINI, and
AI_MODEL_ANTHROPIC config vars. Updates ai_enabled to check
either provider key.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Design for two combined features: Gemini 2.5 Flash as primary AI
provider with Claude fallback, and AI-powered auto-fix for validation
errors in the tree editor.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>