=== Niwa AI ===
Contributors: niwaai
Tags: ai, woocommerce, sales, chat
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 8.1
Stable tag: 0.13.874
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Fast AI sales assistant for WooCommerce.

== Description ==
Niwa AI helps shoppers discover products faster with guided recommendations.

Use `[niwa_booking]` for a booking button or `[niwa_booking type="link"]` for an inline link. The label, CSS class, service, team member and title may be set with `label`, `class`, `service_id`, `team_member_id` and `title`. Any existing site button can open the same fullscreen scheduler by using `#niwa-booking` as its URL.

== Installation ==
1. Upload the plugin files to `/wp-content/plugins/niwa-ai`.
2. Activate the plugin through the Plugins screen.
3. Open Niwa AI in wp-admin.

== Frequently Asked Questions ==
= Does this plugin send data to external services? =
Only if you configure an AI provider in settings.

== Changelog ==
= 0.13.874 =

- Generate BlogPosting published and modified timestamps through WordPress native local/GMT date APIs so draft and publish schemas represent the same real timeline.

= 0.13.873 =

- Added one canonical draft-first blog quality pipeline for create, update, direct publish, and scheduled publish.
- Governed taxonomy, verified contextual links, exact-revision approval, safe scoped assets/schema, complete managed-state rollback, and truthful machine-readable quality reports.
- Removed raw fallback and implicit draft-queue publishing bypasses; aligned admin settings, prompts, bundled blog skill, and documentation.

= 0.13.591 =

- Added a pre-tick background runner token check so superseded loop workers exit before processing managed hooks.
- Bumped plugin metadata from 0.13.590 to 0.13.591.

= 0.13.590 =

- Stopped stale internal background-clock runners when their token is superseded, preventing parallel runner loops from duplicating operative heartbeat sends and starving normal Telegram replies.
- Forced operative heartbeat ticks to reload fresh config before due checks and immediately before static message delivery, so founder stop commands take effect in long-running workers.
- Bumped plugin metadata from 0.13.589 to 0.13.590.

= 0.13.589 =

- Reissued the scheduled research prewake delivery fix under release version 0.13.589.
- Bumped plugin metadata from 0.13.587 to 0.13.589.

= 0.13.587 =

- Scoped scheduled research prewake blocking so only the timed final report is held until the delivery target; self-extension approvals, blockers, and other immediate intervention messages can still reach the founder during preparation.
- Prevented immediate-attention preparation replies from being saved as prepared scheduled delivery output, avoiding duplicate delayed sends after a blocked or approval-needed preparation run.
- Bumped plugin metadata from 0.13.586 to 0.13.587.

= 0.13.586 =

- Added an internal managed background clock for scheduled automation when local PHP CLI spawning is available.
- Hardened operative heartbeat static-message interval scheduling, retries, state signatures, and lock/dedupe ownership.
- Bumped plugin metadata from 0.13.585 to 0.13.586.

= 0.13.583 =

- Scoped pending self-extension workflow state to the current task prompt so stale capability-gap approvals cannot park unrelated scheduled work.
- Hardened scheduled research delivery so prewake runs capture prepared report text without sending early, validate the target slot before delivery, and retry instead of finalizing child schedules.
- Added scheduler and actor recovery gates for stale running jobs, actor-pending leases, and scheduled actor attempts so crashed runners recover without duplicate execution.
- Fixed native tool-search contract handling so already-available native tools do not require a follow-up tool_load step.
- Bumped plugin metadata from 0.13.582 to 0.13.583.

= 0.13.582 =

- Hardened scheduled self-wake actor result recording, stale attempt handling, and extension-pending retries.
- Added scheduled research delivery prewake storage so prepared reports are sent at the target time without early delivery.
- Bumped plugin metadata from 0.13.581 to 0.13.582.

= 0.13.581 =

- Kept native scheduled publish runs rollback-visible when the post is published but Telegram confirmation fails.
- Blocked blog creation and heartbeat mutation tools during no-create scheduled self-wake execution.
- Bumped plugin metadata from 0.13.580 to 0.13.581.

= 0.13.580 =

- Hardened scheduled self-wake blog publishing after council review: broader task detection, delivery failure reporting, rollback-capable native run audit, stale recent-turn suppression, and blocked scheduler recreation tools during due ticks.
- Bumped plugin metadata from 0.13.579 to 0.13.580.

= 0.13.579 =

- Fixed due schedule_self_wake execution so recurring blog publish ticks do the scheduled work instead of confirming an already-active schedule.
- Added a native draft-queue publishing experiment with Telegram confirmation; current releases have removed this unsafe implicit queue path in favor of exact approved revisions.
- Isolated scheduled self-wake fallbacks from stale chat context and exposed task-relevant blog/code tools.
- Bumped plugin metadata from 0.13.578 to 0.13.579.

= 0.13.578 =

- Ran actor runtime immediately after scheduled job processing inside background/timed ticks so self_wake jobs do not wait for a later runner cycle.
- Routed exact repeated admin Telegram messages from interval schedule_self_wake into static operative heartbeat delivery.
- Scoped scheduled self-wake delivery idempotency by job occurrence so intentional repeated messages are not suppressed as duplicates.
- Bumped plugin metadata from 0.13.577 to 0.13.578.

= 0.13.577 =

- Reworked Niwa background processing into a host-agnostic one-shot runner with bounded external scheduling, lock health, event repair, recurring future preservation, and one-shot claim protection.
- Added static exact operative heartbeat delivery for repeated fixed messages without invoking the model/tool-search loop on every tick.
- Opened scheduled admin plans to any previewable native admin action, including blog creation/publishing, added interval scheduling for minute/hour cadences, and added schedule_self_wake so Niwa can wake later to reason, inspect current state, run script/code workflows, or choose tools at execution time.
- Hardened delayed blog publishing with expected-status drift checks when publish_blog_post is frozen for later execution.
- Saved the reusable Council Implementation Review skill for future three-agent implementation reviews.
- Bumped plugin metadata from 0.13.576 to 0.13.577.

