feat: consolidate docs, backend/session infra, and settings updates

This commit is contained in:
Dwindi Ramadhana
2026-05-28 00:58:20 +07:00
parent 2424acf726
commit 44e06eed88
102 changed files with 35423 additions and 11181 deletions

View File

@@ -77,9 +77,63 @@ extract( $view_data );
<form method="post" action="options.php" id="wpaw-settings-form" class="h-100 d-flex flex-column">
<?php settings_fields( 'wp_agentic_writer_settings' ); ?>
<!-- Workflow Pipeline Progress -->
<div class="wpaw-workflow-progress wpaw-workflow-compact mb-4" id="wpaw-workflow-display">
<div class="wpaw-progress-header">
<span class="wpaw-progress-title">Writing Pipeline</span>
<span class="wpaw-progress-status" id="wpaw-workflow-status">Idle</span>
</div>
<div class="wpaw-progress-steps">
<!-- Step 1: Context -->
<div class="wpaw-step" data-step="1" data-tooltip="Context: Load post & keyword">
<div class="wpaw-step-circle">
<span class="wpaw-step-icon">📋</span>
</div>
<span class="wpaw-step-label">Context</span>
</div>
<!-- Connector -->
<div class="wpaw-step-connector" data-connector="1"></div>
<!-- Step 2: Planning -->
<div class="wpaw-step" data-step="2" data-tooltip="Planning: Create outline">
<div class="wpaw-step-circle">
<span class="wpaw-step-icon">📝</span>
</div>
<span class="wpaw-step-label">Planning</span>
</div>
<!-- Connector -->
<div class="wpaw-step-connector" data-connector="2"></div>
<!-- Step 3: Writing -->
<div class="wpaw-step" data-step="3" data-tooltip="Writing: Generate content">
<div class="wpaw-step-circle">
<span class="wpaw-step-icon">✍️</span>
</div>
<span class="wpaw-step-label">Writing</span>
</div>
<!-- Connector -->
<div class="wpaw-step-connector" data-connector="3"></div>
<!-- Step 4: Refinement -->
<div class="wpaw-step" data-step="4" data-tooltip="Refinement: Polish & optimize">
<div class="wpaw-step-circle">
<span class="wpaw-step-icon">🎯</span>
</div>
<span class="wpaw-step-label">Refinement</span>
</div>
<!-- Connector -->
<div class="wpaw-step-connector" data-connector="4"></div>
<!-- Step 5: Done -->
<div class="wpaw-step" data-step="5" data-tooltip="Complete: Ready to publish">
<div class="wpaw-step-circle">
<span class="wpaw-step-icon">✅</span>
</div>
<span class="wpaw-step-label">Done</span>
</div>
</div>
<div class="wpaw-step-message mt-3" id="wpaw-workflow-message" style="display: none;"></div>
</div>
<!-- Scrollable Tab Content Area -->
<div class="wpaw-tab-scroll-area flex-grow-1 p-4 p-md-5 overflow-auto">
<div class="tab-content" id="wpaw-settings-tab-content">
<div class="wpaw-tab-scroll-area flex-grow-1 p-4 p-md-5 overflow-auto">
<div class="tab-content" id="wpaw-settings-tab-content">
<!-- General Tab -->
<div class="tab-pane fade show active" id="general" role="tabpanel" aria-labelledby="general-tab">
<div class="mb-4 pb-3 border-bottom border-dark">

View File

