# Changelog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.3.0] - 2025-03-18 ### Added - **OpenRouter Integration** — 4th AI provider with API key auth, 20+ model support - New `lib/services/openrouter.ts` streaming service - Provider selector in AI Assist: Qwen, Ollama, Z.AI, OpenRouter - Default model: `google/gemini-2.0-flash-exp:free` - Custom model selector with popular free/paid model presets - Settings panel: API key input with validation and model picker - **Plan-First Workflow** — AI now generates a structured plan before code - PLAN MODE instructions injected into all 4 service system prompts - Plan card UI with architecture, tech stack, files, and steps - `parsePlanFromResponse()` extracts plans from AI markdown output - `[PLAN]` tags hidden from displayed chat messages - Three action buttons: **Modify Plan** / **Start Coding** / **Skip to Code** - **Post-Coding UX** — Preview + Request Modifications after code generation - After "Start Coding" approval, AI generates code with `[PREVIEW]` tags - Canvas opens automatically with renderable previews - Two post-coding buttons: **Preview** (re-opens canvas) and **Request Modifications** - `isApproval` flag prevents stale React closure bugs in approval flow - **Enhanced Prompt Engine** — New modular prompt enhancement system - `lib/enhance-engine.ts` with 9 enhancement strategies - Strategies: clarify, add-context, add-constraints, structure, add-examples, set-tone, expand, simplify, chain-of-thought - Context-aware enhancement based on detected intent type - 11+ intent detection patterns (coding, creative, analysis, etc.) - Smart strategy selection per intent for optimal prompt refinement - **Streaming Plan Mode** — Real-time plan parsing during AI response - `wasIdle` flag captures initial request phase before state updates - Canvas display suppressed during plan generation, enabled after approval - Post-stream routing: plan card for initial requests, preview for approvals - Tab `showCanvas` state gated by plan phase ### Changed - **AIAssist.tsx** — Major refactor for plan-first flow - `handleSendMessage` now accepts `isApproval` parameter to prevent stale closures - `approveAndGenerate()` passes `isApproval=true` to bypass idle detection - `assistStep` state machine: `idle -> plan -> generating -> preview` - `parseStreamingContent()` filters `[PLAN]` tags from displayed output - **PromptEnhancer.tsx** — Rebuilt with modular enhance engine - Moved enhancement logic to `lib/enhance-engine.ts` - Added expand, simplify, and chain-of-thought strategies - Improved intent detection and strategy mapping - **SettingsPanel.tsx** — Added OpenRouter provider configuration - API key input with validation - Model selector with preset dropdown - Provider-specific endpoint display - **model-adapter.ts** — Extended with OpenRouter provider support - New adapter mapping for OpenRouter service - Unified interface across all 4 providers - **translations.ts** — Added i18n keys for plan mode, OpenRouter, post-coding actions - Keys: `modifyPlan`, `startCoding`, `skipToCode`, `requestModifications` - OpenRouter provider labels and descriptions - English, Russian, Hebrew translations updated - **store.ts** — Added `selectedProvider` state for multi-provider selection - **types/index.ts** — Added `PreviewData` interface for typed canvas rendering - **adapter-instance.ts** — Registered OpenRouter in provider registry ### Fixed - **Stale React closure** in `approveAndGenerate` — `setAssistStep("generating")` followed by `handleSendMessage()` read stale `assistStep` value. Fixed with explicit `isApproval` boolean parameter. - **Plan card reappearing after code generation** — Post-stream logic now correctly routes to `preview` mode after approval coding, not back to `plan` mode. - **Canvas auto-opening during plan phase** — `setShowCanvas(true)` in `onChunk` now gated by `!wasIdle` flag. - **i18n missing keys** — Added `syncComplete` for Hebrew, fixed double commas in multiple translation strings. ### Technical Details - Files modified: 11 (960 insertions, 194 deletions) - Files added: 2 (`lib/enhance-engine.ts`, `lib/services/openrouter.ts`) - Total project lines: ~10,179 across core files - System prompt PLAN MODE block added to: `qwen-oauth.ts`, `ollama-cloud.ts`, `zai-plan.ts`, `openrouter.ts` ## [1.2.0] - 2025-01-19 ### Added - **SEO Agent Behavior Fixes** - SEO agent now stays locked and answers queries through an SEO lens - Smart agent suggestions via `[SUGGEST_AGENT:xxx]` marker for clearly non-SEO tasks - Visual suggestion banner with Switch/Dismiss buttons - Prevented unwanted agent auto-switching mid-response - **z.ai API Validation** - Real-time API key validation with 500ms debounce - Inline status indicators: - Checkmark with "Validated Xm ago" for valid keys - Red X with error message for invalid keys - Loading spinner during validation - "Test Connection" button for manual re-validation - Persistent validation cache (5 minutes) in localStorage ### Changed - Updated Settings panel with improved UX for API key management - Enhanced agent selection behavior to prevent unintended switches ## [1.1.0] - 2025-01-15 ### Added - GitHub integration for pushing AI-generated artifacts - XLSX export functionality for Google Ads campaigns - High-fidelity HTML report generation - OAuth token management for Qwen API ## [1.0.0] - 2025-01-01 ### Added - Initial release of PromptArch - Multi-provider AI support (Qwen, Ollama, Z.AI) - Prompt Enhancer with 11+ intent patterns - PRD Generator with structured output - Action Plan generator with framework recommendations - Visual canvas for live code rendering - Multi-language support (English, Russian, Hebrew)