= 0.13.576 =

- Added task adequacy reflection before final founder replies so partial answers can trigger bounded recovery instead of ending at a weak "cannot do it" result.
- Added durable per-task attempt budgeting with a hard limit of two automatic recovery/growth attempts and blocked_after_two_attempts state to stop repeated continuations.
- Added out-of-the-box skills.sh/GitHub external skill search, preview, trust/risk metadata, and approved skill_import_from_github import through the existing Niwa skills manager.
- Bumped plugin metadata from 0.13.575 to 0.13.576.

= 0.13.575 =

- Added a capability-gap router so weak or empty tool discovery now opens a self-extension workflow with attempted tools, candidate evidence, risk, retry, and learning metadata instead of ending at "no tool".
- Extended the approved runtime self-extension route with skill and eval tools so successful new capabilities can be saved as reusable workflows.
- Hardened IMAP IDLE inbound email notifications with durable mailbox/message identity records and Seen marking to prevent old unread messages from being re-notified after a short cache expires.
- Bumped plugin metadata from 0.13.574 to 0.13.575.

= 0.13.574 =

- Added site design context for Niwa-generated template widgets so Elementor kit and theme colors drive backgrounds, cards, accents, muted text, selected states, and readable buttons.
- Passed site design context into LLM template generation and native Elementor widget setting adaptation so Niwa keeps the current site design language when building from templates.
- Updated shortcode fallback styling and Announcement bar Elementor output to inherit the same design tokens instead of using a hardcoded unrelated palette.
- Bumped plugin metadata from 0.13.573 to 0.13.574.

= 0.13.573 =

- Tightened mobile Habit tracker grid sizing so all seven days fit inside the widget card without body overflow.
- Bumped plugin metadata from 0.13.572 to 0.13.573.

= 0.13.572 =

- Added a native Habit tracker visual app widget with editable Elementor repeater controls, progress, streak, reset, and click-to-toggle cells.
- Rebuilt Announcement bar Elementor insertion as structured native Elementor containers/widgets instead of flattened text fallback.
- Improved native template visual QA for image/team fallback backgrounds and pricing status spacing.
- Bumped plugin metadata from 0.13.571 to 0.13.572.

= 0.13.571 =

- Routed Visual App template insertion through Niwa custom Elementor widgets instead of raw Elementor HTML blocks.
- Added native Product finder and Quote calculator Elementor widget rendering, controls, frontend CSS, and interaction scripts.
- Converted template Elementor fallback normalization so LLM or local fallback HTML widgets become editable native Elementor output.
- Bumped plugin metadata from 0.13.570 to 0.13.571.

= 0.13.570 =

- Added a clean cronmaster port of the Elementor reference URL builder so Niwa can rebuild supported public reference pages as editable native Elementor containers and widgets.
- Added the Angie-style reference blueprint, native Elementor renderer, URL build admin tool, and local Niwa-owned reference mockup assets without pulling unrelated dirty template-library changes.
- Bumped plugin metadata from 0.13.569 to 0.13.570.

= 0.13.569 =

- Normalized remaining first-party mixed line endings after the cronmaster merge.
- Bumped plugin metadata from 0.13.568 to 0.13.569.

= 0.13.568 =

- Merged the source branch release line into cronmaster while preserving Template Library and native Elementor template widget work.
- Kept silent Freemius bootstrap handling, order attribution inspection tooling, and current frontend greeting defaults.
- Bumped plugin metadata from 0.13.567 to 0.13.568.

= 0.13.558 =

- Reworked Template Library cards into agent-native template manifests with agent prompts, Elementor schema, and reusable build metadata.
- Added LLM-backed template artifact generation before safe local fallback.
- Added rollback-safe Elementor insertion from template cards through the existing page-data flow.
- Bumped plugin metadata from 0.13.557 to 0.13.558.

= 0.13.557 =

- Added responsive horizontal gutters to Niwa admin screens so full-width pages do not pin content to the wp-admin edges.
- Centered the Template Library content inside a wide inner layout while keeping the full-width builder-style background.
- Bumped plugin metadata from 0.13.556 to 0.13.557.

= 0.13.556 =

- Removed the global 960px Niwa admin wrapper limit so all Niwa settings screens can use the full wp-admin content width.
- Bumped plugin metadata from 0.13.555 to 0.13.556.

= 0.13.555 =

- Expanded the Template Library and Code Snippets admin screens beyond the standard Niwa settings width so the gallery behaves like a full-width builder surface.
- Bumped plugin metadata from 0.13.554 to 0.13.555.

= 0.13.554 =

- Added a local Template Library and Code Snippets admin experience with seeded Elementor/widget/admin/website/visual-app cards and preview assets.
- Added generated snippet storage, validation, shortcode fallback runtime, Elementor snippet wrapper category/widget, REST endpoints, and admin-autonomy tools for chat/Telegram/WhatsApp template work.
- Bumped plugin metadata from 0.13.553 to 0.13.554.

= 0.13.553 =

- Added retry/confirmation handling for cron unschedule races so transient WordPress cron-option save failures do not leave the background runner in a failed tick.
- Bumped plugin metadata from 0.13.552 to 0.13.553.

= 0.13.552 =

- Added a short-process background chain supervisor so hosted sites keep running Niwa background ticks without relying on one long-lived PHP process.
- Bumped plugin metadata from 0.13.551 to 0.13.552.

= 0.13.551 =

- Added idempotent cron maintenance for Niwa recurring hooks and failed-unschedule protection for Telegram polling.
- Added a server-side background runner entrypoint for reliable due-job processing outside page traffic.
- Changed IMAP inbound email wakeups to use the background runtime instead of rescheduling Telegram polling.
- Bumped plugin metadata from 0.13.550 to 0.13.551.

