From ef85100501f0dd3fd288083db80cd92aa5849a30 Mon Sep 17 00:00:00 2001 From: peptiderepo Date: Tue, 21 Apr 2026 16:53:33 +0000 Subject: [PATCH] cf-removal: bump 0.9.0 -> 0.10.0 + update docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prautoblogger.php: plugin header Version + PRAUTOBLOGGER_VERSION - CHANGELOG.md: Removed/Changed/Note/Cost impact/Migration sections - ARCHITECTURE.md: - drop 4 CF provider files from the file tree - drop 2 CF credential options from the wp_options table - drop CF Workers AI row from the External API Integrations table - flip Phase 3 placeholder from CF Workers AI registry to Runware - supersede ADR #16 with a one-line history note pointing at v0.10.0 - update ADR #17 tail to mention the removal readme.txt stable tag is stale (0.2.2) and clearly not maintained inline with real releases — leaving alone in this PR; fix belongs in a dedicated release-process cleanup. --- ARCHITECTURE.md | 16 ++++-------- CHANGELOG.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++ prautoblogger.php | 4 +-- 3 files changed, 70 insertions(+), 13 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index cfcd857..51a1965 100755 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -175,17 +175,13 @@ prautoblogger/ │ │ ├── class-runware-image-pricing.php # FLUX schnell/dev cost table + resolver │ │ ├── class-runware-image-support.php # Key, response parsing, retry, dimension snap │ │ ├── class-runware-image-batch.php # True parallel curl_multi batch dispatcher -│ │ ├── class-cloudflare-image-provider.php # Cloudflare Workers AI (sequential batch fallback) -│ │ ├── class-cloudflare-image-pricing.php # Model alias + per-MP cost estimation -│ │ ├── class-cloudflare-image-validator.php # Non-destructive credential + connectivity check -│ │ ├── class-cloudflare-image-support.php # Token, account, URL, and log helpers for CF provider │ │ └── (new providers go here — see CONVENTIONS.md) │ │ │ ├── services/ │ │ ├── interface-model-registry.php # Contract for provider-specific model registries │ │ ├── class-open-router-model-registry.php # Fetches, caches, queries the OpenRouter model list │ │ ├── class-open-router-model-normalizer.php # Maps raw OpenRouter data → standardized record shape -│ │ └── (Phase 3: class-cloudflare-workers-ai-model-registry.php) +│ │ └── (Phase 3: class-runware-model-registry.php) │ │ │ ├── frontend/ │ │ ├── class-article-typography.php # Inline CSS for font, size, table borders on generated posts @@ -439,8 +435,6 @@ All prefixed with `prautoblogger_`: | `prautoblogger_log_level` | Logging threshold: error/warning/info/debug | | `prautoblogger_db_version` | Schema version for migrations | | `prautoblogger_schedule_time` | Daily generation time (HH:MM, default: '03:00') | -| `prautoblogger_cloudflare_ai_token` | Encrypted Cloudflare Workers AI API token | -| `prautoblogger_cloudflare_account_id` | Cloudflare account UUID (plaintext — identifier, not secret) | | `prautoblogger_image_model` | Image model slug from `Image_Model_Registry::get_models()`; provider is derived from this on save | | `prautoblogger_image_provider` | Derived from the chosen model on save (v0.8.0+); not editable in admin UI | | `prautoblogger_image_prompt_instructions` | System prompt given to the image rewriter LLM (v0.8.0+); falls back to `Image_Prompt_Builder::REWRITER_SYSTEM_PROMPT` when empty | @@ -482,7 +476,6 @@ Stored on every PRAutoBlogger-generated post: | Reddit RSS | Primary Reddit data source — Atom feeds for subreddit hot posts | None (unauthenticated) | No known rate limit; reliable from datacenter IPs | `providers/class-reddit-json-client.php` | | Reddit .json | Fallback for posts + only source for comments | None (unauthenticated) | ~10 req/min (datacenter IPs often blocked) | `providers/class-reddit-json-client.php` | | Google Analytics 4 | Post performance metrics | OAuth2 service account | Standard GA4 limits | `core/class-ga4-client.php`, `core/class-metrics-collector.php` | -| Cloudflare Workers AI | Image generation (FLUX.1 schnell / dev) for article hero, thumbnail, and IG placements | API token (encrypted in wp_options) + account ID | Workers AI per-account quotas | `providers/class-cloudflare-image-provider.php`, `providers/class-cloudflare-image-pricing.php`, `providers/class-cloudflare-image-validator.php` | | Runware (FLUX.1 via runware.ai) | **Default** image backend (v0.9.0+): schnell ~$0.0006/image, dev ~$0.02/image. True parallel generation via curl_multi. | API key (encrypted in wp_options) | Account-level quotas | `providers/class-runware-image-provider.php`, `providers/class-runware-image-pricing.php`, `providers/class-runware-image-support.php`, `providers/class-runware-image-batch.php` | --- @@ -540,10 +533,11 @@ The admin model picker (v1) needs to list OpenRouter models with pricing and cap ### #17: Runware as default image backend (v0.9.0, Apr 2026) -After a comic-style A/B round in Apr 2026, FLUX.1 schnell via Runware was chosen as the default image backend. Cost is ~$0.0006/image vs ~$0.039/image for Gemini 2.5 Flash Image via OpenRouter (≈65× cheaper), and the looser schnell fidelity reads as editorial-cartoon style — a feature, not a bug, for our single-panel comic aesthetic. FLUX.1 dev (~$0.02/image, 28 steps) remains available as an opt-in for higher-fidelity runs. The Runware layer mirrors the OpenRouter split (interface + provider + support + pricing + batch), all under the 300-line cap. The batch class dispatches `imageInference` POSTs via `curl_multi_init/exec/select` — wall-clock time for the A/B pair drops to ≈ the slowest single image. A v0.9.0 one-time migration (`prautoblogger_migrated_default_image_v090`) flips sites still on the legacy default; explicit user selections are preserved. Cloudflare Workers AI remains as a legacy fallback in the registry. +After a comic-style A/B round in Apr 2026, FLUX.1 schnell via Runware was chosen as the default image backend. Cost is ~$0.0006/image vs ~$0.039/image for Gemini 2.5 Flash Image via OpenRouter (≈65× cheaper), and the looser schnell fidelity reads as editorial-cartoon style — a feature, not a bug, for our single-panel comic aesthetic. FLUX.1 dev (~$0.02/image, 28 steps) remains available as an opt-in for higher-fidelity runs. The Runware layer mirrors the OpenRouter split (interface + provider + support + pricing + batch), all under the 300-line cap. The batch class dispatches `imageInference` POSTs via `curl_multi_init/exec/select` — wall-clock time for the A/B pair drops to ≈ the slowest single image. A v0.9.0 one-time migration (`prautoblogger_migrated_default_image_v090`) flips sites still on the legacy default; explicit user selections are preserved. Cloudflare Workers AI was removed as an image provider in v0.10.0 (see ADR #16 note below). + +### #16: Image generation via Cloudflare Workers AI (FLUX.1) — SUPERSEDED v0.10.0 +Kept here for history. Until v0.8.2 the default image backend was FLUX.1 schnell on Cloudflare Workers AI, routed via the Cloudflare AI Gateway for caching + unified telemetry. In v0.9.0 (2026-04-21) Runware FLUX.1 schnell became the default (65× cheaper, see ADR #17). In v0.10.0 (2026-04-21) the Cloudflare Workers AI provider was removed entirely — classes, settings, tests, and registry entries are gone; any CF user is migrated to `runware:100@1` on upgrade via `PRAutoBlogger_Migrate_Remove_Cloudflare_V0100::run()`. The Cloudflare AI Gateway in front of OpenRouter (ADR #15) is unaffected — it is a distinct integration. -### #16: Image generation via Cloudflare Workers AI (FLUX.1), via AI Gateway (v0.8.2+) -The image-generation layer uses FLUX.1 [schnell] on Cloudflare Workers AI as its default model, chosen for its ~$0.0011/MP cost and 2–3 sec latency. FLUX.1 [dev] is a ~4× cost upgrade exposed as a dropdown for specific posts that warrant it. **v0.8.2+**: calls route through the Cloudflare AI Gateway (same gateway we already use for OpenRouter — `gateway.ai.cloudflare.com/v1/{account}/{gateway}/workers-ai/@cf/black-forest-labs/...`) for response caching, unified cost/latency telemetry, and rate limiting. The 2026-04-15 regression that caused the gateway route to 403 on Workers AI has been resolved upstream; verified by direct probe on 2026-04-21. A `prautoblogger_cf_image_via_gateway` toggle (default on) falls back to the direct `api.cloudflare.com/client/v4/accounts/{id}/ai/run/...` URL if the gateway regresses again. The provider lives behind `PRAutoBlogger_Image_Provider_Interface`, so switching to a different image API (DALL-E, Replicate) is a new class implementation plus a one-line swap in the pipeline wiring. ### #15: Optional Cloudflare AI Gateway in front of OpenRouter We already use Cloudflare for DNS/CDN on peptiderepo.com, so layering AI Gateway in front of OpenRouter is zero marginal infrastructure. It gives us response caching (meaningful for repeated classification/scoring calls), a unified cost/latency dashboard, rate limiting, and provider fallback — all of which we would otherwise have to build ourselves to satisfy the CTO cost-tracking rules. Kept as an opt-in URL setting (`prautoblogger_ai_gateway_base_url`) so the plugin still works unchanged out of the box and can be bypassed instantly if the gateway misbehaves. The gateway is a transparent OpenRouter-compatible proxy; no new provider class is needed, and the response parsing path (`usage`, `choices[0].message.content`) is unchanged. diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d61f6a..81e35cc 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,69 @@ All notable changes to PRAutoBlogger will be documented in this file. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project uses [Semantic Versioning](https://semver.org/). +## [0.10.0] — 2026-04-21 + +### Removed + +- **Cloudflare Workers AI as image provider.** The four `class-cloudflare-image-*` + provider files are gone along with their unit tests and the three + CF-specific options (`prautoblogger_cloudflare_ai_token`, + `prautoblogger_cloudflare_account_id`, `prautoblogger_cf_image_via_gateway`). + Runware FLUX.1 schnell produces equivalent-quality output at ~65× + less cost and eliminates a duplicated settings surface. The + `flux-1-schnell` registry entry that mapped to the CF provider is + removed; the legacy slug now resolves to an empty provider (caught + by the migration). + +### Changed + +- **Sites on any `cloudflare` image provider auto-migrate to + `runware:100@1` on upgrade.** New migration + `PRAutoBlogger_Migrate_Remove_Cloudflare_V0100::run()` runs from + `admin_init` once per site. Detects three legacy shapes: registry- + derived provider `cloudflare`, `prautoblogger_image_provider` option + set to `cloudflare`, or the legacy slug `flux-1-schnell`. Sets + `prautoblogger_image_provider` + `prautoblogger_image_model` to the + Runware schnell pair and deletes the three dead CF options. Idempotent + via `prautoblogger_migrated_remove_cloudflare_v0100` flag — running + twice is a no-op and will not clobber a post-migration manual choice. +- **Image provider dispatch fallback is now Runware, not Cloudflare.** + `PRAutoBlogger_Image_Pipeline::create_default_provider()` returns + `PRAutoBlogger_Runware_Image_Provider` for any unrecognised + `prautoblogger_image_provider` value. An unmigrated install still + gets a working pipeline instead of a fatal. + +### Note + +- **Cloudflare AI Gateway fronting OpenRouter is unaffected.** The + `prautoblogger_ai_gateway_base_url` + `prautoblogger_ai_gateway_cache_ttl` + options, their settings fields, `class-open-router-config.php` + gateway resolution, and `class-open-router-request-builder.php` + `cf-aig-cache-ttl` headers are all intentionally untouched. The AI + Gateway is a proxy/cache layer in front of OpenRouter and is + orthogonal to the CF Workers AI image provider removal. The + migration test asserts this invariant explicitly. + +### Cost impact + +Zero recurring spend from CF Workers AI image generation (the +peptiderepo.com install was still on CF as recently as v0.8.2 — see +commit `80a7e11`). No new prompt tokens, no change in model mix for +sites already on Runware or OpenRouter. + +### Migration checklist (for anyone else running this plugin) + +1. On first admin_init after upgrade, the migration will flip + `prautoblogger_image_provider` to `runware` and + `prautoblogger_image_model` to `runware:100@1` if you were on CF. +2. **Set `prautoblogger_runware_api_key`** in Settings → Images if you + hadn't already — image generation will fail until it is set. +3. The CF API token + account ID options are deleted by the migration; + you don't need to do anything. +4. If you want to switch back to OpenRouter (Gemini) instead of + Runware, just change the Image Model picker after the migration + has run. + ## [0.9.0] — 2026-04-21 ### Added diff --git a/prautoblogger.php b/prautoblogger.php index cd6d609..0557da1 100644 --- a/prautoblogger.php +++ b/prautoblogger.php @@ -8,7 +8,7 @@ declare(strict_types=1); * Plugin Name: PRAutoBlogger * Plugin URI: https://peptiderepo.com/prautoblogger * Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics. - * Version: 0.9.0 + * Version: 0.10.0 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: PeptideRepo @@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) { | and limits without magic strings. */ -define( 'PRAUTOBLOGGER_VERSION', '0.9.0' ); +define( 'PRAUTOBLOGGER_VERSION', '0.10.0' ); define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' ); define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ ); define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );