Skip to content

🎬 Open-source, self-hosted AI agent that runs a YouTube channel end to end: researches topics, writes scripts, generates narration, visuals and video, optimizes SEO, and publishes after your approval, then learns from analytics. Works with Gemini, OpenAI, OpenRouter, DeepSeek and more.

feat: release v2.10 discoverability preflight

darkzOGx7ea2770f8fa1
diff --git a/.env.example b/.env.example
index 1e635a8..b13af87 100644
--- a/.env.example
+++ b/.env.example
@@ -53,6 +53,12 @@
# FFmpeg (optional override; resolution order: FFMPEG_PATH > bundled ffmpeg-static > system PATH)
# FFMPEG_PATH=
+# DarkzSEO discoverability preflight (optional, advisory)
+# Install DarkzSEO 1.4+ into Python, or point to a sibling/source checkout.
+# DARKZSEO_PYTHON=python
+# DARKZSEO_PATH=../darkzseo/darkzseo.py
+# DARKZSEO_TIMEOUT_MS=30000
+
# Azure Speech TTS (optional alternative)
# AZURE_SPEECH_KEY=your-azure-speech-key-here
# AZURE_SPEECH_REGION=eastus
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7865c30..010c1b6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,11 @@
## Unreleased
+## v2.10.0 — 2026-08-24
+
+- Added a versioned DarkzSEO discoverability preflight over a shell-free Python stdin/stdout adapter, with explicit unavailable and schema-mismatch states
+- Added durable discoverability audits and findings, reviewer keep/dismiss decisions with required false-positive reasons, and review evidence carry-forward across matching audits
+- Added an advisory Review Studio panel and API controls; discoverability findings never rewrite content or block publication in this release
- Added a Controlled Growth Experiments Studio that turns approved-learning title and thumbnail variants into durable post-publication test plans
- Added separate plan approval, live-start confirmation, bounded arm rotation, control restoration, and winner-adoption gates; no experiment can silently adopt a live change
- Added real YouTube evidence samples for each arm using interval deltas for impressions, estimated clicks, CTR, views, watch time, retention, engagement, subscribers, and revenue
@@ -13,6 +18,7 @@
- Added an Outcome & ROI Studio dashboard with target progress, evidence coverage, channel economics, and pillar, format, and provider comparisons
- Added approval-gated outcome-allocation recommendations; pending or rejected recommendations cannot change autonomous planning
- Added `GET /api/outcomes`, structured strategy validation, content-pillar propagation, database migrations, and regression coverage for goal alignment and non-monetized channels
+- Established a platform-targeted audit contract for future TikTok and Instagram/Reels publishing and analytics adapters; those adapters are not included in v2.10.0
## v2.9.0 — 2026-08-23
diff --git a/README.md b/README.md
index 7cb26eb..c024e28 100644
--- a/README.md
+++ b/README.md
@@ -12,23 +12,20 @@ Research topics → write scripts → generate narration and visuals → assembl
## What's new on master
-- **Controlled Growth Experiments Studio:** turn an approved packaging recommendation into a durable control and variant test, rotate only the explicitly approved arms, measure real interval evidence, restore the control, and separately approve an evidence-backed winner.
-- **Outcome & ROI Studio:** align the operator with a measurable KPI, target window, and budget while keeping missing revenue and cost evidence explicit.
+- **v2.10.0 is now on master:** DarkzSEO discoverability audits, controlled growth experiments, and outcome-aware channel operation are available together in the approval-first workflow.
-## What's new in v2.9.0
+## What's new in v2.10.0
-**The agent now listens to your audience.** Until this release the feedback loop was numbers only — click-through, retention, watch time. It said how people watched, never what they wanted. v2.9.0 closes that gap and rounds out the repairable, provider-flexible, multi-format production workflow:
+**AgentTube now has a discoverability adapter layer.** v2.10.0 connects the production pipeline to DarkzSEO without merging the projects or weakening human review, then adds the evidence needed to prove what packaging and strategy actually work:
-- **Audience Engagement Studio (new):** sync real YouTube comments on a tapered schedule, review AI-clustered themes and sentiment, and approve or edit every drafted reply before a single one posts. Likely spam, scams, and toxicity are quarantined for you to see, never acted on automatically.
-- **Your audience writes the roadmap (new):** when three or more commenters ask for the same thing, that becomes a content recommendation carrying the comment permalinks as evidence. Approve it and the Autonomous Channel Operator plans the video that answers it.
-- **Scene-aware retention:** collect YouTube's real 100-point audience-retention curve, map it to the durable production timeline, and review scene-specific drop-off, rewatch, and strong-hold evidence before it can guide future work.
-- **Shorts Repurposing Studio:** turn an approved production into three source-scene-backed 9:16 drafts, choose blurred, cropped, or stacked layouts, render mobile captions locally, and approve each Short on its own schedule.
-- **Scene-level repair:** edit, reorder, lock, replace, or regenerate one scene, then rebuild the final MP4 without discarding the rest of the production.
-- **Narration reliability:** missing, stale, simulated, or failed TTS now blocks assembly, approval, scheduling, and publishing; narration-only recovery and reasoned intentional silence are explicit operator actions.
-- **Multi-provider AI video:** route bounded clips across Seedance, MiniMax H3, Gemini Omni Flash, Kling, and Wan with durable external task IDs, paid-seconds caps, hybrid local assembly, and slideshow fallback.
-- **Research and provenance:** retain exact sources, connect factual claims to reviewer-verified evidence, and carry realistic synthetic-media disclosure into YouTube metadata.
+- **DarkzSEO Discoverability Preflight:** send a canonical content package—not the private dashboard—through versioned GEO, AIO, AEO, and web-search checks after metadata and provenance are assembled.
+- **Reviewable evidence:** persist stable rule IDs, severity, engine/schema identity, fingerprints, and operator decisions in SQLite. Keep a finding actionable or dismiss a false positive with a reason that carries into matching future audits.
+- **Safe local adapter boundary:** invoke DarkzSEO through JSON-only stdin/stdout without a shell or inherited API secrets. Missing Python, timeouts, and schema drift stay explicit and non-blocking.
+- **Controlled Growth Experiments Studio:** rotate only approved title/thumbnail arms, measure real interval evidence, restore the control, and require a separate decision before adopting a winner.
+- **Outcome & ROI Studio:** align the operator with a measurable KPI, target window, budget, and available revenue/cost evidence without converting missing economics into false zeroes.
+- **Platform-ready foundation:** audits already retain their target platform, providing the durable contract for planned TikTok and Instagram/Reels publishing and analytics adapters.
-Upgrading from an earlier version? Comment posting needs one YouTube re-authorization to grant the comment permission — until then the studio still syncs, analyzes, and drafts in read-and-draft mode. Run `npm run walkthrough` to re-connect.
+DarkzSEO is optional. Install DarkzSEO 1.4+ into Python or set `DARKZSEO_PATH`; when it is unavailable, AgentTube records the reason and keeps the existing approval workflow operational.
See the complete release history in [CHANGELOG.md](CHANGELOG.md).
@@ -98,12 +95,27 @@ A claim can be approved only when it links to a verified source. Unsupported cla
Use the altered or synthetic media control only when the video contains realistic content that requires YouTube disclosure. The selected value is preserved in the publishing queue and included in the YouTube upload request.
+### Review discoverability guidance
+
+Every saved production receives an optional **DarkzSEO Discoverability Preflight** in Review Studio after metadata and provenance are assembled. The adapter sends a canonical content package—not the private dashboard—to DarkzSEO's versioned JSON API and stores the engine version, schema version, severity summary, stable rule IDs, and individual findings in SQLite.
+
+Findings are advisory in this release. Keep a useful recommendation as actionable, or dismiss a false positive with a reviewer reason that carries forward to matching findings on later audits. Missing Python, an unavailable DarkzSEO installation, timeouts, and schema mismatches remain explicit without blocking publication or silently changing scripts and metadata.
+
+For local development with a sibling checkout:
+
+```bash
+python -m pip install -e ../darkzseo
+```
+
+Alternatively set `DARKZSEO_PATH` to `darkzseo.py`. The adapter uses a shell-free Python child process, sends content JSON over stdin, and reads JSON-only stdout. DarkzSEO 1.4 or newer is required.
+
### What you need
- Node.js 18+
- A Google account and YouTube Data API credentials
- At least one AI text provider key
- FFmpeg, installed automatically through `ffmpeg-static`
+- Python 3.9+ and DarkzSEO 1.4+ for the optional discoverability preflight
Gemini offers free access for supported text and TTS usage. Gemini AI image generation currently requires paid-tier access; without an image provider, Lumen can assemble gradient-based visuals instead.
@@ -179,7 +191,8 @@ graph TD
C --> E[SEO Optimizer Agent]
D --> F[Production Management Agent]
E --> F
- F --> G[Review and Approval Gates]
+ F --> Z[DarkzSEO Discoverability Preflight]
+ Z --> G[Review and Approval Gates]
G --> H[Publishing & Scheduling Agent]
H --> I[Analytics & Optimization Agent]
I -->|feedback loop| A
@@ -196,6 +209,7 @@ Each agent handles one stage of the pipeline:
| **Thumbnail Designer** | Creates thumbnails, runs A/B variations |
| **SEO Optimizer** | Keywords, titles, descriptions, tags |
| **Production** | Coordinates TTS audio, image assets, video assembly |
+| **Discoverability** | Runs versioned, advisory GEO/AIO/AEO content audits through DarkzSEO |
| **Publishing** | Uploads, schedules, manages playlists |
| **Analytics** | Tracks performance, feeds insights back to strategy |
diff --git a/dashboard/app.js b/dashboard/app.js
index 8a1b757..6c75f95 100644
--- a/dashboard/app.js
+++ b/dashboard/app.js
@@ -860,6 +860,30 @@ function renderProvenanceEditor(provenance = {}, canReview = true) {
</section>`;
}
+function renderDiscoverabilityPanel(item) {
+ const audit = item.discoverability;
+ const findings = audit?.findings || [];
+ const state = !audit ? 'Not run' : audit.status === 'unavailable' ? 'Unavailable' : `${findings.length} finding${findings.length === 1 ? '' : 's'}`;
+ const stateClass = audit?.status === 'passed' || (audit && findings.length === 0) ? 'success' : 'warning';
+ return `<section class="discoverability-panel">
+ <div class="panel-heading discoverability-heading">
+ <div><p class="eyebrow">DISCOVERABILITY PREFLIGHT</p><h3>DarkzSEO review</h3><p>Review GEO, AIO, AEO, and web-search guidance against this content package. Findings are advisory and never rewrite or publish content.</p></div>
+ <div class="discoverability-actions"><span class="status ${stateClass}">${escapeHTML(state)}</span><button type="button" class="button secondary small" data-discoverability-run="${escapeHTML(item.id)}">${audit ? 'Run again' : 'Run audit'}</button></div>
+ </div>
+ ${audit?.error ? `<p class="callout">DarkzSEO could not run${audit.errorCode || audit.error_code ? ` (${escapeHTML(audit.errorCode || audit.error_code)})` : ''}: ${escapeHTML(audit.error)}</p>` : ''}
+ ${findings.length ? `<div class="discoverability-findings">${findings.map(finding => {
+ const reviewStatus = finding.reviewStatus || finding.review_status || 'pending';
+ return `<article class="discoverability-finding severity-${escapeHTML(String(finding.severity || 'info').toLowerCase())}" data-discoverability-finding="${escapeHTML(finding.id)}">
+ <div class="discoverability-finding-heading"><span class="severity-badge">${escapeHTML(finding.severity)}</span><strong>${escapeHTML(finding.ruleId || finding.rule_id)}</strong><span class="review-state ${escapeHTML(reviewStatus)}">${escapeHTML(label(reviewStatus))}</span></div>
+ <p>${escapeHTML(finding.message)}</p>
+ ${finding.remediation ? `<small>${escapeHTML(finding.remediation)}</small>` : ''}
+ ${finding.reviewReason || finding.review_reason ? `<small>Reviewer note: ${escapeHTML(finding.reviewReason || finding.review_reason)}</small>` : ''}
+ <div class="discoverability-review-actions"><button type="button" class="text-button approve" data-discoverability-accept ${reviewStatus === 'accepted' ? 'disabled' : ''}>Keep as actionable</button><button type="button" class="text-button" data-discoverability-dismiss ${reviewStatus === 'dismissed' ? 'disabled' : ''}>Dismiss false positive</button></div>
+ </article>`;
+ }).join('')}</div>` : audit && audit.status !== 'unavailable' ? '<p class="empty-inline">No discoverability findings. The content package passed the configured advisory checks.</p>' : '<p class="empty-inline">Run DarkzSEO to create a versioned, reviewable audit for this production.</p>'}
+ </section>`;
+}
+
function renderSceneEditor(item, canReview = true) {
const scenes = item.scenes || [];
if (!scenes.length) return '';
@@ -997,6 +1021,7 @@ async function openContent(productionId) {
</div>
${renderSceneEditor(item, canReview)}
${renderShortsStudio(item)}
+ ${renderDiscoverabilityPanel(item)}
${renderProvenanceEditor(item.provenance, canReview)}
<div class="form-grid two">
<label><span>Publish time</span><input name="publishTime" type="datetime-local" value="${toLocalInput(publishTime)}"></label>
@@ -1316,6 +1341,41 @@ document.addEventListener('click', async event => {
return;
}
+ const discoverabilityRun = event.target.closest('[data-discoverability-run]');
+ if (discoverabilityRun) {
+ const productionId = discoverabilityRun.dataset.discoverabilityRun;
+ try {
+ await api(`/api/content/${encodeURIComponent(productionId)}/discoverability/run`, {
+ method: 'POST', body: JSON.stringify({ platform: 'youtube' })
+ });
+ await refreshContentDialog(productionId, 'Discoverability preflight refreshed. Findings remain advisory until reviewed.');
+ } catch (error) {
+ showToast(error.message, 'error');
+ }
+ return;
+ }
+
+ const discoverabilityReview = event.target.closest('[data-discoverability-accept], [data-discoverability-dismiss]');
+ if (discoverabilityReview) {
+ const card = discoverabilityReview.closest('[data-discoverability-finding]');
+ const productionId = $('#content-review-form')?.dataset.productionId;
+ if (!card || !productionId) return;
+ const status = discoverabilityReview.matches('[data-discoverability-dismiss]') ? 'dismissed' : 'accepted';
+ const reason = status === 'dismissed'
+ ? (prompt('Why is this finding a false positive? The reason will be retained on future matching audits.') || '')
+ : '';
+ if (status === 'dismissed' && !reason) return;
+ try {
+ await api(`/api/discoverability/findings/${encodeURIComponent(card.dataset.discoverabilityFinding)}`, {
+ method: 'PATCH', body: JSON.stringify({ status, reason })
+ });
+ await refreshContentDialog(productionId, status === 'dismissed' ? 'Finding dismissed with reviewer evidence.' : 'Finding kept as an actionable recommendation.');
+ } catch (error) {
+ showToast(error.message, 'error');
+ }
+ return;
+ }
+
const shortAction = event.target.closest('[data-short-save], [data-short-render], [data-short-approve]');
if (shortAction) {
const card = shortAction.closest('[data-short-card]');
diff --git a/dashboard/styles.css b/dashboard/styles.css
index df9c151..09c5acf 100644
--- a/dashboard/styles.css
+++ b/dashboard/styles.css
@@ -644,6 +644,25 @@ label:has(input:disabled) > span { color: var(--muted); }
.provenance-list { display: grid; gap: 10px; }
.provenance-item { display: grid; gap: 11px; border: 1px solid var(--line); background: rgba(8, 11, 16, .44); border-radius: var(--radius-sm); padding: 12px; }
.provenance-item.high-risk { border-color: rgba(255, 194, 71, .4); }
+.discoverability-panel { display: grid; gap: 14px; border: 1px solid rgba(77, 166, 255, .28); background: rgba(77, 166, 255, .045); border-radius: var(--radius); padding: 14px; }
+.discoverability-heading { align-items: flex-start; margin: 0; }
+.discoverability-heading h3 { font-size: 16px; margin: 2px 0 0; }
+.discoverability-heading p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.45; margin: 6px 0 0; max-width: 680px; }
+.discoverability-actions, .discoverability-finding-heading, .discoverability-review-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
+.discoverability-actions { justify-content: flex-end; }
+.discoverability-findings { display: grid; gap: 10px; }
+.discoverability-finding { display: grid; gap: 8px; border: 1px solid var(--line); border-left-width: 3px; background: rgba(8, 11, 16, .44); border-radius: var(--radius-sm); padding: 12px; }
+.discoverability-finding.severity-critical, .discoverability-finding.severity-high { border-left-color: var(--red-hot); }
+.discoverability-finding.severity-medium { border-left-color: var(--amber); }
+.discoverability-finding.severity-low, .discoverability-finding.severity-info { border-left-color: var(--blue); }
+.discoverability-finding p, .discoverability-finding small { margin: 0; }
+.discoverability-finding p { color: var(--text); font-size: 13px; }
+.discoverability-finding small { color: var(--muted); line-height: 1.45; }
+.severity-badge, .review-state { border-radius: 999px; padding: 4px 8px; font: 9px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; }
+.severity-badge { color: var(--amber); background: var(--amber-soft); }
+.review-state { color: var(--muted); background: var(--surface-inset); }
+.review-state.accepted { color: var(--amber); }
+.review-state.dismissed { color: var(--green); }
.provenance-item-heading strong { font-size: 12px; }
/* ============ Callouts ============ */
diff --git a/database/db.js b/database/db.js
index 9bc01ec..ba62182 100644
--- a/database/db.js
+++ b/database/db.js
@@ -420,6 +420,41 @@ class Database {
updated_at TEXT DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (production_id) REFERENCES productions(id)
)`,
+ `CREATE TABLE IF NOT EXISTS discoverability_audits (
+ id TEXT PRIMARY KEY,
+ production_id TEXT NOT NULL,
+ platform TEXT NOT NULL DEFAULT 'youtube',
+ mode TEXT NOT NULL DEFAULT 'content',
+ engine TEXT NOT NULL DEFAULT 'darkzseo',
+ engine_version TEXT,
+ schema_version TEXT,
+ status TEXT NOT NULL,
+ summary TEXT NOT NULL DEFAULT '{}',
+ error_code TEXT,
+ error TEXT,
+ created_at TEXT DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (production_id) REFERENCES productions(id)
+ )`,
+ `CREATE TABLE IF NOT EXISTS discoverability_findings (
+ id TEXT PRIMARY KEY,
+ audit_id TEXT NOT NULL,
+ rule_id TEXT NOT NULL,
+ category TEXT NOT NULL,
+ severity TEXT NOT NULL,
+ applicability TEXT NOT NULL DEFAULT '[]',
+ message TEXT NOT NULL,
+ remediation TEXT,
+ fingerprint TEXT NOT NULL,
+ review_status TEXT NOT NULL DEFAULT 'pending',
+ review_reason TEXT,
+ reviewed_at TEXT,
+ created_at TEXT DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (audit_id) REFERENCES discoverability_audits(id)
+ )`,
+ `CREATE INDEX IF NOT EXISTS idx_discoverability_audits_production
+ ON discoverability_audits(production_id, platform, created_at)`,
+ `CREATE INDEX IF NOT EXISTS idx_discoverability_findings_audit
+ ON discoverability_findings(audit_id, severity, review_status)`,
`CREATE TABLE IF NOT EXISTS production_scenes (
id TEXT PRIMARY KEY,
production_id TEXT NOT NULL,
@@ -609,13 +644,16 @@ class Database {
monthly_budget: 'REAL',
outcome_currency: "TEXT DEFAULT 'USD'"
});
+ await this.ensureColumns('discoverability_audits', {
+ error_code: 'TEXT'
+ });
// Insert default settings
await this.insertDefaultSettings();
}
async ensureColumns(tableName, columns) {
- const allowedTables = new Set(['production_scenes', 'channel_strategies']);
+ const allowedTables = new Set(['production_scenes', 'channel_strategies', 'discoverability_audits']);
if (!allowedTables.has(tableName)) throw new Error(`Unsupported migration table: ${tableName}`);
const existing = new Set((await this.getAllRows(`PRAGMA table_info(${tableName})`)).map(column => column.name));
for (const [columnName, definition] of Object.entries(columns)) {
@@ -857,6 +895,7 @@ class Database {
[productionId]
);
const provenance = await this.getContentProvenance(productionId);
+ const discoverability = await this.getLatestDiscoverabilityAudit(productionId, 'youtube');
const scenes = await this.listProductionScenes(productionId);
const sceneRevisions = scenes.length ? await this.listProductionSceneRevisions(productionId, 50) : [];
const shorts = await this.listShortClips(productionId);
@@ -875,6 +914,7 @@ class Database {
sources: [], claims: [], containsSyntheticMedia: false, status: 'not_required',
summary: { sourceCount: 0, verifiedSources: 0, claimCount: 0, resolvedClaims: 0, highRiskClaims: 0, unresolvedClaims: 0 }
},
+ discoverability,
scenes,
sceneRevisions,
shorts
@@ -1395,6 +1435,133 @@ class Database {
} : null;
}
+ async saveDiscoverabilityAudit(productionId, platform, report = {}) {
+ const auditId = this.generateId('discoverability');
+ const findings = Array.isArray(report.findings) ? report.findings : [];
+ await this.executeQuery('BEGIN TRANSACTION');
+ try {
+ await this.executeQuery(
+ `INSERT INTO discoverability_audits (
+ id, production_id, platform, mode, engine, engine_version,
+ schema_version, status, summary, error_code, error
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
+ [
+ auditId,
+ productionId,
+ platform || 'youtube',
+ report.mode || 'content',
+ report.engine?.name || 'darkzseo',
+ report.engine?.version || null,
+ report.schemaVersion || null,
+ report.status || 'unavailable',
+ JSON.stringify(report.summary || {}),
+ report.errorCode || null,
+ report.error || null
+ ]
+ );
+
+ for (const finding of findings) {
+ const previous = await this.getRow(
+ `SELECT df.review_status, df.review_reason, df.reviewed_at
+ FROM discoverability_findings df
+ JOIN discoverability_audits da ON da.id = df.audit_id
+ WHERE da.production_id = ? AND da.platform = ? AND df.fingerprint = ?
+ ORDER BY df.created_at DESC, df.rowid DESC LIMIT 1`,
+ [productionId, platform || 'youtube', finding.fingerprint]
+ );
+ await this.executeQuery(
+ `INSERT INTO discoverability_findings (
+ id, audit_id, rule_id, category, severity, applicability,
+ message, remediation, fingerprint, review_status, review_reason, reviewed_at
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
+ [
+ this.generateId('finding'), auditId, finding.ruleId, finding.category,
+ finding.severity, JSON.stringify(finding.applicability || []), finding.message,
+ finding.remediation || null, finding.fingerprint,
+ previous?.review_status || 'pending', previous?.review_reason || null,
+ previous?.reviewed_at || null
+ ]
+ );
+ }
+ await this.executeQuery('COMMIT');
+ } catch (error) {
+ await this.executeQuery('ROLLBACK');
+ throw error;
+ }
+ return this.getDiscoverabilityAudit(auditId);
+ }
+
+ async getDiscoverabilityAudit(auditId) {
+ const row = await this.getRow('SELECT * FROM discoverability_audits WHERE id = ?', [auditId]);
+ if (!row) return null;
+ const findings = await this.getAllRows(
+ 'SELECT * FROM discoverability_findings WHERE audit_id = ? ORDER BY CASE severity WHEN \'CRITICAL\' THEN 0 WHEN \'HIGH\' THEN 1 WHEN \'MEDIUM\' THEN 2 WHEN \'LOW\' THEN 3 ELSE 4 END, created_at ASC',
+ [auditId]
+ );
+ return this.deserializeDiscoverabilityAudit(row, findings);
+ }
+
+ async getLatestDiscoverabilityAudit(productionId, platform = 'youtube') {
+ const row = await this.getRow(
+ `SELECT * FROM discoverability_audits
+ WHERE production_id = ? AND platform = ? ORDER BY created_at DESC, rowid DESC LIMIT 1`,
+ [productionId, platform]
+ );
+ if (!row) return null;
+ const findings = await this.getAllRows(
+ 'SELECT * FROM discoverability_findings WHERE audit_id = ? ORDER BY CASE severity WHEN \'CRITICAL\' THEN 0 WHEN \'HIGH\' THEN 1 WHEN \'MEDIUM\' THEN 2 WHEN \'LOW\' THEN 3 ELSE 4 END, created_at ASC',
+ [row.id]
+ );
+ return this.deserializeDiscoverabilityAudit(row, findings);
+ }
+
+ deserializeDiscoverabilityAudit(row, findings = []) {
+ const parsedFindings = findings.map(finding => ({
+ ...finding,
+ ruleId: finding.rule_id,
+ applicability: JSON.parse(finding.applicability || '[]'),
+ reviewStatus: finding.review_status,
+ reviewReason: finding.review_reason,
+ reviewedAt: finding.reviewed_at
+ }));
+ return {
+ ...row,
+ productionId: row.production_id,
+ engineVersion: row.engine_version,
+ schemaVersion: row.schema_version,
+ errorCode: row.error_code,
+ summary: JSON.parse(row.summary || '{}'),
+ findings: parsedFindings,
+ pendingCount: parsedFindings.filter(finding => finding.reviewStatus === 'pending').length
+ };
+ }
+
+ async getDiscoverabilityFinding(findingId) {
+ const row = await this.getRow(
+ `SELECT df.*, da.production_id, da.platform
+ FROM discoverability_findings df
+ JOIN discoverability_audits da ON da.id = df.audit_id WHERE df.id = ?`,
+ [findingId]
+ );
+ return row ? {
+ ...row,
+ ruleId: row.rule_id,
+ applicability: JSON.parse(row.applicability || '[]'),
+ reviewStatus: row.review_status,
+ reviewReason: row.review_reason,
+ reviewedAt: row.reviewed_at
+ } : null;
+ }
+
+ async reviewDiscoverabilityFinding(findingId, status, reason) {
+ await this.executeQuery(
+ `UPDATE discoverability_findings SET review_status = ?, review_reason = ?, reviewed_at = datetime('now')
+ WHERE id = ?`,
+ [status, reason || null, findingId]
+ );
+ return this.getDiscoverabilityFinding(findingId);
+ }
+
async getChannelProfile() {
const row = await this.getRow("SELECT * FROM channel_profiles WHERE id = 'default'");
return row ? { ...row, bannedTopics: JSON.parse(row.banned_topics || '[]') } : null;
diff --git a/index.js b/index.js
index 62c0d26..8bc5cf6 100644
--- a/index.js
+++ b/index.js
@@ -26,6 +26,7 @@ const { ShortsRepurposingService } = require('./utils/shorts-repurposing-service
const { AudienceEngagementService } = require('./utils/audience-engagement-service');
const { GrowthExperimentService } = require('./utils/growth-experiment-service');
const { AITextService } = require('./utils/ai-text-service');
+const { DiscoverabilityService } = require('./utils/discoverability-service');
const { version } = require('./package.json');
const chalk = require('chalk');
@@ -49,6 +50,7 @@ class YouTubeAutomationAgent {
this.shorts = null;
this.engagement = null;
this.experiments = null;
+ this.discoverability = null;
this.setupRequired = false;
}
@@ -68,6 +70,7 @@ class YouTubeAutomationAgent {
});
this.operator = new OperatorService(this.db);
this.provenance = new ProvenanceService(this.db);
+ this.discoverability = new DiscoverabilityService(this.db, { logger: this.logger });
this.autonomous = new AutonomousChannelOperator(this.db, {
researchAndPlan: strategy => {
if (!this.agents.strategy) throw new Error('The strategy agent is not configured');
@@ -958,6 +961,43 @@ class YouTubeAutomationAgent {
return res.json({ success: true, result: recommendation });
});
+ this.app.post('/api/content/:productionId/discoverability/run', protect, async (req, res) => {
+ try {
+ const bundle = await this.db.getProductionBundle(req.params.productionId);
+ if (!bundle) return res.status(404).json({ success: false, error: 'Content not found' });
+ const profile = await this.db.getChannelProfile() || {};
+ const audit = await this.discoverability.auditProduction(bundle, profile, req.body?.platform || 'youtube');
+ if (bundle.review_status !== 'approved' && !bundle.schedule) {
+ const updated = await this.db.getProductionBundle(bundle.id);
+ const quality = await this.operator.runQualityChecks({
+ ...updated,
+ scheduledPublishTime: updated.scheduled_publish_time
+ }, profile);
+ await this.db.saveContentReview(bundle.id, {
+ status: quality.passed ? 'needs_review' : 'needs_attention',
+ editorData: updated.editorData,
+ qualityChecks: quality.checks,
+ reviewNotes: quality.passed ? null : `Blocking checks failed: ${quality.blockingFailures.join(', ')}`,
+ reviewedAt: null
+ });
+ }
+ const result = await this.db.getProductionBundle(bundle.id);
+ return res.json({ success: true, result: this.decorateContentBundle(result), audit });
+ } catch (error) {
+ return res.status(error.status || 400).json({ success: false, error: error.message });
+ }
+ });
+
+ this.app.patch('/api/discoverability/findings/:findingId', protect, async (req, res) => {
+ try {
+ const finding = await this.discoverability.reviewFinding(req.params.findingId, req.body || {});
+ const audit = await this.db.getLatestDiscoverabilityAudit(finding.production_id, finding.platform);
+ return res.json({ success: true, result: { finding, audit } });
+ } catch (error) {
+ return res.status(error.status || 400).json({ success: false, error: error.message });
+ }
+ });
+
this.app.get('/api/experiments', async (_req, res) => {
try {
const summary = this.experiments
@@ -1440,6 +1480,9 @@ class YouTubeAutomationAgent {
await this.db.saveProductionSnapshot(productionData);
if (!this.provenance) this.provenance = new ProvenanceService(this.db);
productionData.provenance = await this.provenance.initialize(contentId, productionData);
+ productionData.discoverability = this.discoverability
+ ? await this.discoverability.auditProduction(productionData, profile, 'youtube')
+ : null;
this.logger.info(`Content saved with ID: ${contentId}`);
// Step 6: Quality and approval gate
diff --git a/package-lock.json b/package-lock.json
index 5c54a7d..1108032 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "youtube-automation-agent",
- "version": "2.9.0",
+ "version": "2.10.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "youtube-automation-agent",
- "version": "2.9.0",
+ "version": "2.10.0",
"dependencies": {
"@google-cloud/local-auth": "^3.0.0",
"@google/genai": "^2.9.0",
diff --git a/package.json b/package.json
index 83ed9c0..a1073ce 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "youtube-automation-agent",
- "version": "2.9.0",
+ "version": "2.10.0",
"description": "Lumen is an open-source AI agent that runs a YouTube channel end to end",
"main": "index.js",
"scripts": {
diff --git a/test.js b/test.js
index e1ca785..fc1ba19 100644
--- a/test.js
+++ b/test.js
@@ -36,6 +36,7 @@ class SystemTest {
{ name: 'Narration Reliability and Recovery', test: () => this.testNarrationReliability() },
{ name: 'Shorts Repurposing Studio', test: () => this.testShortsRepurposingStudio() },
{ name: 'Research and Provenance Desk', test: () => this.testProvenanceDesk() },
+ { name: 'DarkzSEO Discoverability Preflight', test: () => this.testDiscoverabilityPreflight() },
{ name: 'Resumable Generation Checkpoints', test: () => this.testResumableGenerationCheckpoints() },
{ name: 'API Validation and Security', test: () => this.testAPIValidationAndSecurity() },
{ name: 'Publishing Safety', test: () => this.testPublishingSafety() },
@@ -1708,6 +1709,129 @@ class SystemTest {
this.logger.info('Research and provenance desk test completed successfully');
}
+ async testDiscoverabilityPreflight() {
+ const fs = require('fs').promises;
+ const os = require('os');
+ const { DiscoverabilityService } = require('./utils/discoverability-service');
+ const { OperatorService } = require('./utils/operator-service');
+ const directory = await fs.mkdtemp(path.join(os.tmpdir(), 'yaa-discoverability-'));
+ const db = new Database();
+ db.dbPath = path.join(directory, 'discoverability.db');
+ await db.initialize();
+ const productionId = 'prod-discoverability-test';
+ const fakeAdapter = {
+ audit: async content => ({
+ schemaVersion: '1.0',
+ engine: { name: 'darkzseo', version: '1.4.0' },
+ mode: 'content',
+ target: content.id,
+ status: 'attention_required',
+ summary: {
+ severity: { CRITICAL: 0, HIGH: 1, MEDIUM: 0, LOW: 0, INFO: 0 },
+ category: { SEO: 0, GEO: 1, AIO: 0, AEO: 0 }
+ },
+ findings: [{
+ ruleId: 'geo.trust_network', category: 'GEO', severity: 'HIGH',
+ applicability: ['youtube', 'content'],
+ message: 'Trust Network: Long content lacks authority links',
+ remediation: 'Add a verified authority source.'
+ }]
+ })
+ };
+
+ try {
+ await db.saveProductionData({
+ id: productionId, status: 'needs_review', assets: {}, timeline: {},
+ scheduledPublishTime: null, priority: 50, estimatedDuration: '1:00'
+ });
+ const production = {
+ id: productionId,
+ script: { title: 'AgentTube discoverability', fullScript: 'Detailed content '.repeat(200), sections: [] },
+ seo: { title: 'AgentTube discoverability', description: 'A detailed discoverability review.', chapters: [] },
+ provenance: { sources: [] }
+ };
+ await db.saveProductionSnapshot(production);
+ const service = new DiscoverabilityService(db, { adapter: fakeAdapter });
+ const first = await service.auditProduction(production, { channel_name: 'AgentTube' });
+ if (first.engineVersion !== '1.4.0' || first.findings.length !== 1 || first.pendingCount !== 1) {
+ throw new Error('The versioned DarkzSEO report was not persisted');
+ }
+
+ const quality = await new OperatorService(db).runQualityChecks({ ...production, discoverability: first }, {});
+ const discoverabilityCheck = quality.checks.find(check => check.id === 'discoverability');
+ if (!discoverabilityCheck || discoverabilityCheck.passed || discoverabilityCheck.blocking) {
+ throw new Error('High-priority discoverability guidance was not advisory and visible');
+ }
+
+ let shortReasonRejected = false;
+ try {
+ await service.reviewFinding(first.findings[0].id, { status: 'dismissed', reason: 'no' });
+ } catch (error) {
+ shortReasonRejected = /at least 5/.test(error.message);
+ }
+ if (!shortReasonRejected) throw new Error('A false-positive dismissal without reviewer evidence was accepted');
+
+ await service.reviewFinding(first.findings[0].id, { status: 'dismissed', reason: 'The cited source is attached in the approved evidence desk.' });
+ const second = await service.auditProduction(production, { channel_name: 'AgentTube' });
+ if (second.findings[0].reviewStatus !== 'dismissed' || second.pendingCount !== 0) {
+ throw new Error('Finding review evidence did not carry forward across matching audits');
+ }
+ const reviewedQuality = await new OperatorService(db).runQualityChecks({ ...production, discoverability: second }, {});
+ if (!reviewedQuality.checks.find(check => check.id === 'discoverability' && check.passed)) {
+ throw new Error('A dismissed false positive remained an actionable quality warning');
+ }
+
+ const { YouTubeAutomationAgent } = require('./index');
+ const apiAgent = new YouTubeAutomationAgent();
+ apiAgent.db = db;
+ apiAgent.operator = new OperatorService(db);
+ apiAgent.discoverability = service;
+ apiAgent.setupAPI();
+ const server = await new Promise(resolve => {
+ const listener = apiAgent.app.listen(0, '127.0.0.1', () => resolve(listener));
+ });
+ try {
+ const address = server.address();
+ const apiHeaders = { 'content-type': 'application/json', ...(process.env.API_KEY ? { 'x-api-key': process.env.API_KEY } : {}) };
+ const runResponse = await fetch(`http://127.0.0.1:${address.port}/api/content/${productionId}/discoverability/run`, {
+ method: 'POST', headers: apiHeaders, body: JSON.stringify({ platform: 'youtube' })
+ });
+ const runPayload = await runResponse.json();
+ if (!runResponse.ok || runPayload.audit?.schemaVersion !== '1.0' || !runPayload.result?.discoverability) {
+ throw new Error('Discoverability run API did not return the persisted versioned audit');
+ }
+ const apiFinding = runPayload.audit.findings[0];
+ const reviewResponse = await fetch(`http://127.0.0.1:${address.port}/api/discoverability/findings/${apiFinding.id}`, {
+ method: 'PATCH', headers: apiHeaders, body: JSON.stringify({ status: 'accepted' })
+ });
+ const reviewPayload = await reviewResponse.json();
+ if (!reviewResponse.ok || reviewPayload.result?.finding?.reviewStatus !== 'accepted') {
+ throw new Error('Discoverability review API did not persist the operator decision');
+ }
+ } finally {
+ await new Promise(resolve => server.close(resolve));
+ }
+
+ const unavailableService = new DiscoverabilityService(db, {
+ adapter: { audit: async () => { const error = new Error('Python is not installed'); error.code = 'DARKZSEO_UNAVAILABLE'; throw error; } }
+ });
+ const unavailable = await unavailableService.auditProduction(production, { channel_name: 'AgentTube' });
+ if (unavailable.status !== 'unavailable' || unavailable.errorCode !== 'DARKZSEO_UNAVAILABLE' || unavailable.findings.length !== 0) {
+ throw new Error('An unavailable DarkzSEO runtime was not stored explicitly');
+ }
+ const unavailableQuality = await new OperatorService(db).runQualityChecks({ ...production, discoverability: unavailable }, {});
+ const unavailableCheck = unavailableQuality.checks.find(check => check.id === 'discoverability');
+ if (!unavailableCheck || unavailableCheck.passed || unavailableCheck.blocking) {
+ throw new Error('DarkzSEO runtime availability did not remain an explicit non-blocking check');
+ }
+ } finally {
+ await db.close();
+ await fs.rm(directory, { recursive: true, force: true });
+ }
+
+ this.logger.info('DarkzSEO discoverability preflight test completed successfully');
+ }
+
async testResumableGenerationCheckpoints() {
const fs = require('fs').promises;
const os = require('os');
@@ -2511,7 +2635,9 @@ class SystemTest {
'./agents/seo-optimizer-agent',
'./agents/production-management-agent',
'./agents/publishing-scheduling-agent',
- './agents/analytics-optimization-agent'
+ './agents/analytics-optimization-agent',
+ './utils/discoverability-service',
+ './utils/discoverability-adapters/darkzseo'
];
for (const agentFile of agentFiles) {
diff --git a/utils/discoverability-adapters/darkzseo.js b/utils/discoverability-adapters/darkzseo.js
new file mode 100644
index 0000000..24eb926
--- /dev/null
+++ b/utils/discoverability-adapters/darkzseo.js
@@ -0,0 +1,109 @@
+const { spawn } = require('child_process');
+const fs = require('fs');
+const path = require('path');
+
+class DarkzSEOAdapter {
+ constructor(options = {}) {
+ this.spawnProcess = options.spawnProcess || spawn;
+ this.python = options.python || process.env.DARKZSEO_PYTHON || (process.platform === 'win32' ? 'python' : 'python3');
+ this.scriptPath = options.scriptPath || this.resolveScriptPath();
+ this.timeoutMs = Number(options.timeoutMs || process.env.DARKZSEO_TIMEOUT_MS || 30000);
+ this.maxOutputBytes = Number(options.maxOutputBytes || 2 * 1024 * 1024);
+ }
+
+ resolveScriptPath() {
+ if (process.env.DARKZSEO_PATH) return path.resolve(process.env.DARKZSEO_PATH);
+ const siblingCheckout = path.resolve(__dirname, '..', '..', '..', 'darkzseo', 'darkzseo.py');
+ return fs.existsSync(siblingCheckout) ? siblingCheckout : null;
+ }
+
+ command() {
+ const target = this.scriptPath ? [this.scriptPath] : ['-m', 'darkzseo'];
+ return {
+ executable: this.python,
+ args: [...target, '--mode', 'content', '--input-json', '-', '--json-stdout', '--no-html', '--fail-on', 'none']
+ };
+ }
+
+ childEnvironment() {
+ const allowed = [
+ 'PATH', 'Path', 'PATHEXT', 'SystemRoot', 'WINDIR', 'TEMP', 'TMP',
+ 'HOME', 'USERPROFILE', 'LOCALAPPDATA', 'APPDATA', 'PYTHONPATH', 'VIRTUAL_ENV'
+ ];
+ const environment = { PYTHONUTF8: '1' };
+ for (const key of allowed) {
+ if (process.env[key] !== undefined) environment[key] = process.env[key];
+ }
+ return environment;
+ }
+
+ async audit(contentPackage) {
+ const command = this.command();
+ return new Promise((resolve, reject) => {
+ const child = this.spawnProcess(command.executable, command.args, {
+ shell: false,
+ windowsHide: true,
+ stdio: ['pipe', 'pipe', 'pipe'],
+ env: this.childEnvironment()
+ });
+ let stdout = '';
+ let stderr = '';
+ let settled = false;
+
+ const finish = (callback, value) => {
+ if (settled) return;
+ settled = true;
+ clearTimeout(timer);
+ callback(value);
+ };
+ const timer = setTimeout(() => {
+ child.kill();
+ const error = new Error(`DarkzSEO timed out after ${this.timeoutMs}ms`);
+ error.code = 'DARKZSEO_TIMEOUT';
+ finish(reject, error);
+ }, this.timeoutMs);
+
+ child.on('error', error => {
+ error.code = error.code === 'ENOENT' ? 'DARKZSEO_UNAVAILABLE' : (error.code || 'DARKZSEO_PROCESS_ERROR');
+ finish(reject, error);
+ });
+ child.stdout.on('data', chunk => {
+ stdout += chunk.toString('utf8');
+ if (Buffer.byteLength(stdout, 'utf8') > this.maxOutputBytes) {
+ child.kill();
+ const error = new Error('DarkzSEO returned more output than allowed');
+ error.code = 'DARKZSEO_OUTPUT_LIMIT';
+ finish(reject, error);
+ }
+ });
+ child.stderr.on('data', chunk => {
+ stderr += chunk.toString('utf8');
+ });
+ child.on('close', code => {
+ if (settled) return;
+ if (code !== 0) {
+ const error = new Error(`DarkzSEO exited with code ${code}${stderr.trim() ? `: ${stderr.trim()}` : ''}`);
+ error.code = 'DARKZSEO_FAILED';
+ return finish(reject, error);
+ }
+ try {
+ const report = JSON.parse(stdout);
+ if (report.schemaVersion !== '1.0' || report.engine?.name !== 'darkzseo' || !Array.isArray(report.findings)) {
+ const error = new Error('DarkzSEO returned an unsupported report schema');
+ error.code = 'DARKZSEO_SCHEMA_MISMATCH';
+ return finish(reject, error);
+ }
+ return finish(resolve, report);
+ } catch (parseError) {
+ const error = new Error(`DarkzSEO returned invalid JSON: ${parseError.message}`);
+ error.code = 'DARKZSEO_INVALID_JSON';
+ return finish(reject, error);
+ }
+ });
+
+ child.stdin.end(JSON.stringify(contentPackage));
+ });
+ }
+}
+
+module.exports = { DarkzSEOAdapter };
diff --git a/utils/discoverability-service.js b/utils/discoverability-service.js
new file mode 100644
index 0000000..36c602f
--- /dev/null
+++ b/utils/discoverability-service.js
@@ -0,0 +1,116 @@
+const crypto = require('crypto');
+const { Logger } = require('./logger');
+const { DarkzSEOAdapter } = require('./discoverability-adapters/darkzseo');
+
+class DiscoverabilityService {
+ constructor(db, options = {}) {
+ this.db = db;
+ this.logger = options.logger || new Logger('Discoverability');
+ this.adapter = options.adapter || new DarkzSEOAdapter(options.darkzseo || {});
+ }
+
+ contentPackage(production, profile = {}, platform = 'youtube') {
+ const script = production.script || {};
+ const seo = production.seo || {};
+ const provenance = production.provenance || {};
+ const sourceSections = Array.isArray(script.sections)
+ ? script.sections
+ : Array.isArray(script.mainContent) ? script.mainContent : [];
+ const sections = sourceSections.length
+ ? sourceSections.map(section => ({
+ title: section.title || section.heading || '',
+ content: section.content || section.text || section.script || ''
+ }))
+ : [];
+ return {
+ id: production.id,
+ platform,
+ brand: profile.channel_name || profile.channelName || 'Brand',
+ title: seo.title || script.title || '',
+ description: seo.description || '',
+ transcript: script.fullScript || '',
+ sections,
+ chapters: Array.isArray(seo.chapters) ? seo.chapters : [],
+ sources: (provenance.sources || [])
+ .filter(source => source.status === 'verified')
+ .map(source => ({ url: source.url, title: source.title, publisher: source.publisher })),
+ hasComparisonTable: Boolean(script.hasComparisonTable),
+ unitsExplained: Boolean(script.unitsExplained)
+ };
+ }
+
+ fingerprint(platform, finding) {
+ return crypto.createHash('sha256')
+ .update([platform, finding.ruleId, finding.message].join('\u0000'))
+ .digest('hex');
+ }
+
+ normalizeReport(report, platform) {
+ return {
+ ...report,
+ findings: (report.findings || []).map(finding => ({
+ ruleId: String(finding.ruleId || 'unknown'),
+ category: String(finding.category || 'SEO').toUpperCase(),
+ severity: String(finding.severity || 'INFO').toUpperCase(),
+ applicability: Array.isArray(finding.applicability) ? finding.applicability : [platform, 'content'],
+ message: String(finding.message || 'Discoverability review required'),
+ remediation: finding.remediation ? String(finding.remediation) : null,
+ fingerprint: this.fingerprint(platform, finding)
+ }))
+ };
+ }
+
+ unavailableReport(error) {
+ return {
+ schemaVersion: '1.0',
+ engine: { name: 'darkzseo', version: null },
+ mode: 'content',
+ status: 'unavailable',
+ summary: {
+ severity: { CRITICAL: 0, HIGH: 0, MEDIUM: 0, LOW: 0, INFO: 0 },
+ category: { SEO: 0, GEO: 0, AIO: 0, AEO: 0 }
+ },
+ findings: [],
+ errorCode: error.code || 'DARKZSEO_UNAVAILABLE',
+ error: error.message
+ };
+ }
+
+ async auditProduction(production, profile = {}, platform = 'youtube') {
+ if (!production?.id) throw this.error('A saved production is required for discoverability auditing', 400);
+ if (platform !== 'youtube') throw this.error(`Platform "${platform}" is not enabled yet`, 400);
+ let report;
+ try {
+ report = this.normalizeReport(
+ await this.adapter.audit(this.contentPackage(production, profile, platform)),
+ platform
+ );
+ } catch (error) {
+ this.logger.warn(`DarkzSEO audit unavailable for ${production.id}: ${error.message}`);
+ report = this.unavailableReport(error);
+ }
+ return this.db.saveDiscoverabilityAudit(production.id, platform, report);
+ }
+
+ async reviewFinding(findingId, input = {}) {
+ const finding = await this.db.getDiscoverabilityFinding(findingId);
+ if (!finding) throw this.error('Discoverability finding not found', 404);
+ const status = String(input.status || '').toLowerCase();
+ if (!['accepted', 'dismissed'].includes(status)) {
+ throw this.error('Choose accepted or dismissed', 400);
+ }
+ const reason = String(input.reason || '').trim();
+ if (status === 'dismissed' && reason.length < 5) {
+ throw this.error('Dismissed findings require a reason of at least 5 characters', 400);
+ }
+ return this.db.reviewDiscoverabilityFinding(findingId, status, reason || null);
+ }
+
+ error(message, status) {
+ const error = new Error(message);
+ error.status = status;
+ return error;
+ }
+}
+
+module.exports = { DiscoverabilityService };
diff --git a/utils/operator-service.js b/utils/operator-service.js
index 19d4607..556abf4 100644
--- a/utils/operator-service.js
+++ b/utils/operator-service.js
@@ -99,6 +99,24 @@ class OperatorService {
? 'No externally verifiable factual claims were declared'
: `${unresolved} factual claim${unresolved === 1 ? '' : 's'} still require evidence review`));
+ const discoverability = production.discoverability;
+ if (discoverability) {
+ const actionable = (discoverability.findings || []).filter(finding =>
+ ['CRITICAL', 'HIGH'].includes(finding.severity) && finding.reviewStatus !== 'dismissed'
+ );
+ const available = discoverability.status !== 'unavailable';
+ checks.push(this.check(
+ 'discoverability',
+ available && actionable.length === 0,
+ !available
+ ? `DarkzSEO advisory audit is unavailable${discoverability.error ? `: ${discoverability.error}` : ''}`
+ : actionable.length
+ ? `${actionable.length} high-priority discoverability finding${actionable.length === 1 ? '' : 's'} await remediation or dismissal`
+ : `${discoverability.findings?.length || 0} discoverability finding${discoverability.findings?.length === 1 ? '' : 's'} recorded; no unresolved high-priority findings`,
+ false
+ ));
+ }
+
if (scenes.length) {
const invalidScenes = scenes.filter(scene =>
!scene.assetPath || ['missing_asset', 'failed', 'generating', 'needs_rebuild', 'visual_stale'].includes(scene.status) ||