= 0.13.550 =

- Added precise Elementor settings patching, element duplication with regenerated subtree IDs, and active kit settings updates through the existing Niwa preview/execute rollback flow.
- Added rollback support for Elementor kit settings and empty previous widget settings.
- Bumped plugin metadata from 0.13.549 to 0.13.550.

= 0.13.548 =

- Added a Product Cards catalog mode switch for WooCommerce catalog-only sites.
- In catalog mode, product cards show View Details links instead of Buy Now, Options, or Add to Cart actions.
- Rebuilt frontend assets and bumped plugin metadata from 0.13.547 to 0.13.548.

= 0.13.547 =

- Added a public frontend chat nonce refresh endpoint for cached guest pages and wired the chat client to retry once after stale nonce responses.
- Kept nonce validation active while updating the retry path to preserve request_id idempotency and avoid duplicate LLM turns.
- Rebuilt the frontend chat bundle and bumped plugin metadata from 0.13.546 to 0.13.547.

= 0.13.546 =

- Refactored frontend chat context, response cleanup, product-card selection, and sales-assistant guidance into focused helper classes.
- Removed the hidden NO_SEARCH_NEEDED prompt contract while keeping safety-net cleanup for old/cached marker leaks.
- Added frontend request_id idempotency and queue context preservation to prevent duplicate LLM turns and lost page/cart/email context.
- Bumped plugin metadata from 0.13.545 to 0.13.546.

= 0.13.545 =

- Reset stale cart-mode Conversion Busters offers when the shopper removes cart items below the configured eligibility threshold, pruning the pending discount prompt from frontend/server chat history so normal chat resumes.
- Added cart-eligibility failure reasons to coupon creation responses and kept OS3 CB Mini independent from cart-count cancellation.
- Bumped plugin metadata from 0.13.544 to 0.13.545.

= 0.13.544 =

- Added a clone-specific parent matrix finalizer that runs Woo/shared sync first and then re-applies slug-authoritative source attributes before verification.
- Bumped plugin metadata from 0.13.543 to 0.13.544.

= 0.13.543 =

- Re-applied source-derived parent attributes after variation recreation so the final Woo matrix is rebuilt from child slugs immediately before parent sync and verification.
- Bumped plugin metadata from 0.13.542 to 0.13.543.

= 0.13.542 =

- Switched partner clone attribute term assignment from append to replace semantics so stale parent term relationships cannot survive a clone/write pass.
- Bumped plugin metadata from 0.13.541 to 0.13.542.

= 0.13.541 =

- Made Woo term creation slug-authoritative during partner cloning so clean display labels cannot accidentally remap a child variation slug to another term with the same name.
- Bumped plugin metadata from 0.13.540 to 0.13.541.

= 0.13.540 =

- Reconciled variation parent attribute options from child variation slugs when available, keeping source option lists only as wildcard fallbacks, and added matrix verification for parent/child slug mismatches.
- Bumped plugin metadata from 0.13.539 to 0.13.540.

= 0.13.539 =

- Hardened LLM/browser variant label payload handling so nested per-variant labels resolve to clean frontend term names instead of array-cast strings.
- Bumped plugin metadata from 0.13.538 to 0.13.539.

= 0.13.538 =

- Added LLM/browser dynamic variant manifest support for partner product cloning, including per-variant gallery evidence, signature-based manifest matching, and clean frontend attribute term labels while preserving stable Woo slugs.
- Bumped plugin metadata from 0.13.537 to 0.13.538.

= 0.13.537 =

- Wrote enriched variation media manifests to WooCommerce child variation gallery metadata, so verification requires the imported per-color full gallery rather than the one-image source child payload.
- Bumped plugin metadata from 0.13.536 to 0.13.537.

= 0.13.536 =

- Imported full-size partner gallery/lightbox images before thumbnail derivatives, enriched variation galleries by product-image family, and rendered imported variation galleries on partial color selection for wildcard-size products.
- Bumped plugin metadata from 0.13.535 to 0.13.536.

= 0.13.535 =

- Scoped partner product variation select extraction to the primary WooCommerce variation form, preventing related/recommended product selectors on Grubin pages from polluting the cloned parent attribute options.
- Bumped plugin metadata from 0.13.534 to 0.13.535.

= 0.13.534 =

- Restricted the frontend variation gallery fallback to true multi-image variation galleries, so single-image variations keep WooCommerce/theme gallery behavior instead of replacing the full product gallery with one image.
- Bumped plugin metadata from 0.13.533 to 0.13.534.

= 0.13.533 =

- Allowed create-new partner product clone tests and imports to use an explicit final `target_sku`, avoiding duplicate source SKU collisions when the destination catalog already contains the same partner SKU.
- Bumped plugin metadata from 0.13.532 to 0.13.533.

= 0.13.532 =

- Rebuilt partner product media cloning around modular image-context, static variant parser, normalized variant-media, and frontend variation-gallery classes instead of expanding the cloner as a monolith.
- Partner clone extraction now carries variation-specific galleries from Woo variation payloads and compatible embedded non-Woo variant JSON, while rejecting related products, trust badges, logos, promotional images, and other non-product page media.
- Clone verification now checks stored variation gallery metadata in addition to the variable matrix, and product pages can expose copied variation galleries through Woo variation JSON plus a small frontend gallery fallback.
- Bumped plugin metadata from 0.13.531 to 0.13.532.

= 0.13.531 =

- Partner product cloning now keeps DOM image fallback limited to real product/gallery images.
- Related products, recommended products, trust badges, logos, payment graphics, and other page chrome images are filtered out before gallery import.
- Bumped plugin metadata from 0.13.530 to 0.13.531.

= 0.13.530 =