@@ -26,8 +26,26 @@ if ( ! defined( 'ABSPATH' ) ) {
$settings_instance = WP_Agentic_Writer_Settings_V2::get_instance();
$available_languages = $settings_instance->get_available_languages();
$ai_client_available = wpaw_is_wp_ai_client_available();
$ai_capabilities = array();
if ( $ai_client_available ) {
$client = WPAW_WP_AI_Client::get_instance();
$ai_capabilities = $client->get_capabilities();
}
?>
<?php if ( $ai_client_available && $ai_capabilities['text_support'] ) : ?>
<div class="alert alert-info d-flex align-items-start gap-2 mb-4" role="alert">
<i class="bi bi-robot fs-5"></i>
<div>
<strong><?php esc_html_e( 'WordPress 7.0 AI Mode', 'wp-agentic-writer' ); ?></strong>
<p class="mb-0 small">
<?php esc_html_e( 'This site has WordPress 7.0 AI infrastructure. Agentic Writer will use the built-in AI Client for simple tasks (titles, excerpts) and the plugin for advanced features (streaming, block refinement, SEO/GEO).', 'wp-agentic-writer' ); ?>
</p>
</div>
</div>
<?php endif; ?>
<div class="row g-4">
<!-- API Configuration -->
<div class="col-12">

View File

@@ -35,10 +35,10 @@ if ( ! defined( 'ABSPATH' ) ) {
<p class="mb-3">
<?php esc_html_e( 'Download the Local Backend proxy to run on your development machine. This allows unlimited, private AI content generation using your existing Claude CLI setup.', 'wp-agentic-writer' ); ?>
</p>
<a href="<?php echo esc_url( WP_AGENTIC_WRITER_URL . 'downloads/agentic-writer-local-backend.zip' ); ?>"
class="btn btn-primary btn-lg" download>
<a href="https://downloads.wpagentic.dev/wp-agentic-writer/agentic-writer-local-backend.zip"
class="btn btn-primary btn-lg" target="_blank" rel="noopener">
<i class="bi bi-download me-2"></i>
<?php esc_html_e( 'Download Local Backend v1.0.0', 'wp-agentic-writer' ); ?>
<?php esc_html_e( 'Download Local Backend v1.1.0', 'wp-agentic-writer' ); ?>
</a>
<details class="mt-3">
@@ -222,6 +222,91 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
</div>
<!-- Brave Search Configuration -->
<div class="col-12">
<div class="card border-0 border-primary">
<div class="card-header border-bottom-0 pt-3">
<div class="d-flex align-items-center">
<div>
<h5 class="card-title mb-1 d-flex align-items-center gap-2">
<i class="bi bi-search text-primary"></i>
<?php esc_html_e( 'Step 4: Enable Web Search (Optional)', 'wp-agentic-writer' ); ?>
</h5>
<p class="text-muted small mb-0">
<?php esc_html_e( 'Add Brave Search capability to your local backend for real-time web research', 'wp-agentic-writer' ); ?>
</p>
</div>
</div>
</div>
<div class="card-body">
<div class="alert alert-info mb-3">
<i class="bi bi-info-circle me-2"></i>
<strong><?php esc_html_e( 'Requirements:', 'wp-agentic-writer' ); ?></strong>
<?php esc_html_e( 'You need a Brave Search API key (free tier available at', 'wp-agentic-writer' ); ?>
<a href="https://brave.com/search/api/" target="_blank">brave.com/search/api</a>)
</div>
<div class="mb-3">
<label class="form-label fw-semibold">
<?php esc_html_e( '1. Get Brave API Key (if not already configured in General tab)', 'wp-agentic-writer' ); ?>
</label>
<p class="text-muted small">
<?php esc_html_e( 'The API key you configured in Agentic Writer → Settings → General → Search will also be used by the local backend.', 'wp-agentic-writer' ); ?>
</p>
</div>
<div class="mb-3">
<label class="form-label fw-semibold">
<?php esc_html_e( '2. Add API Key to Local Backend Proxy', 'wp-agentic-writer' ); ?>
</label>
<?php
$brave_api_key = $settings['brave_search_api_key'] ?? '';
$masked_key = $brave_api_key ? substr($brave_api_key, 0, 8) . '...' . substr($brave_api_key, -4) : '';
?>
<?php if ( $brave_api_key ) : ?>
<p class="text-muted small mb-2">
<?php esc_html_e( 'Navigate to your extracted folder, then run:', 'wp-agentic-writer' ); ?>
</p>
<div class="d-flex align-items-center gap-2">
<code id="brave-env-command">echo 'BRAVE_SEARCH_API_KEY="<?php echo esc_attr( $brave_api_key ); ?>"' > .env</code>
<button type="button" class="btn btn-sm btn-outline-light" onclick="copyToClipboard(document.getElementById('brave-env-command').textContent)">
<i class="bi bi-clipboard"></i>
</button>
</div>
<?php else : ?>
<div class="alert alert-warning mb-2">
<i class="bi bi-exclamation-triangle me-2"></i>
<?php esc_html_e( 'Brave API key not configured. Add it in Agentic Writer → Settings → General → Search section first.', 'wp-agentic-writer' ); ?>
</div>
<?php endif; ?>
</div>
<div class="mb-3">
<label class="form-label fw-semibold">
<?php esc_html_e( '3. Restart the Proxy', 'wp-agentic-writer' ); ?>
</label>
<div class="d-flex align-items-center gap-2">
<code id="restart-proxy-command">./stop-proxy.sh && ./start-proxy.sh</code>
<button type="button" class="btn btn-sm btn-outline-light" onclick="copyToClipboard(document.getElementById('restart-proxy-command').textContent)">
<i class="bi bi-clipboard"></i>
</button>
</div>
</div>
<div class="alert alert-success">
<i class="bi bi-check-circle me-2"></i>
<strong><?php esc_html_e( 'Verification:', 'wp-agentic-writer' ); ?></strong>
<?php esc_html_e( 'When the proxy starts, you should see "Brave Search: ✅ CONFIGURED" in the output.', 'wp-agentic-writer' ); ?>
</div>
<p class="text-muted small mb-0">
<strong><?php esc_html_e( 'Note:', 'wp-agentic-writer' ); ?></strong>
<?php esc_html_e( 'Also ensure "Search" is enabled in the sidebar settings when using AI features that need web research.', 'wp-agentic-writer' ); ?>
</p>
</div>
</div>
</div>
<!-- Help -->
<div class="col-12">
<div class="card border-0 border-warning">
@@ -266,6 +351,31 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
<script>
function copyToClipboard(text) {
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text).then(function() {
alert('Command copied to clipboard!');
}).catch(function(err) {
console.error('Copy failed:', err);
});
} else {
// Fallback for older browsers
var textarea = document.createElement('textarea');
textarea.value = text;
textarea.style.position = 'fixed';
textarea.style.opacity = '0';
document.body.appendChild(textarea);
textarea.select();
try {
document.execCommand('copy');
alert('Command copied to clipboard!');
} catch (err) {
console.error('Copy failed:', err);
}
document.body.removeChild(textarea);
}
}
jQuery(document).ready(function($) {
$('#test-local-backend').on('click', function() {
const btn = $(this);