=== KimaAI – AI Chatbot & Assistant for WordPress ===
Contributors: nabiabdi
Donate link: https://kimaai.com
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl.html
Tags: chatbot, ai chatbot, customer support, openai, vector search
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.5.8

Content-aware AI chatbot for WordPress. Bring your own API key, answer from site content, and improve with vector search.

== Description ==
KimaAI brings modern AI features to WordPress by connecting your site to AI providers (like OpenAI) and exposing them through an easy-to-configure chatbot and a growing set of AI tools.

== With KimaAI you can: ==
* Build a customizable chatbot with model/provider selection, content awareness, quick actions, and an optional attention popover.
* Add a vector database search tool and multilingual embeddings to power smarter, language-aware answers.
* Collect chatbot feedback to understand response quality and improve your on-site experience over time.
* Use a setup wizard to get started quickly, plus a settings system designed to be maintainable and extensible.
* Extend KimaAI via developer hooks/filters to register and control custom tools and tool execution.

KimaAI is built to stay flexible: it works for non-technical users who want a powerful chatbot, and it also provides hooks and internal APIs for developers who want to integrate AI deeper into their workflows.

Please make sure to carefully read the [Disclaimer](https://kimaai.com/disclaimer/) before using the plugin, check the [KimaAI](https://kimaai.com) website for more information. Thank you!

== Features ==
* AI Chatbot: provider/model selection, content awareness, quick actions, and UI customization.
* Setup Wizard: guided first-time configuration.
* Vector Search: vector DB search tool + embeddings to improve answers.
* Multilingual-ready: multilingual embeddings and translatable dynamic settings (Polylang/WPML).
* Feedback: collect user feedback on chatbot responses.
* Developer hooks: register custom tools and control/observe tool calls.
* More features coming soon!

== My Vision for AI ==
AI is incredible, no doubt about it. It's changing everything—from the way we work to the way we create. But for me, AI isn't just about churning out endless content or automating everything for the sake of it. I want to see AI being used thoughtfully—as a tool that actually helps people.
I dream of an AI-driven world where creators can focus on their ideas instead of struggling with words, where language barriers don't hold anyone back, and where tedious work is handled for us so we can spend more time on what really matters—our passions, our families, and just enjoying life.

I'll always push for AI to be used in a way that empowers rather than overwhelms. Hope you're with me on this! 💡💙

== Disclaimer ==
KimaAI is a plugin that helps you to connect your websites to AI services. You need your own API keys and must follow the rules set by the AI service you choose. For OpenAI, check their [Terms of Service](https://openai.com/terms/) and [Privacy Policy](https://openai.com/privacy/). It is also important to check your usage on the [OpenAI website](https://platform.openai.com/usage) for accurate information. Please do so with other services as well.

The developer of KimaAI and related parties are not responsible for any issues or losses caused by using the plugin or AI-generated content. You should talk to a legal expert and follow the laws and regulations of your country. KimaAI does only store data on your own server, and it is your responsibility to keep it safe. KimaAI's full disclaimer is [here](https://kimaai.com/disclaimer/).

== Installation ==
1. Upload the plugin files to the `/wp-content/plugins/kimaai` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Run the Setup Wizard — it guides you through connecting your AI provider and API key.
4. Place the chatbot on your site and start answering visitor questions.

== Frequently Asked Questions ==
= How do I get an API key? =
You can get an API key from OpenAI by creating an account on their website. Check the [OpenAI website](https://openai.com) for more information.

== Screenshots ==
1. KimaAI chatbot widget on the website – light and dark mode side by side.
2. Chatbot live on your site: visitor getting an instant answer after connecting your API key and completing the setup wizard.
3. Connect your provider: AI Environments settings with OpenAI, OpenRouter, Replicate, and Ollama configured.
4. Content awareness on a live page: the chatbot answering a question directly from the current page content.
5. Quick actions: pre-set buttons for common visitor requests like "Compare services" and "Find documentation".
6. Knowledge / vector retrieval: Embedding Environments settings connecting a Pinecone knowledge base.
7. Feedback and improvement: Feedback Analytics overview showing helpful rate, CSAT trend, and top pages.
8. Chatbot widget on the frontend with dark mode and minimalist styling.
9. Chatbot Appearance settings with a live preview of the widget.
10. Chatbot Appearance wording and attention popover settings.
11. Function or Tool calling settings.
12. Feedback Analytics message feedback view with conversation history.
13. Feedback Analytics CSAT view with score distribution.
14. Chatbot History with a selected session conversation and debugger panel.
15. Embedding Sync table with synced and unsynced content sources.
16. WooCommerce Integration enabled with product assistant options.
17. Export Settings with JSON export preview.
18. Log Settings with debug logging and retention cleanup enabled.
19. Logs viewer with selected log file details and log content.
20. Feedback Analytics overview dashboard in dark mode.

== Changelog ==

= Unreleased =
### Fixed
- The chatbot no longer sets its `kimaai_chatbot_session_id` cookie when a visitor simply loads a page or opens the widget. The cookie was written from inside the history endpoint, which the widget calls as soon as it mounts — and, with the attention popover enabled, on page load with no interaction at all. It is now written only when the visitor sends their first message, so a visitor who never chats is left with no cookie. Reading history or resetting a conversation no longer creates a session either.
- Reduced the chatbot session cookie's lifetime from one year to 30 days. Cookies already in browsers keep their original expiry until the visitor resets their conversation.
- Removed the explicit `Domain` attribute from the chatbot session cookie. The browser now scopes it to the exact host that set it, instead of sharing it across subdomains — and the cookie is no longer rejected outright on hosts whose `SERVER_NAME` carries a port or is an IP address. Because a cookie's identity includes its domain scope, the previous domain-scoped cookie is expired explicitly when the new one is issued, so upgraded visitors are not left holding both.

= 1.5.8 - 2026-09-14 =
### Added
- Added a Utility Model dropdown in the chatbot's advanced settings, replacing the free-text model field, with Reasoning level and Verbosity controls that appear for models that support them. Internal helper calls (query rewriting, groundedness checks) now honor these settings; leave the model on "Default" to keep using the chat model.
- Added an MCP (Model Context Protocol) server so AI agents can observe and diagnose the chatbot over a single authenticated endpoint (`POST /wp-json/kimaai/v1/mcp`). Read/diagnose tools cover usage stats, knowledge gaps, feedback, conversations/incidents, eval history, and — for a given query — asking the chatbot, inspecting retrieval, classifying the likely failure, and checking embedding coverage. Access is gated by scoped bearer tokens (`wp kimaai mcp token`) or WordPress Application Passwords and a new `kimaai_mcp` capability; every call is audit-logged, analytics output is PII-redacted by default (raw requires the `read:raw` scope), and ungrounded answers are recorded for diagnosis. Audit and groundedness rows are kept for 90 days, filterable via `kimaai_mcp_log_retention_days`.
- Added an **MCP Server** screen under the Integrations settings tab to manage the MCP server without the CLI: it shows the endpoint URL, an enable toggle and environment selector, a copy-paste connection command, and a table to create scoped access tokens (shown once) and revoke them. The endpoint is disabled by default and stays closed until you turn it on.
- Added an OAuth 2.1 authorization server (authorization code + PKCE + Dynamic Client Registration, with discovery metadata and a WordPress-login consent screen) so claude.ai Custom Connectors can connect to the MCP server without a manually-created token.
- Added gated write tools to the MCP server so agents can apply fixes, not just diagnose: change settings (with a preview step and one-command rollback), re-embed content, run the golden-set eval, and capture a fix as a new eval case. Writes require the `write` scope and route through the existing safe-write pipeline; settings changes and eval-case additions return a rollback id.
- Added a post-type restriction for embedding auto-sync, so auto-embed on first publish and auto re-embed on update only run for the post types you select. Leave every box unchecked to keep embedding all supported post types.
### Changed
- Removed AI Presets. Every surface now selects its own AI environment, so the chatbot's own environment and model drive the chatbot and its internal helper calls, and embedding uses the embedding environment. On upgrade, an install set to "Default (Set AI Presets)" keeps running on the same environment and model, and the embedding selection is carried into the embedding environment; settings you had configured yourself are left untouched.
### Developer
- Added real end-to-end coverage for the embedding auto-sync pipeline: tests publish and update real posts, run a real Action Scheduler queue, and assert on real embedding rows.
- CI now runs on demand via the `run-ci` label or a manual dispatch, instead of on every commit and every push to the main branch.

For the full changelog, visit:
[https://kimaai.com/changelog/](https://kimaai.com/changelog/)

== Upgrade Notice ==
= 1.0.0 =
This is the initial release of KimaAI. Future updates will bring additional features and improvements. Always backup your site before updating.