- Added modular Traffic Analysis with sitewide lightweight collection, UTM/click-id/referrer attribution, sessions, touchpoints, conversions, and daily rollups.
- Added a standalone minified traffic collector that uses sendBeacon/fetch batching and does not depend on the frontend chat widget.
- Added WooCommerce order attribution, Analytics Dashboard traffic cards, and `metrics_snapshot` traffic/campaign attribution for daily, weekly, and 30-day founder questions.
- Bumped plugin metadata from 0.13.529 to 0.13.530.

= 0.13.529 =

- Preserve WooCommerce wildcard variation attributes such as any size when cloning partner variable products.
- Validate and reconcile the parent/child variation matrix after clone and attribute writes, including duplicate semantic attributes.
- Expose wildcard attributes in variation lookup so Niwa can reason about any-option variations.
- Bumped plugin metadata from 0.13.528 to 0.13.529.

= 0.13.528 =

- Frontend agent can now take the visitor to checkout, cart, or any other site page on request via the new navigate_to_page tool.
- Only same-site URLs are allowed for agent navigation; external URLs are rejected server-side and client-side.
- Bumped plugin metadata from 0.13.527 to 0.13.528.

= 0.13.527 =

- Make soft-deadline continuation visible to founder channels instead of returning an empty reply.
- Wake the actor runtime immediately after saving a soft-deadline continuation.
- Requeue the original actor message if both continuation checkpoint and fallback enqueue fail.
- Bumped plugin metadata from 0.13.526 to 0.13.527.

= 0.13.526 =

- Prevent stale product _za_noindex metadata from hiding active in-stock WooCommerce products from Niwa frontend retrieval.
- Clear stale product _za_noindex metadata during Niwa product sync before reindexing active products.
- Dedupe product search results after chunk merges so one WooCommerce product cannot appear multiple times in frontend tool context.
- Treat bare numeric product write queries as catalog/article references before exact Woo IDs or SKUs.
- Bumped plugin metadata from 0.13.525 to 0.13.526.

= 0.13.499 =

- Rotated the WhatsApp gateway supervisor before shared-host runtime limits can reap long-lived shell and Node processes.
- Recovered stale WhatsApp `stopping` status when no explicit supervisor stop request remains.
- Bumped plugin metadata from 0.13.498 to 0.13.499.

= 0.13.498 =

- Fixed WhatsApp short-text batch delivery on NiwaChat by flushing WhatsApp batches inside the shared runner before actor processing instead of relying on overdue WP-Cron only.
- Made the buffered runner wait for the WhatsApp quiet window before flushing so short fragments are batched without getting stuck.
- Bumped plugin metadata from 0.13.497 to 0.13.498.

= 0.13.497 =

- Fixed the buffered runner crash on NiwaChat by replacing the stale debounce constant reference with the existing text-fragment timing constant.
- Added a regression guard for the buffered runner constant reference.
- Bumped plugin metadata from 0.13.496 to 0.13.497.

= 0.13.496 =

- Added explicit WhatsApp group access lists for admin, stock-manager, and lead roles.
- Reworked the WhatsApp gateway so explicitly allowed groups can reach WordPress only when the message addresses Niwa by slash command, structured callback, mention, or reply.
- Cleaned WhatsApp outbound routing so group replies keep the group JID, and whitelisted the AJAX connect/disconnect settings path.
- Bumped plugin metadata from 0.13.495 to 0.13.496.

= 0.13.495 =

- Whitelisted the persisted WhatsApp settings shape so stale owner/unknown-lead/legacy runtime keys are physically removed instead of being carried forward by `wp_parse_args`.
- Synced the gateway access-policy file immediately after WhatsApp settings cleanup so Node reads the same cleaned role contract as WordPress.
- Bumped plugin metadata from 0.13.494 to 0.13.495.

= 0.13.494 =
- Hardened WhatsApp access-list writes so lead outreach fails hard when the gateway policy file cannot be synced.
- Prevented admin/stock-manager WhatsApp numbers and privileged wildcards from being silently treated as lead/public access.
- Cleaned the shared incoming-message handler callback contract and centralized ignored WhatsApp conversation JIDs with voice-note and native outbound media handling.
- Bumped plugin metadata from 0.13.493 to 0.13.494.

= 0.13.493 =
- Added Hermes-style WhatsApp event metadata aliases, quoted-message context, mentions, bot IDs, and media alias fields to the Niwa gateway payload.
- Added a Baileys outbound send timeout in the WhatsApp gateway so stuck sends fail fast instead of pinning the outbox loop.
- Bumped plugin metadata from 0.13.492 to 0.13.493.

= 0.13.492 =
- Removed the legacy WhatsApp unknown-lead fallback from gateway, settings, tool schema, and runtime prompts; public WhatsApp lead access is now explicit through `*` in the lead access list.
- Added WhatsApp short-text batching and structured callback command propagation so rapid fragments are combined while slash/button commands and media stay immediate.
- Bumped plugin metadata from 0.13.491 to 0.13.492.

= 0.13.491 =
- Removed tracked admin-autonomy .bak-* backup PHP files from the repository and production package so stale runtime code is not shipped inside includes/.
- Bumped plugin metadata from 0.13.490 to 0.13.491.

= 0.13.490 =
- Normalized the WhatsApp gateway supervisor shell script to LF line endings so the production Hostinger runtime can restart the Node gateway under /bin/sh.
- Bumped plugin metadata from 0.13.489 to 0.13.490.

= 0.13.489 =
- Cleaned the WhatsApp runtime path: channel-neutral actor intake/handler, no inline actor runtime from the webhook, no PHP option duplicate layer, no keyword fallback, and no passive contact/order/form lead grants.
- Added centralized WhatsApp identity/access-policy helpers plus bridge-side phone/LID alias mapping, route metadata preservation, and access-policy file enforcement before Node posts inbound messages to WordPress.
- Bumped plugin metadata from 0.13.488 to 0.13.489.

