=== WPAgents ===
Contributors: wpagents
Tags: ai, chatbot, artificial intelligence, openai, assistant
Requires at least: 7.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.6.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Personalized AI agents for WordPress. Integrates with WordPress AI Connectors and OpenRouter for multi-model support.

== Description ==

WPAgents lets you create and deploy intelligent AI assistants directly in your WordPress site. Each agent can be trained with your own documents, remember user context, and respond via a beautiful chat interface.

**Key features:**

* **Dual AI provider support** — Works natively with WordPress AI Client (WordPress 7.0+) and OpenRouter as a fallback or primary provider.
* **Per-agent configuration** — Each agent has its own system prompt, training documents, memory limits, and model settings.
* **RAG (Retrieval-Augmented Generation)** — Index TXT, Markdown, CSV, JSON, HTML, DOCX and PDF documents to give agents specialized knowledge.
* **Role-based access control** — Restrict which WordPress user roles can interact with each agent.
* **Suggest Reply for Comments** — Generate contextual reply suggestions for comment moderation using your AI agent.
* **Bulk Post Summarization** — Generate AI-powered excerpts for multiple posts at once from the post list screen.
* **Periodic Content** — Schedule AI agents to draft blog posts automatically at defined intervals.
* **Conversation summaries** — Automatically summarize completed conversations for your support team.
* **AI Content Traceability** — Track which posts were generated by AI, including agent, timestamp, and prompt preview.
* **Admin assistant** — An AI agent floating in the WordPress admin panel ready to help with editorial and operational tasks.
* **Token usage tracking** — Monitor token consumption per user with optional monthly limits.
* **i18n ready** — Full support for Portuguese (Brazil), Spanish, and English.

== External Services ==

This plugin communicates with external third-party services to process AI requests:

**1. OpenRouter (openrouter.ai)**
When an OpenRouter API key is configured, this plugin sends chat messages and document content to the OpenRouter API to generate AI responses. This service is used when the WordPress AI Client is not available or as a fallback.
- Service: https://openrouter.ai
- Privacy Policy: https://openrouter.ai/privacy
- Terms of Use: https://openrouter.ai/terms

**2. WordPress AI Client / Connectors**
When the WordPress AI plugin (wordpress.org/plugins/ai/) is installed and active, this plugin uses the WordPress AI Client (`wp_ai_client_prompt()`) to route requests through the configured connectors (OpenAI, Anthropic, Google, etc.).
- WordPress Privacy Policy: https://wordpress.org/about/privacy/
- Data is processed by the respective connector provider (OpenAI, Anthropic, Google, etc.)

**Data transmitted:** User chat messages, document content (for RAG context), and system prompts. No data is transmitted unless an API key or AI Connector is configured by the site administrator.

== Privacy Policy ==

This plugin does not collect personal data on its own servers. User messages are transmitted directly to the configured AI provider (OpenRouter or WordPress AI Connectors). Administrators are responsible for informing their site visitors about this data processing in their site's privacy policy.

== Installation ==

1. Upload the `wpagent` folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the 'Plugins' menu in WordPress.
3. Go to **WPAgents > Settings** to configure your AI provider:
   - **WordPress AI**: Install the official AI plugin and configure a Connector (recommended for WordPress 7.0+).
   - **OpenRouter**: Enter your API key for direct multi-model access.
4. Go to **WPAgents > Agents** to create your first agent.
5. Use the shortcode `[wpagent_chat agent="your-agent-slug"]` to embed the chat on any page.

== Frequently Asked Questions ==

= Does this plugin work without an OpenRouter key? =

Yes. If you are running WordPress 7.0+ with the official WordPress AI plugin and a configured Connector, WPAgents will use it automatically — no OpenRouter key required.

= What AI models are supported? =

Through OpenRouter: hundreds of models including GPT-4, Claude, Llama, Mistral, Gemini, and more.
Through WordPress AI Connectors: any provider supported by the official WordPress AI plugin.

= Is the chat widget visible to all visitors? =

By default, agents are not publicly visible. You control visibility per-agent: "Public Site Assistant" for front-end float widget, or via shortcode placement. You can also restrict access by WordPress user role.

= What file types can I use for training? =

TXT, Markdown (.md), CSV, JSON, HTML, DOCX, and PDF (text-based). Files are indexed automatically and broken into searchable chunks for RAG.

= Does this plugin store chat messages? =

Conversations are stored in your WordPress database (locally) to enable history, summaries, and memory features. Messages are sent to AI providers for processing. See the Privacy Policy section for details.

== Screenshots ==

1. Dashboard with active AI provider badge
2. Agent configuration with role-based access control
3. Chat widget embedded on a page
4. Comment reply suggestion feature in action
5. Bulk post summary generation from the posts list

== Changelog ==

= 0.6.0 =
* **New:** Dashboard badge showing active AI provider (WordPress AI or OpenRouter)
* **New:** Dismissible notice when no AI provider is configured
* **New:** Role-based access control — restrict which WordPress roles can use each agent
* **New:** Suggest Reply for Comments — generate AI reply suggestions for comment moderation
* **New:** Bulk Post Summarization — generate `post_excerpt` for multiple posts at once
* **New:** AI Content Traceability — track posts generated by Periodic Content (agent, timestamp, prompt)
* **New:** Configurable AI request timeout (filter: `wpagent_ai_request_timeout`)
* **Fix:** All admin notices are now dismissible (WP.org Rule 11 compliance)
* **Fix:** External services disclosure added to Settings page (WP.org Rule 7 compliance)
* **Improved:** Plugin version bumped to 0.6.0

= 0.5.9 =
* Internationalization: all strings wrapped with i18n functions (pt_BR, es_ES, en_US)
* Periodic content (DRIP) timestamp bug fixed
* Email scheduling module temporarily hidden pending stability improvements
* Various admin UI and security hardening improvements

== Upgrade Notice ==

= 0.6.0 =
Major feature release. Update recommended. No database schema changes required.
