# Changelog

All notable changes to the Teddy WordPress plugin are documented here.

## [1.4.2] — 2026-07-18

### Added

- OpenClaw buyer UX: `teddy-openclaw connect` / `diagnose` with Agent Pipeline detection; OpenClaw plugin form (`siteUrl` + username + Application Password); guide `docs/modules/mcp-bridge/USER-GUIDE-OPENCLAW.md`

## [1.4.1] — 2026-07-18

### Added

- **`@teddy/openclaw`** (`openclaw/`): `teddy-openclaw setup` wizard — probe site, write OpenClaw `mcp.servers`, install Teddy skill for buyers who use OpenClaw

## [1.4.0] — 2026-07-18

### Added

- **Manager domain tools:** `site.briefing`, `content.gaps`, `content.scheduled`, `comment.list`, `comment.set_status`, `ops.recent_changes`, `ai.usage.summary`, `knowledge.status`
- `post.update` supports `post_date` / `future` scheduling
- Playbooks under `docs/playbooks/` and Zalo approval guide for MCP dangerous tools

## [1.3.3] — 2026-07-18

### Added

- **MCP bridge** (`mcp-server/`): stdio MCP server so OpenClaw (or any MCP client) can call Teddy domain tools over REST (`GET /domain-tools`, `POST /tools/{name}/execute`)
- Application Password / JWT auth, tool allow/deny lists, and dangerous-tool approval (`approved` + `approval_token`)
- Live deploy guide for blackbean.io.vn: `docs/modules/mcp-bridge/deploy-blackbean-io-vn.md`

## [1.3.2] — 2026-07-17

### Fixed

- Gemini `MALFORMED_FUNCTION_CALL` responses no longer fail the whole request: Teddy retries the turn without tools, falls back to the next configured provider when possible, and streaming falls back to the buffered path
- Fixed infinite recursion in `ModelCatalog::sanitize_model_value()` for composite `provider/model` values

## [1.3.1] — 2026-07-17

### Added

- **Settings → Model provider & Model selectors**: provider dropdown now works on the Settings page; model field lists text-generation models discovered from configured WordPress AI Client connectors
- Models are grouped/filtered by selected provider; with **Auto**, all configured providers are shown with provider prefixes
- Local/Ollama models and Gemini Flash free-tier candidates are sorted first with clear labels (pricing still depends on your connector account)

### Fixed

- Custom provider select on Settings now loads `admin-select.js` and dispatches `change` events when updated
- Teddy now applies saved model choices via a `[ provider_id, model_id ]` preference tuple instead of passing a bare model string

## [1.3.0] — 2026-07-17

### Added

- **AI comment moderation** (optional): hold guest comments, analyze toxicity/sentiment in a background job, then approve/hold/spam with audit metadata
- **Suggest Reply** for moderators on Comments screen and Dashboard activity (`POST /teddy/v1/comments/suggest-reply`)
- **Content Classification** block editor panel: suggest existing categories/tags from post content (`POST /teddy/v1/classify`)
- Settings → **Comments** section and classification max suggestions control

### Notes

- Comment moderation is **off by default**; enable in Teddy → Settings → Comments
- Uses the same WordPress AI Client connectors as other Teddy features; comment text is sent to the configured provider when moderation or Suggest Reply runs

## [1.2.0] — 2026-07-16

### Added

- **Channels** foundation: `ChannelMessage`, `ChannelAdapterInterface`, ingress via public `ChatDispatcher`
- **Facebook Messenger** adapter: Meta webhook verify + signature, parse messages/postbacks, Graph Send API replies
- REST: `GET|POST /teddy/v1/channels/facebook/webhook`
- Settings → **Channels** (enable, Page ID, access token, app secret, verify token)
- Admin notice when Messenger is enabled but tokens are incomplete
- Docs: `docs/modules/channels/` (Meta checklist, tunnel notes, Phase 2 roadmap)
- Unit tests for webhook payload parsing


### Fixed

- AI provider fallback now retries the next configured connector on quota and transient upstream failures
- Ability schemas now emit valid empty-object `properties` for no-input tools
- Writer JSON schema now requires `excerpt` to satisfy stricter AI Client response validation

### Dev / Local