= 0.13.488 =
- Removed already queued duplicate founder-message entries at actor claim time so only the first copy can enter runtime, typing, and LLM output.
- Bumped plugin metadata from 0.13.487 to 0.13.488.

= 0.13.487 =
- Hardened actor queue dedupe so completed WhatsApp founder messages remove stale pending duplicates and are skipped during claim or orphan recovery.
- Bumped plugin metadata from 0.13.486 to 0.13.487.

= 0.13.486 =
- Extended the WhatsApp gateway webhook timeout to match inline actor runtime processing.
- Bumped plugin metadata from 0.13.485 to 0.13.486.

= 0.13.485 =
- Added a WhatsApp gateway supervisor so Node gateway exits are restarted without waiting for WordPress traffic.
- Preserved gateway launcher stderr/history and added fatal Node exception/rejection logging for post-crash diagnosis.
- Bumped plugin metadata from 0.13.484 to 0.13.485.

= 0.13.484 =
- Prioritized pending and active actor sessions before idle actor state files so WhatsApp, Telegram, mail, stock-manager, lead, and admin-panel messages are not hidden behind stale empty sessions.
- Bumped plugin metadata from 0.13.483 to 0.13.484.

= 0.13.483 =
- Kept WhatsApp webhook processing on the inline actor runtime path after queueing inbound messages and stopped the separate webhook runner wake path from racing the same payload.
- Bumped plugin metadata from 0.13.480 to 0.13.483.

= 0.13.480 =
- Split Elementor core skills into WP-CLI/proc_open and Niwa-native no-shell workflows, with native full Elementor data read/write tools.
- Bumped plugin metadata from 0.13.479 to 0.13.480.

= 0.13.479 =
- Added WhatsApp lead outreach capture and sending foundations for saved contacts, WooCommerce buyers, and structured form submissions.
- Bumped plugin metadata from 0.13.478 to 0.13.479.

= 0.13.478 =
- Bundled the Elementor WP-CLI Editing skill as a core Niwa autonomy skill for new plugin installs.
- Bumped plugin metadata from 0.13.477 to 0.13.478.

= 0.13.477 =
- Fixed admin-autonomy temp-file creation in Telegram/WhatsApp runtime contexts where WordPress file helpers are not preloaded.
- Bumped plugin metadata from 0.13.476 to 0.13.477.

= 0.13.476 =

- Routed morning reports through the main founder actor runtime instead of a separate direct AI/send session.
- Remembered the last authorized admin Telegram/WhatsApp channel and queued morning reports back to that channel without falling back to wp-admin dashboard delivery.
- Made scheduled brief language selection prefer the last admin message text over the synthetic morning-report prompt.
- Bumped plugin metadata from 0.13.475 to 0.13.476.

= 0.13.475 =

- Forced Telegram and WhatsApp webhook endpoint builders to publish HTTPS URLs even when WordPress home/siteurl is stored as HTTP.
- Bumped plugin metadata from 0.13.474 to 0.13.475.

= 0.13.474 =

- Reduced the companion engagement task prompt to a minimal relationship-context check-in instruction and JSON contract.
- Bumped plugin metadata from 0.13.473 to 0.13.474.

= 0.13.473 =

- Reworked companion engagement prompts to use relationship memory, genuine care, and natural check-ins instead of forced founder interview questions.
- Added regression coverage that prevents the old forced-question engagement prompt from returning.
- Bumped plugin metadata from 0.13.472 to 0.13.473.

= 0.13.472 =

- Added the bundled self-extension skill for admin autonomy learning, skill imports, and feedback-driven workflow patches.
- Made skill_import accept ZIP archive_base64 payloads and preserve allowed references, scripts, assets, and README documentation.
- Bumped plugin metadata from 0.13.471 to 0.13.472.

= 0.13.471 =

- Stopped the WhatsApp gateway from auto-claiming arbitrary linked-device `fromMe` chats as the founder control chat; only the self chat or an explicitly stored linked-control chat can now pass that path.
- Wired the WhatsApp access-list settings trait into the admin runtime chat facade so `manage_whatsapp_access_numbers` has a real executor implementation.
- Added static regression markers for the linked-control gateway behavior and the settings tool executor wiring.
- Bumped plugin metadata from `0.13.470` to `0.13.471`.

= 0.13.470 =

- Cached the admin runtime tool registry and tool map per request so tool discovery, loading, and hydration reuse the same computed surface.
- Removed obsolete per-turn `tool_search` result persistence from session state and transcripts; `tool_load` now relies on exact names in the live runtime registry.
- Switched admin-autonomy runtime tracing to light/full event levels so normal runs keep high-value visibility while noisy per-tool payloads are skipped unless full trace is explicitly requested.
- Updated static harness tests to lock the simplified registry-based loading path and prevent the stale search-result state from returning.
- Bumped plugin metadata from `0.13.469` to `0.13.470`.

= 0.13.469 =

- Fixed Telegram/admin runtime tool loading by propagating the session turn ID before runtime policy and tool callbacks are built.
- Simplified tool loading so exact registry tool names can be activated directly; tool_search is now discovery/observability, not a blocking allowlist.
- Bumped plugin metadata from `0.13.468` to `0.13.469`.

= 0.13.468 =

- Removed the remaining prompt-routing signal builder and lowercase query normalization from admin runtime tool choice.
- Removed stale direct-proxy tool result fields and routed execution-contract write detection through the runtime bridge when available.
- Bumped plugin metadata from `0.13.467` to `0.13.468`.

= 0.13.467 =

- Removed the pre-LLM action prompt normalizer, intent classifier, and direct runtime proxy router from founder admin turns.
- Simplified founder admin runtime to an agentic tool harness: core tools stay visible, the model searches and loads non-core tools per turn, and stale task/read-only intent hints no longer shape the run.
- Bumped plugin metadata from `0.13.466` to `0.13.467`.

= 0.13.466 =

