<?php
/**
 * Plugin Name:       WP Agent Companion
 * Description:       Das Sicherheits-Herzstück von wpagently. Dein KI-Assistent, etwa ChatGPT, Claude Code, Claude Desktop oder Codex, kann damit deine WordPress-Seite schreiben und pflegen, und wpagently prüft nach jedem Schritt, dass wirklich alles geklappt hat.
 * Version:           0.4.92
 * Update URI:        https://www.wpagently.com/updates/wp-agent-companion.json
 * Requires at least: 6.9
 * Requires PHP:      8.1
 * Author:            wpagently
 * License:           GPL-2.0-or-later
 * Text Domain:       wp-agent-companion
 * Domain Path:       /languages
 *
 * @package WPAgentCompanion
 */
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
define( 'WPAGENT_COMPANION_VERSION', '0.4.92' );
define( 'WPAGENT_COMPANION_DIR', plugin_dir_path( __FILE__ ) );
define(
	'WPAGENT_COMPANION_UPDATE_PUBLIC_KEYS',
	array(
		'wpagently-2026-08-primary' => 'jlLn4feDxaS7K1DbdCWiyo+tL5JklMJ3KJAyXN+F2CA=',
	)
);
require_once WPAGENT_COMPANION_DIR . 'includes/option-storage.php';
require_once WPAGENT_COMPANION_DIR . 'includes/license.php';
require_once WPAGENT_COMPANION_DIR . 'includes/access-tier.php';
require_once WPAGENT_COMPANION_DIR . 'includes/control.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities-rest-normalization.php';
require_once WPAGENT_COMPANION_DIR . 'includes/wpforms-integration.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/wpforms-delivery-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/wpforms-delivery-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/wpforms-delivery-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/wpforms-delivery-create-delete.php';
require_once WPAGENT_COMPANION_DIR . 'includes/ninjaforms-integration.php';
require_once WPAGENT_COMPANION_DIR . 'includes/connection.php';
require_once WPAGENT_COMPANION_DIR . 'includes/connection-health.php';
require_once WPAGENT_COMPANION_DIR . 'includes/oauth-storage.php';
require_once WPAGENT_COMPANION_DIR . 'includes/oauth.php';
require_once WPAGENT_COMPANION_DIR . 'includes/oauth-device.php';
require_once WPAGENT_COMPANION_DIR . 'includes/chat.php';
require_once WPAGENT_COMPANION_DIR . 'includes/chat-ai.php';
require_once WPAGENT_COMPANION_DIR . 'includes/live-editor-session.php';
require_once WPAGENT_COMPANION_DIR . 'includes/license-rest.php';
require_once WPAGENT_COMPANION_DIR . 'includes/control-rest.php';
require_once WPAGENT_COMPANION_DIR . 'includes/admin-assets.php';
require_once WPAGENT_COMPANION_DIR . 'includes/license-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/control-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/wpforms-integration-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/ninjaforms-integration-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/connection-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/oauth-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/oauth-device-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/chat-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/live-editor-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/agent-state-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/agent-memory-admin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/update.php';
require_once WPAGENT_COMPANION_DIR . 'includes/helpers.php';
require_once WPAGENT_COMPANION_DIR . 'includes/deactivation-warning.php';
require_once WPAGENT_COMPANION_DIR . 'includes/agent-state.php';
require_once WPAGENT_COMPANION_DIR . 'includes/chat-context.php';
require_once WPAGENT_COMPANION_DIR . 'includes/settings-allowlist.php';
require_once WPAGENT_COMPANION_DIR . 'includes/class-wpagent-markdown-to-blocks.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/create-post-from-markdown.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-meta-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-seo-meta.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-seo-meta.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-settings-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-settings-providers-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-settings-providers-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-settings-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-settings-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-schema-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-post-schema.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-post-schema.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-post-schema.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/term-seo-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/term-seo-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/term-seo-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-redirections-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-redirections-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seo-redirections-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seopress-redirections-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seopress-redirections-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/seopress-redirections-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/render-check.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/render-verify.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/disable-power.php';
require_once WPAGENT_COMPANION_DIR . 'includes/pattern-rendering.php';
require_once WPAGENT_COMPANION_DIR . 'includes/pattern-theme-tokens.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/upsert-pattern.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/upsert-pattern-layout.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/upsert-pattern-content.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/write-theme-file.php';
require_once WPAGENT_COMPANION_DIR . 'includes/global-styles-helpers.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/global-styles-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-global-styles.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/global-style-variations-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/global-style-variations-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/global-style-variations-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/refresh-hooks.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-post.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/detect-builder.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/refresh-builder-cache.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-compatibility.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/native-block-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/native-block-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/native-block-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-blocks-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-blocks-separator.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-static-heading-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-static-heading-colors-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-block-generateblocks-markup.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-block-generateblocks-validation.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-block-kadence-progress.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-block-kadence-spacer.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-block-kadence-countup.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-block-policy.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/builder-block-attributes.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-document-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-v3-v4-migration-preview.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-design-system-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-design-system-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-design-system-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-global-classes-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-global-classes-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-global-classes-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-document-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-document-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-elements-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-elements-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-elements-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-global-classes-apply.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-tree-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/elementor-tree-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/live-editor-elementor.php';
require_once WPAGENT_COMPANION_DIR . 'includes/live-editor-provider-finalize.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-verification.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-column-groups.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-templates-settings-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-templates-settings-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/beaver-templates-settings-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-posts.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/update-post.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-post-status.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/trash-post.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/restore-post.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-post.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/create-term.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/update-term.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-term.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-term.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-terms.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-post-terms.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/upload-media.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/direct-media-upload.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/direct-media-upload-handler.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-alt-text.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-featured-image.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-media.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-media.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/create-menu.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/add-menu-item.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-menus.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/assign-menu-location.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-menu.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-setting.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/update-setting.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-settings.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-comments.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/moderate-comment.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/reply-to-comment.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-comment.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-users.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-user.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/set-user-role.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/create-user.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-user.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-plugins.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/activate-plugin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/deactivate-plugin.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-themes.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/switch-theme.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/create-reusable-block.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/update-reusable-block.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/list-reusable-blocks.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/delete-reusable-block.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/site-editor-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/site-editor-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/site-editor-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-one-design-snapshot.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-settings-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-popup-create.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/spectra-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-values-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-values-validation.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-acf-fields.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/update-acf-field.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-field-groups-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-field-groups-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-field-groups-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-content-model-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-content-model-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acf-content-model-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-model-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-free-surface-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-act-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-model-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-free-surface-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-model-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-field-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-act-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-act-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-meta-values-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-meta-values-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/pods-meta-values-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/cptui-content-model-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/cptui-content-model-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/cptui-content-model-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-content-model-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-content-model-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-content-model-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-meta-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-meta-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-meta-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-product-data-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-product-data-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/acpt-product-data-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/meta-box-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/meta-box-relationship-validation.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/meta-box-relationships.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/meta-box-settings-page-abilities.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/meta-box-settings-pages.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/content-model-snapshot-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/content-model-snapshot.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/content-model-migration.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-store-settings.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-attributes-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-attributes-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-attributes-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-shipping-classes-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-shipping-classes-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-shipping-classes-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-products.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-bulk-pricing.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-variations.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-orders-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-orders-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/woocommerce-orders-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/get-product.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/update-product.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/contact-form-7-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/contact-form-7-config.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/contact-form-7-transaction.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/contact-form-7-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/contact-form-7-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-fields-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-fields-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-fields-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-delivery-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-delivery-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-delivery-confirmation.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-forms-delivery-notifications.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-entries-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-entries-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/fluent-entries-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/gravity-forms-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/gravity-forms-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/gravity-forms-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/gravity-entries-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/gravity-entries-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/gravity-entries-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/formidable-forms-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/formidable-forms-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/formidable-forms-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/form-migration-providers.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/form-migration-verification.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/form-migration.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/weglot.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/ase-free-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/ase-free-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/ase-free-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-schemas.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-validation.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-transaction.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-post-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-post-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/astra-post-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/generatepress-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/generatepress-transaction.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/generatepress-abilities.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/generatepress-post-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/generatepress-post-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/generatepress-post-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-validation.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-transaction.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-abilities.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-post-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-post-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-post-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-extra-title-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-extra-title-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-extra-title-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-extra-layout-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-extra-layout-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-extra-layout-write.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-extra-extensions.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-free-surface-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/oceanwp-free-surface-read.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/kadence-common.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/kadence-validation.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/kadence-transaction.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/kadence-abilities.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/kadence-form-settings.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/site-context.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/system-diagnostics.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/agent-skills.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/agent-memory.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/design-profile.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/design-directions.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/browser-links.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/content-replace.php';
require_once WPAGENT_COMPANION_DIR . 'includes/abilities/live-editor.php';
require_once WPAGENT_COMPANION_DIR . 'includes/ability-registration.php';
// Gebündelten Composer-Autoloader laden, falls vorhanden. Sobald "composer install"
// die wordpress/mcp-adapter-Library nach vendor/ gelegt hat, macht das Plugin ihre
// Klassen selbst verfügbar, statt sich auf ein Fremd-Plugin zu verlassen. Fehlt
// vendor/, bleibt das Verhalten unverändert: Die Abilities werden weiter per REST
// registriert; der MCP-Server entsteht nur, wenn ein Host-Plugin (im Test Rank Math)
// den Adapter lädt und mcp_adapter_init feuert.
if ( file_exists( WPAGENT_COMPANION_DIR . 'vendor/autoload.php' ) ) {
	require_once WPAGENT_COMPANION_DIR . 'vendor/autoload.php';
	// Der Autoloader macht die Library-Klassen nur ladbar, bootet sie aber nicht von
	// selbst: wordpress/mcp-adapter hat keinen autoload.files-Eintrag. Damit
	// mcp_adapter_init im echten Standalone-Betrieb feuert, muss WP\MCP\Core\McpAdapter
	// aktiv aufgerufen werden, genau wie es der Host im Test (Rank Math, siehe dessen
	// rank-math.php, Methode includes()) selbst tut. McpAdapter::instance() ist ein
	// Singleton mit eigenem Re-Init-Schutz (self::$initialized vor dem
	// do_action( 'mcp_adapter_init' )). Hat ein Host die Klasse bereits gebootet, liefert
	// class_exists() true, und instance() gibt nur die vorhandene Instanz zurück, ohne
	// erneut zu initialisieren: der Aufruf ist dann ein echtes No-op. Fehlt vendor/,
	// wird dieser Block nie erreicht und bleibt vollständig schlummernd.
	if ( class_exists( 'WP\\MCP\\Core\\McpAdapter' ) && function_exists( 'wp_get_abilities' ) ) {
		\WP\MCP\Core\McpAdapter::instance();
	}
}