- Docker local mail now routes `wp_mail()` to Mailpit via `wp-content/mu-plugins/local-mailpit.php`
- `docker-compose.yml` and `site-template/docker-compose.yml` now include `mailpit` and mount `wp-content/mu-plugins`

## [1.1.0] — 2026-07-16

### Added

- Settings: upload PDF/CSV knowledge documents directly from the Knowledge panel
- AI image generation via WP AI Client for `media.generate_image` and `publish_product` workflow (GD placeholder fallback)
- PDF text extraction via `smalot/pdfparser` when installed (heuristic fallback retained)

### Fixed

- Elementor `_elementor_data` root array parsing in `KnowledgeContentEnricher`

## [1.0.5] — 2026-07-16

### Added

- Tools: `system.send_email` (admin-only, dangerous), `system.wp_cli` (hard whitelist, dangerous), `media.generate_image` (GD placeholder)
- RAG: PDF/CSV attachment ingest on upload + reindex `uploads` phase; `POST /knowledge/ingest`; ACF + Elementor text via `KnowledgeContentEnricher`
- `publish_product` workflow: default `teddy_workflow_generate_product_image` handler creates placeholder PNG

## [1.0.4] — 2026-07-16

### Added

- System tools: `system.clear_cache`, `system.optimize_db`, `system.backup.run` (+ `teddy_clear_cache` / `teddy_run_backup` hooks)
- RAG: `rag_indexable_post_types` setting + filters `teddy_indexable_post_types` / `teddy_indexable_posts`; cursor phases use singular post types

## [1.0.3] — 2026-07-16

### Added

- Domain tools closing Vision gaps: `post.delete`, `wc.product.find_missing_images`, `wc.product.list_expired_promotions`, `wc.product.clear_expired_sales`, `wc.report.revenue`
- `publish_product` workflow steps: ensure featured image (brief + extension hooks), translation draft via `target_language`, optional `notify_email`
- Filters/actions: `teddy_workflow_generate_product_image`, `teddy_workflow_need_product_image`

## [1.0.2] — 2026-07-14

### Added

- Native-first streaming path: `ProviderManager::stream()` + `ChatService::stream_turn()` + SSE `stream_mode`
- Filters `teddy_supports_streaming` / `teddy_stream_completion` for real token streams
- Domain value-object unit tests; RAG E2E smoke (`tests/e2e-rag.php`)
- Module docs: tool-system, provider, security, onboarding
- Per-module `src/**/README.md` stubs (docs 03 §8)
- Dangerous-tool `approval_token` — dry-run issues token; execute with `approved=true` without matching preview is rejected

### Fixed

- Double-register of `teddy/site-statistics` when agent pipeline is on
- REST approval bypass (`approved=true` without prior dry-run)
- Chat UI passes `approval_token` on approve
- Workflows admin badge updated to v1.0

## [1.0.2] — 2026-07-13

### Added

- v1.0 onboarding: backup step, SEO draft step, dismiss + confirm-backup REST
- `system.backup.status` domain tool and `BackupStatusService`
- Vietnamese i18n pipeline (`npm run i18n`) with `.po`, `.mo`, and Jed JSON bundles
- Security audit admin page and `GET /teddy/v1/security/audit`
- Workflows admin UI (React) and workflow run list/resume API
- Extension SDK: `teddy_boot`, demo extension, developer tools
- Observability dashboard (audit log + AI usage stats)
- PHPUnit integration tests (workflows, onboarding, security audit)
- CLI E2E harness (`tests/e2e-*.php`)

### Changed

- Agent pipeline routes admin Copilot through audited domain tools (feature flag)
- DB schema v1.3.0: audit log, AI usage, memory, workflow runs
- Release ZIP now includes `vendor/` for production installs
- Settings labels updated for GA (removed v0.x version tags)

### Fixed

- Extension SDK boot order: `teddy_boot` fires after all providers
- PSR-4 autoload fallback on PHP 8.1 (lazy static map)
- DB migrations run on plugin boot (not only `admin_init`)
- E2E bootstrap: schema upgrade + feature flags before boot

## [1.0.0] — earlier

- Initial public Teddy plugin: chatbot, Copilot, RAG, SEO, Writer, WooCommerce tools