- Routed structured partner product imports through the clone owner tool instead of the direct runtime coding shell path.
- Enforced direct connector semantics against the same catalog shown to the model.
- Bumped plugin metadata from `0.13.465` to `0.13.466`.

= 0.13.465 =

- Cleared dead local CLI runner state before it can block a fresh runner request.
- Bumped plugin metadata from `0.13.464` to `0.13.465`.

= 0.13.464 =

- Added a dedicated admin-autonomy runtime trace log for Telegram, actor, turn-policy, tool-call, and delivery events.
- Disabled reliance on global WordPress debug.log for Niwa runtime visibility.
- Bumped plugin metadata from `0.13.463` to `0.13.464`.

= 0.13.453 =

- Moved Telegram/admin-autonomy runtime restarts out of settings save requests and into a single asynchronous WP-Cron restart queue.
- Removed the duplicate settings-page `admin_init` restart handler so `options.php` only sanitizes and persists settings.
- Guarded polling runtime restart failures so Telegram/webhook issues are logged instead of producing HTTP 500 during admin saves.
- Bumped plugin metadata from `0.13.452` to `0.13.453`.

= 0.13.452 =

- Reserved Telegram update IDs before actor enqueue so webhook retries cannot queue the same founder message multiple times.
- Added Telegram channel identity to extracted payloads so actor dedupe keys are channel-specific instead of `unknown`.
- Bumped plugin metadata from `0.13.451` to `0.13.452`.

= 0.13.451 =

- Fixed cross-channel duplicate sends by remembering recently completed founder inbound identities before actor re-enqueue can create a second turn.
- Preserved original inbound update/message/raw IDs in actor contexts so admin delivery idempotency survives retries and continuations.
- Bumped plugin metadata from `0.13.450` to `0.13.451`.

= 0.13.450 =

- Added idempotency protection for admin delivery routing so repeated identical tool calls in one incoming turn send only one transport message.
- Clarified that quoted repeated text such as `puno puno puno` is the message body, not an instruction to send multiple copies.
- Bumped plugin metadata from `0.13.449` to `0.13.450`.

= 0.13.449 =

- Added native admin delivery routing tools so founder tasks can inspect available Telegram, WhatsApp, origin, and email targets before sending cross-channel notifications.
- Routed the WhatsApp alias to the preferred external admin WhatsApp number instead of the connected/self account when one is configured.
- Added admin-only guardrails, masked target discovery, short origin ACK guidance, and regression coverage for the cross-channel delivery flow.
- Bumped plugin metadata from `0.13.448` to `0.13.449`.

= 0.13.448 =

- Relaxed proactive heartbeat message length so useful updates can use up to 400 words while remaining concrete and non-repetitive.
- Kept the duplicate workspace heartbeat lock from the previous release.
- Bumped plugin metadata from `0.13.447` to `0.13.448`.

= 0.13.447 =

- Added a workspace heartbeat lock so concurrent cron runners cannot send the same heartbeat window twice.
- Shortened proactive and companion heartbeat Telegram messages with stricter prompt limits and final message truncation.
- Bumped plugin metadata from `0.13.446` to `0.13.447`.

= 0.13.446 =

- Added a WhatsApp gateway watchdog so enabled sites periodically self-heal a dead or stalled gateway without requiring a manual Connect click.
- Treated a live gateway process stuck too long in startup/reconnect states as stalled and restarted only that gateway process.
- Tightened gateway PID validation so stale/reused PIDs are not mistaken for a healthy WhatsApp process.
- Bumped plugin metadata from `0.13.445` to `0.13.446`.

= 0.13.445 =

- Added native explicit Hostinger mailbox setup for founder-provided SMTP/IMAP credentials instead of routing routine email settings through code-edit tools.
- Forced mailbox setup prompts with an email/login/password into the inbound email setup task path.
- Updated the native IMAP setup tool schema and instructions so Niwa can configure and test explicit mailbox credentials without echoing secrets back.
- Bumped plugin metadata from `0.13.444` to `0.13.445`.

= 0.13.444 =

- Restored WhatsApp typing state and gateway behavior to the `0.13.441` lifecycle after the `0.13.442` token/cooldown change could keep runner state unstable.
- Removed the `0.13.443` gateway replay, outbox ordering, and forced paused-presence changes instead of stacking more guards.
- Kept only the narrow fix that final `turn_ended` progress events do not refresh typing after the assistant answer has been produced.
- Bumped plugin metadata from `0.13.443` to `0.13.444`.

= 0.13.443 =

- Sent an explicit WhatsApp `paused` presence update when typing feedback ends and immediately after each gateway-sent WhatsApp message.
- Processed WhatsApp outbox files in filesystem timestamp order so queued reply and presence updates are delivered in the intended sequence.
- Ignored non-live WhatsApp history/replay message batches and stale gateway-startup messages so reconnects do not answer old inputs again.
- Bumped plugin metadata from `0.13.442` to `0.13.443`.

= 0.13.442 =

- Stopped WhatsApp typing feedback from being refreshed after the assistant turn has already ended.
- Invalidated the typing runner token on turn completion and added a short post-end guard so delayed post-reply processing cannot restart the indicator.
- Bumped plugin metadata from `0.13.441` to `0.13.442`.

= 0.13.441 =

- Delayed companion engagement prompts for two days after a new plugin activation so fresh installs do not proactively message immediately.
- Kept existing installs without an install timestamp unaffected, while fresh installs record the activation time.
- Tightened the companion engagement prompt so the message must be freshly invented from context, not canned or template text.
- Bumped plugin metadata from `0.13.440` to `0.13.441`.

= 0.13.440 =

- Classified OpenAI `insufficient_quota` failures as non-retryable billing errors so WhatsApp lead turns do not burn time on repeated stream retries.
- Added a WhatsApp lead/stock-manager fallback reply when the model provider cannot produce a response, preventing silent customer chats during provider failures.
- Bumped plugin metadata from `0.13.439` to `0.13.440`.