require_once WPAGENT_COMPANION_DIR . 'includes/mcp-server.php';

/**
 * Load the plugin translations.
 *
 * The German source strings are the msgids (see the languages/ folder). A site
 * running en_US loads wp-agent-companion-en_US.l10n.php (WordPress 6.5+ preferred
 * PHP translation file) / .mo; a de_DE or default site shows the German source.
 * Hooked on init because the Abilities API and its translatable label/description
 * strings are built on wp_abilities_api_init, which fires after init.
 */
function wpagent_companion_load_textdomain(): void {
	load_plugin_textdomain( 'wp-agent-companion', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
add_action( 'init', 'wpagent_companion_load_textdomain' );

/**
 * Register the ability category.
 *
 * Categories use their own init action and must exist before any ability that
 * references them; otherwise the Abilities API rejects the ability.
 */
function wpagent_companion_register_ability_category(): void {
	if ( ! wpagent_companion_gate_open() ) {
		return;
	}
	wp_register_ability_category(
		'wp-agent',
		array(
			'label'       => __( 'WP Agent', 'wp-agent-companion' ),
			'description' => __( 'Verifizierte Schreib- und Prüfpfade von wpagently.', 'wp-agent-companion' ),
		)
	);
}
add_action( 'wp_abilities_api_categories_init', 'wpagent_companion_register_ability_category' );


function wpagent_companion_activate(): void {
	if ( false === get_option( WPAGENT_COMPANION_OPT_ENABLED, false ) ) {
		update_option( WPAGENT_COMPANION_OPT_ENABLED, '1', false );
	}
	if ( false === get_option( WPAGENT_COMPANION_OPT_PROFILE, false ) ) {
		update_option( WPAGENT_COMPANION_OPT_PROFILE, 'content', false );
	}
	if ( ! wp_next_scheduled( WPAGENT_LICENSE_CRON_HOOK ) ) {
		wp_schedule_event( time() + HOUR_IN_SECONDS, 'daily', WPAGENT_LICENSE_CRON_HOOK );
	}
}
register_activation_hook( __FILE__, 'wpagent_companion_activate' );
add_action( 'init', 'wpagent_companion_activate' );

function wpagent_companion_deactivate(): void {
	wp_clear_scheduled_hook( WPAGENT_LICENSE_CRON_HOOK );
}
register_deactivation_hook( __FILE__, 'wpagent_companion_deactivate' );