= 0.13.439 =

- Deferred the first automatic morning report for fresh Telegram/admin-autonomy setups so it waits for the next scheduled daily window instead of sending immediately after install/connect.
- Added regression coverage for the empty report-state path.

= 0.13.438 =

- Enabled the proactive admin-autonomy workspace heartbeat and companion engagement defaults for fresh installs.
- Added Personal Assistant settings toggles to disable proactive heartbeat and companion engagement when needed.
- Bumped plugin metadata from `0.13.437` to `0.13.438`.

= 0.13.437 =

- Gave WhatsApp lead/customer-support sessions the same frontend ecommerce sales-agent guidance, search discipline, response style, and customer-facing link rules used by the website chat.
- Kept WhatsApp lead sessions scoped to customer support tools only, without admin/private runtime access.
- Bumped plugin metadata from `0.13.436` to `0.13.437`.

= 0.13.436 =
* Isolated WhatsApp lead and stock-manager sessions from the founder Telegram session and added runner recovery for stuck local model calls.

= 0.13.435 =
* Added a WhatsApp setting that lets unlisted contacts chat with Niwa as lead/customer-support users without admin tools.

= 0.13.434 =
* Fixed WhatsApp webhook delivery behind HTTP-to-HTTPS redirects so inbound WhatsApp messages reach WordPress instead of failing with HTTP 301.

= 0.13.433 =
* Added WhatsApp gateway secret self-healing so webhook `403` mismatches recover without manual SSH gateway restart.

= 0.13.432 =
* Fixed WhatsApp connect/disconnect admin controls so the UI changes on the first click and keeps polling until the gateway reaches the new state.

= 0.13.431 =
* Automatically adds the scanned WhatsApp linked-device account to the WhatsApp admin allowlist even when other admin numbers already exist.

= 0.13.430 =
* Fixed WhatsApp LID inbound identity handling so allowlisted phone numbers match incoming chats even when WhatsApp routes the chat by LID.

= 0.13.429 =
* Reworked WhatsApp access-number settings into Niwa-styled repeater groups and added auto-restart handling for stale WhatsApp gateway processes.

= 0.13.428 =
* Added WhatsApp admin, stock-manager, and lead access-number lists, including manual admin settings and a native Niwa tool for adding or removing numbers from chat.

= 0.13.427 =
* Added e-commerce sales assistant guidance to the frontend system prompt so Niwa diagnoses needs, explains value, handles hesitation, and guides shoppers toward the next useful step.

= 0.13.426 =
* Claimed the scanned WhatsApp linked device as the owner after QR pairing and fixed device-suffixed WhatsApp JID normalization.

= 0.13.425 =
* Removed obsolete JavaScript test/dev dependency packaging and let the WhatsApp gateway install only production Node dependencies on the server when missing.

= 0.13.424 =
* Fixed WhatsApp gateway status to fall back to the PID file during startup and report missing Node dependencies explicitly.

= 0.13.423 =
* Added server-side WhatsApp inbound idempotency by raw message ID so duplicate gateway deliveries cannot enqueue two actor replies.

= 0.13.422 =
* Subscribed to WhatsApp chat presence before sending typing indicators and logged gateway presence sends.

= 0.13.421 =
* Routed WhatsApp founder messages through the configured Telegram founder session and added WhatsApp typing presence/read receipts.

= 0.13.420 =
* Sent WhatsApp replies to the exact inbound chat JID so linked-device chats receive Niwa answers reliably.

= 0.13.419 =
* Ignored empty WhatsApp upsert placeholders and deduplicated final inbound message IDs.

= 0.13.418 =
* Cleared stale runner locks when WhatsApp actor messages are pending but the spawned local runner never reports liveness.

= 0.13.417 =
* Added a persistent WhatsApp linked-device control chat so founder messages sent from the paired account can reach Niwa without opening all outgoing chats.

= 0.13.416 =
* Refined WhatsApp linked-device intake to accept only the self/control chat and prevent duplicate outbox loops.

= 0.13.415 =
* Ignored only WhatsApp messages sent by the gateway itself, while allowing founder messages from linked devices.

= 0.13.414 =
* Ignored WhatsApp messages sent by Niwa itself so outbound replies cannot re-enter the founder queue.

= 0.13.413 =
* Preserved WhatsApp channel metadata through queued actor turns so replies are delivered back through WhatsApp.
* Hid stale WhatsApp disconnect markers after the gateway is connected.

= 0.13.170 =
* Deduplicated repeated wp-admin chat prompts in server display history and frontend admin rendering.
* Suppressed continuation placeholders from wp-admin chat display history.

= 0.13.169 =
* Fixed wp-admin chat reopen behavior so closing and reopening returns to the latest messages instead of an old history scroll position.
* Reused the shared frontend typing indicator CSS for wp-admin chat Thinking state.

= 0.13.168 =
* Preloaded wp-admin chat history on page load so opening the chathead shows already-fetched history immediately.
* Tightened admin chat scroll restore and server echo dedupe for optimistic messages.

= 0.13.167 =
* Fixed wp-admin chat date separators so Today/Yesterday remain inline in message history instead of sticking to the top while scrolling.

= 0.13.166 =
* Reworked the wp-admin Personal Assistant chat runtime into a dedicated lightweight admin chat bundle with cursor pagination and stable scroll behavior.

= 0.13.165 =
* Removed legacy niwacode runtime event logging and disabled Turn Debug runtime sinks so NIWA no longer writes step-by-step diagnostic spam during normal operation.
* Removed verbose MCP/Auth/Spark/WP-settings success and retry logs, keeping only real failure/exception logging.

= 0.13.164 =
* Aligned NIWA's humanizer with OpenClaw ai-humanizer v2.1.0 safe-autofix behavior and applied no-em-dash cleanup to Telegram and frontend/founder agent output.

= 0.13.136 =
* Made main_coding_file_edit a first-class core coding tool, updated runtime guidance to prefer it over shell edits, and suppressed raw workspace-apply terminal status messages in Telegram chats.

= 0.13.135 =
* Added static PHPUnit regression coverage for main_coding_file_edit registration, dispatch, workspace path validation, size/LOCK_EX guards, line-ending preservation, manifest metadata, and OS context in main/subagent prompts.

= 0.13.65 =
* Made code-worker stale recovery apply to any stalled model_request, not only pre-tool requests, so post-tool SSE/model stalls are marked failed and the parent can recover.

= 0.13.64 =
* Added native debug_log_append_line for safe single-line debug.log appends and relaxed the debug.log coding-task guard so append requests no longer become false self-extension gaps.

= 0.13.63 =
* Added a read-only code_scan_run planning helper so the founder runtime can inspect code with rg/grep/find.

= 0.12.13-dev =
* Fixed Telegram product image updates when the agent uses an exact product ID and when the image was sent in the previous Telegram message.

= 0.12.12-dev =
* Fixed Lead Form Generator progress so the loading bar follows the active branch route instead of every question in the form.

= 0.12.11-dev =
* Fixed Lead Form Generator continuation after conditional and smart branching so inactive alternative branch questions are skipped.

= 0.12.10-dev =
* Fixed Lead Form Builder branching mode cards so only one "What happens after this question?" option can be active per question.

= 0.12.9-dev =
* Fixed mobile fullscreen width by overriding the collapsed max-width cap when fullscreen is active.

= 0.12.8-dev =
* Separated mobile fullscreen viewport sizing from non-fullscreen pixel sizing so fullscreen uses 100vw x 100vh and saved pixel dimensions remain editable.

= 0.12.7-dev =
* Fixed mobile fullscreen so wider phone-sized viewports still open the chat fullscreen instead of falling back to tablet flyout dimensions.

= 0.11.37 =
* Added the Conversion Busters Code Email Hunt module to Lead Capture settings.
* Forced CB and CB mini positive replies to capture email before generating hunted coupon codes.
* Sent generated CB coupons by email and scheduled unused-code reminders after 80% of coupon lifetime.

= 0.11.36 =
* Stopped Niwa agent cart refreshes from emitting checkout incentive add-to-cart events.
* Removed broad cart-count text rewriting that could overwrite free-shipping text in the mini cart.

= 0.11.35 =
* Moved add-to-cart product resolution back to LLM reasoning over search results and current-message descriptors.
* Removed over-specific gram ambiguity handling while keeping backend mismatch protection as a safety net.

= 0.11.34 =
* Returned agent cart results in frontend AJAX responses so mini-cart refresh logic can actually run.
* Strengthened mini-cart refresh after Niwa agent cart adds with Woo fragment events, delayed refresh, and direct count badge updates.
* Prevented generic pack-family requests from inheriting stale gram choices from chat history.

= 0.11.33 =
* Prevented wrong product pack adds when the customer explicitly asks for another gram size, such as 150g.
* Improved short follow-up context so replies like "kako" use the previous Niwa offer instead of asking for clarification.

= 0.11.32 =
* Fixed mini cart refresh after Niwa agent cart adds by adding a silent Woo fragment refresh fallback.
* Made frontend fragment application detect when no theme selector was actually replaced.

= 0.11.31 =
* Added a frontend agent cart tool so Niwa can add products directly from chat.
* Added variable product option handling with size/color clarification when required.
* Refreshed WooCommerce mini cart fragments after successful agent cart adds.

= 0.11.26 =
* Fixed mobile chat defaults by replacing the old 100x100 expanded size with usable pixel dimensions and enabling fullscreen on mobile by default.
* Corrected the Expanded Chat Size admin copy so width and height are described as pixel values.

= 0.8.1 =
* Refined dark mode chat glassmorphism: agent-side bubbles, selector panels, and near-white text now use a smoked glass background, stronger backdrop blur, and a subtle translucent edge.

= 0.7.13 =
* Increased frontend chat AJAX timeout so Codex OAuth requests are not aborted by the browser before the longer server-side Codex response finishes.

= 0.7.12 =
* Increased Codex OAuth chat timeout budget and raised AJAX execution time so buffered Codex SSE responses do not fail at the old 45-second limit.

= 0.7.11 =
* Fixed Codex OAuth chat transport by sending `stream=true` to the Codex Responses backend and parsing buffered SSE responses on the WordPress side.

= 0.7.10 =
* Added Codex OAuth request logging to help diagnose frontend chat failures when OAuth transport returns hidden HTTP/model errors.
* Improved Codex Responses text extraction to support top-level `output_text` blocks returned by some Responses payloads.

= 0.7.9 =
* Fixed Leave Stoper opening flow so it now opens the chat window correctly in Centerstage mode and standard launcher mode before injecting the message.

= 0.7.8 =
* Fixed shared `niwa_ai_settings` save flow so General and UI Settings forms no longer overwrite or drop each other's values.
* Fixed UI Settings persistence for Leave Stoper, Centerstage Mode, launcher positions, and related widget controls.

= 0.1.4 =
* Added index noise filter to remove theme/demo/footer boilerplate from RLM memory.
* Reduced hallucination risk for non-product categories from template leftovers.

= 0.1.3 =
* Fixed dark header theme selector by applying theme class on #za-flyout container.
* Improved flyout layout stability (flex/min-height) to prevent header/input clipping.
* Improved frontpage extraction depth with Gutenberg block traversal.

= 0.1.2 =
* UI migration to old Niwa style for launcher/flyout/chat proportions.
* Fixed flyout close toggle binding and dark mode selector scope.
* Marker-driven card rendering pipeline fix and strict card policy stability.

= 0.1.1 =
* Packaging stability improvements for manual updates.
* Added safe bootstrap check for missing includes file.

= 0.1.0 =
* Initial starter structure.
