Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
feat(content): read what kind of source each link is, and underline the weak ones (CE-046, part a) (#1450)
Cihana79e4af985c4
diff --git a/supabase/migrations/00263_content_draft_kept_sources.sql b/supabase/migrations/00263_content_draft_kept_sources.sqlnew file mode 100644index 000000000..c2d634e30--- /dev/null+++ b/supabase/migrations/00263_content_draft_kept_sources.sql@@ -0,0 +1,40 @@+-- ============================================================================+-- 00263: Quality phase 2, CE-046 — the sources a person keeps+-- ============================================================================+-- Trust reads what kind of source each of a page's links is: primary+-- (official, research, standards), secondary, weak (forums, social posts) or+-- a competitor's page. A weak source or a competitor's the person trusts all+-- the same is kept: it no longer lowers Trust or shows as a suggestion. Kept+-- per draft, by the link's address as the page has it, 50 at most.++alter table public.content_drafts+ add column if not exists kept_sources text[] not null default '{}'+ check (cardinality(kept_sources) <= 50);++comment on column public.content_drafts.kept_sources is+ 'Quality CE-046 (00263): weak or competitors'' sources the person chose to keep on this page, by address. They don''t lower Trust.';++-- Keeps one source on a draft, once, up to the 50: a member's own change of+-- their draft, through their policy (security invoker). Returns the draft's+-- kept sources after, or nothing when the caller can't change the draft.+create or replace function public.content_draft_keep_source(p_draft_id uuid, p_url text)+returns text[]+language sql+volatile+security invoker+set search_path = public+as $$+ update public.content_drafts+ set kept_sources = case+ when p_url = any (kept_sources) or cardinality(kept_sources) >= 50 then kept_sources+ else array_append(kept_sources, p_url)+ end+ where id = p_draft_id+ and char_length(p_url) between 1 and 2048+ returning kept_sources;+$$;++revoke execute on function public.content_draft_keep_source(uuid, text) from public, anon;+grant execute on function public.content_draft_keep_source(uuid, text) to authenticated, service_role;++notify pgrst, 'reload schema';diff --git a/supabase/schema.sql b/supabase/schema.sqlindex 01cd0fd73..8bb7f2630 100644--- a/supabase/schema.sql+++ b/supabase/schema.sql@@ -38304,3 +38304,47 @@ comment on column public.webhook_configs.events isnotify pgrst, 'reload schema';+-- ─────────────────────────────────────────────────────────────────────────+-- migrations/00263_content_draft_kept_sources.sql+-- ─────────────────────────────────────────────────────────────────────────+-- ============================================================================+-- 00263: Quality phase 2, CE-046 — the sources a person keeps+-- ============================================================================+-- Trust reads what kind of source each of a page's links is: primary+-- (official, research, standards), secondary, weak (forums, social posts) or+-- a competitor's page. A weak source or a competitor's the person trusts all+-- the same is kept: it no longer lowers Trust or shows as a suggestion. Kept+-- per draft, by the link's address as the page has it, 50 at most.++alter table public.content_drafts+ add column if not exists kept_sources text[] not null default '{}'+ check (cardinality(kept_sources) <= 50);++comment on column public.content_drafts.kept_sources is+ 'Quality CE-046 (00263): weak or competitors'' sources the person chose to keep on this page, by address. They don''t lower Trust.';++-- Keeps one source on a draft, once, up to the 50: a member's own change of+-- their draft, through their policy (security invoker). Returns the draft's+-- kept sources after, or nothing when the caller can't change the draft.+create or replace function public.content_draft_keep_source(p_draft_id uuid, p_url text)+returns text[]+language sql+volatile+security invoker+set search_path = public+as $$+ update public.content_drafts+ set kept_sources = case+ when p_url = any (kept_sources) or cardinality(kept_sources) >= 50 then kept_sources+ else array_append(kept_sources, p_url)+ end+ where id = p_draft_id+ and char_length(p_url) between 1 and 2048+ returning kept_sources;+$$;++revoke execute on function public.content_draft_keep_source(uuid, text) from public, anon;+grant execute on function public.content_draft_keep_source(uuid, text) to authenticated, service_role;++notify pgrst, 'reload schema';+diff --git a/web/messages/en.json b/web/messages/en.jsonindex cd0036a21..964b2a5a5 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -4632,6 +4632,10 @@"gain": "+{gain, number} {score}","band": "{score, number}, {band}","show": "Show",+ "keep": "Keep",+ "keepFailed": "Couldn't keep the source. Try again.",+ "keepFull": "This page keeps 50 sources already: replace one instead.",+ "weakSource": "A weak source: a forum, a social post or a competitor's page. See Quality to replace or keep it.","formulas": {"flesch": "Flesch Reading Ease","atesman": "Ateşman",@@ -4648,6 +4652,14 @@"line": "{count} of {total} dated {total, plural, one {source} other {sources}} {count, plural, one {is} other {are}} over {months} months old","detail": "Swap them for a newer source, or check whether the page has an update."},+ "noWeakSources": {+ "line": "{count, plural, one {# source is} other {# sources are}} weak: a forum, a social post or a competitor's page",+ "detail": "{kind, select, competitor {{host} is a competitor's page.} other {{host} is a forum or a social post.}} Link the study, official page or data behind it instead, or keep it if you trust it."+ },+ "primarySources": {+ "line": "No primary source yet",+ "detail": "Link an official page or a study for the page's main claim: a government or standards body, a journal or a research paper."+ },"noBrokenLinks": {"line": "{count, plural, one {# link doesn't} other {# links don't}} work","detail": "{count, plural, one {Fix or remove it: {url}} other {Fix or remove them, starting with {url}}}"diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsxindex 57aa083ab..62caf2197 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_before-publish.test.tsx@@ -147,6 +147,8 @@ const trustRead = (over: Partial<TrustRead>): TrustRead => ({dated: 0,unsourced: [],figures: 0,+ weak: [],+ classified: 0,...over,});diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsxindex 0e8a78070..8a3d9cf30 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx@@ -41,6 +41,7 @@ import {unmarkContentDraftReady,restoreDraftVersion,setContentDraftAuthor,+ keepDraftSource,setContentDraftPageType,startAgentWriting,startPageRewrite,@@ -144,6 +145,7 @@ import { HtmlBlock, copyToClipboard } from './_html-block';import { OwnCopies, ownCopyHtml } from './_own-copies';import { NextNudge, useNextNudge } from './_next-nudge';import { PageInfoStrip, pageInfoKey } from './_page-info';+import { WeakSourcesMarks, weakSourcesKey } from './_weak-sources';import { HeaderTip } from './_header-tip';import { NextStepButton, readSkips, wordsUnderTitle, writeSkips } from './_next-step';import { useTodoCopy, type QualityRead } from './_quality-tab';@@ -180,6 +182,8 @@ import { useDraftAutosave, type SaveState } from './_use-autosave';const DOCUMENT_CLASS = cn('prose prose-neutral max-w-none dark:prose-invert min-h-[50vh] focus:outline-none','prose-a:font-normal prose-a:text-blue-600 prose-a:underline prose-a:underline-offset-2 dark:prose-a:text-blue-400',+ // A weak source's amber wavy line takes the place of its link's (CE-046).+ 'prose-a:has-[.quality-weak-source]:no-underline!','prose-h1:text-3xl prose-h1:tracking-tight prose-h2:tracking-tight','[&_table]:my-4 [&_table]:w-full [&_table]:table-fixed [&_td]:border [&_td]:px-2 [&_td]:py-1.5 [&_th]:border [&_th]:bg-muted/50 [&_th]:px-2 [&_th]:py-1.5 [&_th]:text-left',// Cells and list items hold paragraphs; their margins would pad every row.@@ -389,6 +393,7 @@ export function DraftEditor({AgentDrafting,FlashBlock,PageInfoStrip,+ WeakSourcesMarks,],content: draft.bodyHtml,// Rendered on the client only, so the server's HTML can't disagree with it.@@ -531,6 +536,19 @@ export function DraftEditor({live = false;};}, [qualityOn, draft.brandId]);+ // Phase 2 (CE-046): what kind of source each link is, competitors' pages+ // by the brand's competitors (read with the sources), less the ones the+ // person kept.+ const sourcesOn = qualityPhase() >= 2;+ const competitorDomains = reads.sources?.data?.competitorDomains;+ const [keptSources, setKeptSources] = useState(draft.keptSources);+ const sourceRead = useMemo(+ () =>+ sourcesOn+ ? { competitorDomains: competitorDomains ?? [], pageType, kept: new Set(keptSources) }+ : null,+ [sourcesOn, competitorDomains, pageType, keptSources],+ );// The brand's own links aren't sources: Trust waits for its domains.const trustScore = useMemo(() =>@@ -540,11 +558,39 @@ export function DraftEditor({links: linkChecks,brandDomains,siteTrust,+ sources: sourceRead,now: Date.now(),}): null,- [qualityOn, pageBlocks, linkChecks, brandDomains, siteTrust],+ [qualityOn, pageBlocks, linkChecks, brandDomains, siteTrust, sourceRead],);+ // Their links underlined in the draft, Quality's suggestion naming them.+ const weakKey = (trustScore?.weak ?? []).map((w) => w.url).join('\n');+ const weakTitle = t('quality.weakSource');+ useEffect(() => {+ if (!editor || editor.isDestroyed) return;+ const urls = new Set(weakKey ? weakKey.split('\n') : []);+ editor.view.dispatch(+ editor.state.tr+ .setMeta(weakSourcesKey, { urls, title: weakTitle })+ .setMeta('addToHistory', false),+ );+ }, [editor, weakKey, weakTitle]);+ const keepSource = async (url: string) => {+ setKeptSources((kept) => (kept.includes(url) ? kept : [...kept, url]));+ try {+ setKeptSources(await keepDraftSource(draft.id, url));+ } catch (err) {+ // Only this one goes back: another kept meanwhile stays.+ setKeptSources((kept) => kept.filter((source) => source !== url));+ if (err instanceof Error && err.message === 'full') {+ toast.error(t('quality.keepFull'));+ return;+ }+ console.error('Failed to keep the source:', err);+ toast.error(t('quality.keepFailed'));+ }+ };const qualityScore = qualityAverage([eeatScore?.score ?? null,trustScore?.score ?? null,@@ -2434,6 +2480,7 @@ export function DraftEditor({onShowInPage={showInPage}onShowPlaceholder={showFirstPlaceholder}onPickAuthor={() => setAuthorMenuOpen(true)}+ onKeepSource={sourcesOn ? (url) => void keepSource(url) : undefined}/>) : (<EditorPanelRail onOpen={openPanelTab} />diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsxindex 9ac8edb34..539aafa98 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.test.tsx@@ -88,6 +88,7 @@ let root: Root;const onShow = vi.fn();const onPickAuthor = vi.fn();const onShowPlaceholder = vi.fn();+const onKeep = vi.fn();async function render(quality: QualityRead | Readability | null) {const q = quality && 'eeat' in quality ? quality : read(quality as Readability | null);@@ -99,6 +100,7 @@ async function render(quality: QualityRead | Readability | null) {onShow={onShow}onShowPlaceholder={onShowPlaceholder}onPickAuthor={onPickAuthor}+ onKeep={onKeep}/></NextIntlClientProvider>,);@@ -108,6 +110,7 @@ async function render(quality: QualityRead | Readability | null) {beforeEach(() => {onShow.mockReset();onPickAuthor.mockReset();+ onKeep.mockReset();container = document.createElement('div');root = createRoot(container);});@@ -362,6 +365,35 @@ describe('QualityTab', () => {expect(onShow).toHaveBeenCalledWith('Win rates rose 42% last year.');});+ it('asks to replace weak sources, with Show and Keep, and for a primary one (CE-046)', async () => {+ const html =+ '<p>People swear by it on <a href="https://www.reddit.com/r/coffee/1">a thread</a>.</p>' ++ '<p>Their tool too: <a href="https://rival.example/feature">rival</a>.</p>' ++ '<p>As <a href="https://www.reuters.com/x">Reuters</a> reported.</p>';+ const result = trust({+ blocks: trustBlocks(html),+ links: new Map(),+ brandDomains: ['acme.com'],+ sources: { competitorDomains: ['rival.example'], pageType: 'guide', kept: new Set() },+ now: Date.parse('2026-10-23T12:00:00Z'),+ });+ await render({ ...read(null), trust: result });+ const suggestions = container.querySelector('[aria-label="What would raise it"]')!;+ const rows = [...suggestions.querySelectorAll('li')];+ const weak = rows.find((li) => li.textContent?.includes('weak'))!;+ expect(weak.textContent).toContain(+ "2 sources are weak: a forum, a social post or a competitor's page",+ );+ expect(weak.textContent).toContain('reddit.com is a forum or a social post.');+ await act(async () => weak.querySelectorAll('button')[0].click());+ expect(onShow).toHaveBeenCalledWith('People swear by it on a thread.');+ await act(async () => weak.querySelectorAll('button')[1].click());+ expect(onKeep).toHaveBeenCalledWith('https://www.reddit.com/r/coffee/1');+ expect(rows.map((li) => li.textContent)).toContainEqual(+ expect.stringContaining('No primary source yet'),+ );+ });+it("shows the site's trust, what is missing and the way to Site Audit", async () => {const siteTrust = {checks: {diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsxindex 064e45e9f..38c4e31b7 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_quality-tab.tsx@@ -4,6 +4,7 @@ import { useFormatter, useTranslations } from 'next-intl';import { Check } from 'lucide-react';import { Link } from '@/i18n/navigation';import { Button, buttonVariants } from '@/components/ui/button';+import { normalizeDomain } from '@/lib/citations/classify';import type { ContentAuthor } from '@/lib/content/authors';import { BAND_CLASSES, qualityBand } from '@/lib/content/quality';import {@@ -60,6 +61,8 @@ export interface Suggestion {detail: string;/** The passage Show goes to, if any. */show: string | null;+ /** The source Keep keeps (CE-046): the person trusts it all the same. */+ keep?: string;}/**@@ -74,6 +77,7 @@ export function QualityTab({onShow,onShowPlaceholder,onPickAuthor,+ onKeep,}: {quality: QualityRead;/** Scrolls the draft to a passage and marks it. */@@ -82,6 +86,8 @@ export function QualityTab({onShowPlaceholder: () => void;/** Opens the header's author menu. */onPickAuthor: () => void;+ /** Keeps a weak source or a competitor's on the page (CE-046). */+ onKeep?: (url: string) => void;}) {const t = useTranslations('contentEditor.editor.quality');const tSite = useTranslations('audit.siteTrust.checks');@@ -183,6 +189,16 @@ export function QualityTab({{t('show')}</Button>)}+ {s.keep && onKeep && (+ <Button+ variant="ghost"+ size="sm"+ className="h-7 shrink-0"+ onClick={() => onKeep(s.keep!)}+ >+ {t('keep')}+ </Button>+ )}</li>))}</ul>@@ -381,6 +397,8 @@ export type TrustSuggestion = Suggestion & { check: TrustCheckId; count: number* Trust's: figures without a source, sources past FRESH_MONTHS, links that* don't answer, each with Show on the first one in the page. A broken link* is listed before Trust is scored too, its gain out of the Phase 1 points.+ * Phase 2 (CE-046): weak or competitors' sources, Show and Keep on the first,+ * and no primary source among them.*/export function trustSuggestions(t: T, trust: TrustRead | null): TrustSuggestion[] {if (!trust) return [];@@ -413,6 +431,37 @@ export function trustSuggestions(t: T, trust: TrustRead | null): TrustSuggestionshow: trust.stale[0].text,});}+ // Only once Trust is scored: their gain out of the Phase 1 points would be made up.+ if (trust.weak.length && trust.score !== null) {+ const [first] = trust.weak;+ out.push({+ key: 'trust:noWeakSources',+ check: 'noWeakSources',+ score: 'trust',+ gain: trustGain(trust, ['noWeakSources']),+ line: t('checks.noWeakSources.line', { count: trust.weak.length }),+ count: trust.weak.length,+ detail: t('checks.noWeakSources.detail', {+ host: normalizeDomain(first.url),+ kind: first.kind,+ }),+ show: first.text,+ keep: first.url,+ });+ }+ const primary = trust.checks.find((c) => c.id === 'primarySources');+ if (primary && primary.points < primary.max && trust.score !== null) {+ out.push({+ key: 'trust:primarySources',+ check: 'primarySources',+ score: 'trust',+ gain: trustGain(trust, ['primarySources']),+ line: t('checks.primarySources.line'),+ count: 1,+ detail: t('checks.primarySources.detail'),+ show: null,+ });+ }if (trust.broken.length) {out.push({key: 'trust:noBrokenLinks',diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsxindex 095a55c50..adee0cdae 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_side-panel.tsx@@ -127,6 +127,7 @@ export function EditorSidePanel({onShowInPage,onShowPlaceholder,onPickAuthor,+ onKeepSource,}: {draft: ContentDraft;/** The brand's business type as the editor holds it (Quality CE-056). */@@ -176,6 +177,8 @@ export function EditorSidePanel({onShowPlaceholder?: () => void;/** Opens the header's author menu: Quality's Pick author. */onPickAuthor?: () => void;+ /** Keeps a weak source or a competitor's on the page (Quality CE-046), once phase 2 is live. */+ onKeepSource?: (url: string) => void;}) {const t = useTranslations('contentEditor.editor.panel');const tEditor = useTranslations('contentEditor.editor');@@ -393,6 +396,7 @@ export function EditorSidePanel({onShow={(text) => onShowInPage?.(text)}onShowPlaceholder={() => onShowPlaceholder?.()}onPickAuthor={() => onPickAuthor?.()}+ onKeep={onKeepSource}/></div>)}diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_weak-sources.ts b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_weak-sources.tsnew file mode 100644index 000000000..5ec57a4f7--- /dev/null+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_weak-sources.ts@@ -0,0 +1,72 @@+import { Extension } from '@tiptap/core';+import type { Node as PmNode } from '@tiptap/pm/model';+import { Plugin, PluginKey } from '@tiptap/pm/state';+import { Decoration, DecorationSet } from '@tiptap/pm/view';+import { cleanHref } from '@/lib/content/html-allowlist';++/**+ * Weak sources and competitors' pages in the draft (Quality CE-046): an+ * amber wavy underline on the link, with why on hover. A decoration, never+ * the page's, so no save, export, copy or CMS push has it. Quality's+ * suggestion has Show and Keep for each.+ */++export interface WeakSources {+ /** The links to mark, by their address as Trust reads it (cleanHref). */+ urls: ReadonlySet<string>;+ /** Why, on hover. */+ title: string;+}++interface WeakState extends WeakSources {+ marks: DecorationSet;+}++export const weakSourcesKey = new PluginKey<WeakState>('weakSources');++/** The editor's container takes the link's own underline away under it (_draft-editor). */+const WEAK_SOURCE = 'quality-weak-source';+const WEAK = `${WEAK_SOURCE} underline decoration-wavy decoration-amber-500 underline-offset-4 dark:decoration-amber-400`;++function decorate(doc: PmNode, { urls, title }: WeakSources): DecorationSet {+ if (!urls.size) return DecorationSet.empty;+ const marks: Decoration[] = [];+ doc.descendants((node, pos) => {+ if (!node.isText) return;+ const link = node.marks.find((mark) => mark.type.name === 'link');+ const href = link ? cleanHref(String(link.attrs.href ?? '')) : null;+ if (href && urls.has(href)) {+ marks.push(Decoration.inline(pos, pos + node.nodeSize, { class: WEAK, title }));+ }+ });+ return DecorationSet.create(doc, marks);+}++export const WeakSourcesMarks = Extension.create({+ name: 'weakSources',++ addProseMirrorPlugins() {+ return [+ new Plugin<WeakState>({+ key: weakSourcesKey,+ state: {+ init: () => ({ urls: new Set(), title: '', marks: DecorationSet.empty }),+ // Marked again when the list changes (the page read after typing+ // pauses) and on every change of the page while one is listed: a+ // restore, an accepted suggestion or a new link to the same source+ // changes which text holds it.+ apply: (tr, prev) => {+ const next = tr.getMeta(weakSourcesKey) as WeakSources | undefined;+ if (next) return { ...next, marks: decorate(tr.doc, next) };+ return tr.docChanged && prev.urls.size+ ? { ...prev, marks: decorate(tr.doc, prev) }+ : prev;+ },+ },+ props: {+ decorations: (state) => weakSourcesKey.getState(state)?.marks ?? null,+ },+ }),+ ];+ },+});diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsxindex 6c7a7a6a6..ac985fcfa 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.test.tsx@@ -17,6 +17,7 @@ const unmarkContentDraftReady = vi.fn();const saveContentDraft = vi.fn();const setContentDraftPageType = vi.fn();const setContentDraftAuthor = vi.fn();+const keepDraftSource = vi.fn();const checkDraftLinks = vi.fn();const getSiteTrust = vi.fn();vi.mock('@/lib/actions/audits', () => ({@@ -75,6 +76,7 @@ vi.mock('@/lib/actions/content-drafts', () => ({saveContentDraft: (...args: unknown[]) => saveContentDraft(...args),setContentDraftPageType: (...args: unknown[]) => setContentDraftPageType(...args),setContentDraftAuthor: (...args: unknown[]) => setContentDraftAuthor(...args),+ keepDraftSource: (...args: unknown[]) => keepDraftSource(...args),checkDraftLinks: (...args: unknown[]) => checkDraftLinks(...args),}));vi.mock('next/navigation', () => ({ useParams: () => ({ draftId: 'd1' }) }));@@ -197,6 +199,7 @@ const draft = (over: Partial<ContentDraft> = {}): ContentDraft => ({author: 'agent',authorId: null,rules: { set: null, source: null, overrides: {}, textRules: [] },+ keptSources: [],action: null,agentState: null,agentSince: null,@@ -270,6 +273,7 @@ beforeEach(() => {saveBlob.mockReset();setContentDraftPageType.mockReset().mockResolvedValue(undefined);setContentDraftAuthor.mockReset().mockResolvedValue(undefined);+ keepDraftSource.mockReset();checkDraftLinks.mockReset().mockResolvedValue({ links: [], skipped: [] });getSiteTrust.mockReset().mockRejectedValue(new Error('not in this test'));getContentAuthors.mockReset().mockResolvedValue(null);@@ -2537,6 +2541,107 @@ describe('the side panel', () => {});});+ describe('Sources by kind (Quality CE-046)', () => {+ afterEach(() => {+ delete process.env.NEXT_PUBLIC_CONTENT_QUALITY_PHASE;+ });+ const reddit = 'https://www.reddit.com/r/coffee/1';+ const sourced = draft({+ bodyHtml:+ '<h1>Pour-over coffee</h1>' ++ `<p>People swear by it on <a href="${reddit}">a thread</a>.</p>` ++ '<p>Brew at 94 °C, as <a href="https://www.reuters.com/x">Reuters</a> reported.</p>',+ });+ const weakMarks = () => container.querySelectorAll('.ProseMirror .decoration-wavy');++ it('underlines a weak source in the draft, and keeps it on Keep', async () => {+ process.env.NEXT_PUBLIC_CONTENT_QUALITY_PHASE = '2';+ getDraftSources.mockResolvedValue({+ data: {+ prompts: [],+ fanouts: [],+ citedPages: [],+ gscQueries: [],+ brandDomains: ['acme.com'],+ competitorDomains: [],+ },+ choices: [],+ });+ keepDraftSource.mockResolvedValue([reddit]);+ getContentDraft.mockResolvedValue(sourced);+ window.innerWidth = 1440;+ await renderPage();+ expect(weakMarks()).toHaveLength(1);+ expect(weakMarks()[0].textContent).toBe('a thread');+ expect(weakMarks()[0].getAttribute('title')).toContain('A weak source');++ const chip = [...container.querySelectorAll<HTMLButtonElement>('header button')].find((b) =>+ b.textContent?.startsWith('Quality'),+ )!;+ await act(async () => chip.click());+ const row = [...panel()!.querySelectorAll('li')].find((li) =>+ li.textContent?.includes('weak:'),+ )!;+ const keep = [...row.querySelectorAll('button')].find((b) => b.textContent === 'Keep')!;+ await act(async () => keep.click());+ expect(keepDraftSource).toHaveBeenCalledWith('d1', reddit);+ expect(weakMarks()).toHaveLength(0);+ expect(panel()!.textContent).not.toContain('weak:');+ });++ it('marks every link to it as the page changes', async () => {+ process.env.NEXT_PUBLIC_CONTENT_QUALITY_PHASE = '2';+ getDraftSources.mockResolvedValue({+ data: {+ prompts: [],+ fanouts: [],+ citedPages: [],+ gscQueries: [],+ brandDomains: ['acme.com'],+ competitorDomains: [],+ },+ choices: [],+ });+ getContentDraft.mockResolvedValue(sourced);+ await renderPage();+ expect(weakMarks()).toHaveLength(1);+ // The page replaced (as a restore or the HTML view does): both links to it are marked.+ await act(async () => button('Edit as HTML')!.click());+ const source = container.querySelector('textarea')!;+ await act(async () => {+ Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value')!.set!.call(+ source,+ `<h1>Pour-over coffee</h1><p>One <a href="${reddit}">thread</a>.</p>` ++ `<p>And <a href="${reddit}">the same thread</a>.</p>`,+ );+ source.dispatchEvent(new Event('input', { bubbles: true }));+ });+ await act(async () => button('Back to visual')!.click());+ expect([...weakMarks()].map((mark) => mark.textContent)).toEqual([+ 'thread',+ 'the same thread',+ ]);+ });++ it('reads no source’s kind before phase 2', async () => {+ process.env.NEXT_PUBLIC_CONTENT_QUALITY_PHASE = '1';+ getDraftSources.mockResolvedValue({+ data: {+ prompts: [],+ fanouts: [],+ citedPages: [],+ gscQueries: [],+ brandDomains: ['acme.com'],+ competitorDomains: [],+ },+ choices: [],+ });+ getContentDraft.mockResolvedValue(sourced);+ await renderPage();+ expect(weakMarks()).toHaveLength(0);+ });+ });+describe('Author (CE-038)', () => {const ada = {id: 'a1',diff --git a/web/src/lib/actions/content-drafts.test.ts b/web/src/lib/actions/content-drafts.test.tsindex 846eaa59c..dbd35a75c 100644--- a/web/src/lib/actions/content-drafts.test.ts+++ b/web/src/lib/actions/content-drafts.test.ts@@ -87,6 +87,7 @@ const {getCitedPassages,getContentDraft,getDraftVersions,+ keepDraftSource,markContentDraftReady,restoreDraftVersion,saveContentDraft,@@ -347,6 +348,23 @@ describe('setContentDraftAuthor', () => {});});+describe('keepDraftSource (Quality CE-046)', () => {+ it('keeps a source through the draft’s function, an http(s) address only', async () => {+ const url = 'https://www.reddit.com/r/coffee/1';+ rpcResult = { data: [url], error: null };+ await expect(keepDraftSource(DRAFT, url)).resolves.toEqual([url]);+ expect(rpcCalls).toEqual([['content_draft_keep_source', { p_draft_id: DRAFT, p_url: url }]]);+ await expect(keepDraftSource(DRAFT, 'javascript:alert(1)')).rejects.toThrow('invalid');+ await expect(keepDraftSource('d1', url)).rejects.toThrow('invalid');+ // Not the member's to change: the function changes nothing.+ rpcResult = { data: null, error: null };+ await expect(keepDraftSource(DRAFT, url)).rejects.toThrow('not_found');+ // 50 kept already: the list comes back without it.+ rpcResult = { data: ['https://x.example/1'], error: null };+ await expect(keepDraftSource(DRAFT, url)).rejects.toThrow('full');+ });+});+describe('unmarkContentDraftReady', () => {it('moves a ready draft back to review, and only a ready one', async () => {updated = { status: 'in_review' };diff --git a/web/src/lib/actions/content-drafts.ts b/web/src/lib/actions/content-drafts.tsindex c78e71e76..18c09d10d 100644--- a/web/src/lib/actions/content-drafts.ts+++ b/web/src/lib/actions/content-drafts.ts@@ -195,6 +195,11 @@ function draftStatus(value: string): DraftStatus {}const draftId = z.guid();+/** A kept source: an http(s) address, as the page has it. */+const keptSource = z+ .string()+ .max(2048)+ .regex(/^https?:\/\//i);/** What a draft row embeds of its brand: enough to know its site type. */const BRAND_SITE = 'brands(site_type, industry, shopping_mode_enabled)';@@ -220,7 +225,7 @@ export async function getContentDraft(id: string): Promise<ContentDraft | null>const { data, error } = await supabase.from('content_drafts').select(- `id, brand_id, title, page_type, page_type_source, method, status, body_html, author, author_id, source_url, rules, action_id, agent_state, agent_state_at, agent_run, updated_at, ${BRAND_SITE}, actions(action_no)`,+ `id, brand_id, title, page_type, page_type_source, method, status, body_html, author, author_id, source_url, rules, kept_sources, action_id, agent_state, agent_state_at, agent_run, updated_at, ${BRAND_SITE}, actions(action_no)`,).eq('id', id).maybeSingle();@@ -240,6 +245,7 @@ export async function getContentDraft(id: string): Promise<ContentDraft | null>author: data.author === 'agent' ? 'agent' : 'user',authorId: data.author_id,rules: draftRulesSchema.safeParse(data.rules).data ?? NO_DRAFT_RULES,+ keptSources: data.kept_sources ?? [],action:data.action_id && data.actions? { id: data.action_id, number: data.actions.action_no }@@ -1241,6 +1247,26 @@ export async function setContentDraftAuthor(id: string, authorId: string | null)if (!data) throw new Error('not_found');}+/**+ * Keeps a weak source or a competitor's on the page (Quality CE-046): the+ * person trusts it, so it no longer lowers Trust. Returns the draft's kept+ * sources after; 'full' when the page keeps 50 already.+ */+export async function keepDraftSource(id: string, url: string): Promise<string[]> {+ if (!draftId.safeParse(id).success || !keptSource.safeParse(url).success) {+ throw new Error('invalid');+ }+ const supabase = await createClient();+ const { data, error } = await supabase.rpc('content_draft_keep_source', {+ p_draft_id: id,+ p_url: url,+ });+ if (error) throw new Error(error.message);+ if (!data) throw new Error('not_found');+ if (!data.includes(url)) throw new Error('full');+ return data;+}+/** The statuses the Library's row menu sets directly; Ready goes through markContentDraftReady. */const ROW_STATUSES = ['draft', 'in_review', 'published'] as const;diff --git a/web/src/lib/content/drafts.ts b/web/src/lib/content/drafts.tsindex 785c6e6f0..8411124bc 100644--- a/web/src/lib/content/drafts.ts+++ b/web/src/lib/content/drafts.ts@@ -160,6 +160,8 @@ export interface ContentDraft {authorId: string | null;/** What the person changed on the page's rules for this draft (CE-009). */rules: DraftRules;+ /** Weak or competitors' sources the person kept (Quality CE-046, 00263): they don't lower Trust. */+ keptSources: string[];/** The Action Center action the draft is the work of (CE-022), shown as "from Action AC-214". */action: { id: string; number: number } | null;/** Where the Content Agent is on it (CE-015): the editor waits while it writes. */diff --git a/web/src/lib/content/quality-checks.test.ts b/web/src/lib/content/quality-checks.test.tsindex 8631383af..475c6121c 100644--- a/web/src/lib/content/quality-checks.test.ts+++ b/web/src/lib/content/quality-checks.test.ts@@ -219,3 +219,68 @@ describe('trust (Phase 1: figures and links)', () => {expect(run('<p>No figures here.</p>').score).toBeNull();});});++describe('trust (Phase 2: what kind of source each link is, CE-046)', () => {+ const NOW = Date.parse('2026-10-23T12:00:00Z');+ const run = (html: string, over: { pageType?: string; kept?: string[] } = {}) =>+ trust({+ blocks: trustBlocks(html),+ links: new Map(),+ brandDomains: ['acme.com'],+ sources: {+ competitorDomains: ['rival.example'],+ pageType: over.pageType ?? 'guide',+ kept: new Set(over.kept ?? []),+ },+ now: NOW,+ });+ const a = (href: string) => `<a href="${href}">source</a>`;++ it('wants a primary source among them, and none weak or a competitor’s', () => {+ const result = run(+ `<p>Flu season runs from October ${a('https://www.cdc.gov/flu')}.</p>` ++ `<p>People say it works ${a('https://www.reddit.com/r/x/1')}.</p>` ++ `<p>Their tool does it too ${a('https://rival.example/feature')}.</p>` ++ `<p>Reported by ${a('https://www.reuters.com/x')}, on ${a('https://www.acme.com/blog')}.</p>`,+ );+ expect(result.checks).toEqual([+ { id: 'primarySources', points: TRUST_WEIGHTS.primarySources, max: 15 },+ { id: 'noWeakSources', points: (TRUST_WEIGHTS.noWeakSources * 2) / 4, max: 10 },+ ]);+ // Two placed sources score Trust on their own; the brand's own page isn't one.+ expect(result.classified).toBe(4);+ expect(result.score).toBe(80);+ expect(result.weak.map((w) => [w.url, w.kind])).toEqual([+ ['https://www.reddit.com/r/x/1', 'weak'],+ ['https://rival.example/feature', 'competitor'],+ ]);+ });++ it('takes a source the person kept, and a competitor’s own page on a comparison', () => {+ const html =+ `<p>People say it works ${a('https://www.reddit.com/r/x/1')}.</p>` ++ `<p>Their pricing ${a('https://rival.example/pricing')}.</p>`;+ expect(run(html).score).toBe(0);+ const kept = run(html, { pageType: 'comparison', kept: ['https://www.reddit.com/r/x/1'] });+ expect(kept.weak).toEqual([]);+ expect(kept.score).toBe(100);+ });++ it('leaves out a source the rules can’t place, and waits for two', () => {+ const result = run(+ `<p>A blog says so ${a('https://some-blog.example/post')}.</p>` ++ `<p>Officially ${a('https://www.who.int/news')}.</p>`,+ );+ expect(result.classified).toBe(1);+ expect(result.score).toBeNull();+ // Before phase 2, none of it is read.+ const before = trust({+ blocks: trustBlocks(`<p>${a('https://www.reddit.com/r/x/1')} ${a('https://x.com/a')}</p>`),+ links: new Map(),+ brandDomains: [],+ now: NOW,+ });+ expect(before.checks).toEqual([]);+ expect(before.weak).toEqual([]);+ });+});diff --git a/web/src/lib/content/quality-checks.ts b/web/src/lib/content/quality-checks.tsindex 43754b044..aae4eb120 100644--- a/web/src/lib/content/quality-checks.ts+++ b/web/src/lib/content/quality-checks.ts@@ -2,6 +2,7 @@ import { classifyDomain, normalizeDomain } from '@/lib/citations/classify';import type { ContentAuthor } from './authors';import { cleanHref } from './html-allowlist';import { ownText, sentencesOf } from './readability';+import { sourceClass, type SourceClass } from './source-class';/*** E-E-A-T and Trust (Content Editor Quality spec §2.1, §2.2): checks read@@ -38,7 +39,8 @@ export type EeatCheckId = keyof typeof EEAT_WEIGHTS;/*** Trust's checks and points; Phase 1 reads the page's links and figures* (sourced figures, fresh sources, working links) and the site's trust- * (Site Audit, CE-043); the rest are Phase 2.+ * (Site Audit, CE-043); the rest are Phase 2, starting with what kind of+ * source each link is (CE-046).*/export const TRUST_WEIGHTS = {claimsSourced: 30,@@ -219,10 +221,12 @@ function pageLinks(blocks: TrustBlock[], brandDomains: string[]) {return out;}-/** Each link once, by its address. */-const byUrl = <T extends { url: string }>(links: T[]) => [- ...new Map(links.map((l) => [l.url, l])).values(),-];+/** Each link once, by its address: where the page has it first (Show goes there). */+const byUrl = <T extends { url: string }>(links: T[]) => {+ const first = new Map<string, T>();+ for (const l of links) if (!first.has(l.url)) first.set(l.url, l);+ return [...first.values()];+};/** The page's links to read, each once, MAX_LINK_CHECKS at most: Trust's link checks. */export function linksToCheck(blocks: TrustBlock[]): string[] {@@ -238,6 +242,20 @@ export interface TrustRead extends Score<TrustCheckId> {/** Sentences with a figure and no source in their block, and how many have a figure. */unsourced: string[];figures: number;+ /**+ * Phase 2 (CE-046): weak or competitors' sources the person hasn't kept,+ * the page's first first, and how many sources the rules could place.+ */+ weak: { url: string; text: string; kind: 'weak' | 'competitor' }[];+ classified: number;+}++/** What Trust needs to tell a link's kind (Phase 2, CE-046). */+export interface SourceRead {+ competitorDomains: string[];+ pageType: string | null;+ /** Weak or competitors' sources the person chose to keep, by their address. */+ kept: ReadonlySet<string>;}/**@@ -250,12 +268,19 @@ export interface TrustRead extends Score<TrustCheckId> {* source is there: working links alone are 3 points, and one link would set* the whole score (one dead link 0, one working link 100), as Readability* waits for MIN_WORDS.+ *+ * With `sources` (Phase 2, CE-046), each source's kind counts too: a primary+ * one among them (official, research, standards), and none weak (forums,+ * social posts) or a competitor's, unless the person kept it. A source the+ * rules can't place is left out of both; two placed sources score Trust on+ * their own.*/export function trust({blocks,links,brandDomains,siteTrust = null,+ sources: kinds = null,now,}: {/** The page's blocks (trustBlocks). */@@ -265,6 +290,8 @@ export function trust({brandDomains: string[];/** How many of the site's five trust checks pass (CE-043), when read. */siteTrust?: { score: number } | null;+ /** Phase 2: what each source is (CE-046); left out before. */+ sources?: SourceRead | null;now: number;}): TrustRead {const all = pageLinks(blocks, brandDomains);@@ -302,6 +329,30 @@ export function trust({});}+ const classified = kinds+ ? byUrl(all.filter((l) => l.external)).flatMap((l) => {+ const kind = sourceClass(l.url, { brandDomains, ...kinds });+ return kind && kind !== 'own' ? [{ ...l, kind }] : [];+ })+ : [];+ const isWeak = (kind: SourceClass): kind is 'weak' | 'competitor' =>+ kind === 'weak' || kind === 'competitor';+ const weak = classified.flatMap(({ url, text, kind }) =>+ isWeak(kind) && !kinds?.kept.has(url) ? [{ url, text, kind }] : [],+ );+ if (classified.length) {+ checks.push({+ id: 'primarySources',+ points: classified.some((l) => l.kind === 'primary') ? TRUST_WEIGHTS.primarySources : 0,+ max: TRUST_WEIGHTS.primarySources,+ });+ checks.push({+ id: 'noWeakSources',+ points: (TRUST_WEIGHTS.noWeakSources * (classified.length - weak.length)) / classified.length,+ max: TRUST_WEIGHTS.noWeakSources,+ });+ }+const read = byUrl(all.filter((l) => {const status = links.get(l.url)?.status;@@ -327,7 +378,9 @@ export function trust({});}- const scored = checks.some((c) => c.id === 'claimsSourced' || c.id === 'freshSources');+ const scored =+ checks.some((c) => c.id === 'claimsSourced' || c.id === 'freshSources') ||+ classified.length >= 2;return {...(scored ? scoreOf(checks) : { score: null, checks }),broken: broken.map(({ url, text }) => ({ url, text })),@@ -335,5 +388,7 @@ export function trust({dated: sources.length,unsourced,figures: figureSentences.length,+ weak,+ classified: classified.length,};}diff --git a/web/src/lib/content/source-class.test.ts b/web/src/lib/content/source-class.test.tsnew file mode 100644index 000000000..b6d556e6c--- /dev/null+++ b/web/src/lib/content/source-class.test.ts@@ -0,0 +1,50 @@+import { describe, expect, it } from 'vitest';+import { sourceClass } from './source-class';++/** A page's link as a kind of source (CE-046): from its address, or not at all. */++const ctx = {+ brandDomains: ['acme.example'],+ competitorDomains: ['https://www.rival.example/'],+ pageType: 'guide',+};++describe('sourceClass', () => {+ it('reads official, research and standards sites as primary', () => {+ expect(sourceClass('https://www.cdc.gov/flu/index.html', ctx)).toBe('primary');+ expect(sourceClass('https://ec.europa.eu/eurostat', ctx)).toBe('primary');+ expect(sourceClass('https://doi.org/10.1000/182', ctx)).toBe('primary');+ expect(sourceClass('https://arxiv.org/abs/2311.09735', ctx)).toBe('primary');+ expect(sourceClass('https://www.w3.org/TR/WCAG22/', ctx)).toBe('primary');+ });++ it('reads news and review sites as secondary, forums and social posts as weak', () => {+ expect(sourceClass('https://www.reuters.com/markets/', ctx)).toBe('secondary');+ expect(sourceClass('https://www.g2.com/products/x/reviews', ctx)).toBe('secondary');+ expect(sourceClass('https://old.reddit.com/r/coffee/comments/1', ctx)).toBe('weak');+ expect(sourceClass('https://medium.com/@someone/post', ctx)).toBe('weak');+ });++ it('reads an encyclopedia anyone edits as secondary, uploaded papers as weak', () => {+ expect(sourceClass('https://en.wikipedia.org/wiki/Coffee', ctx)).toBe('secondary');+ expect(sourceClass('https://www.academia.edu/123/paper', ctx)).toBe('weak');+ // Other .edu sites stay official.+ expect(sourceClass('https://www.stanford.edu/research', ctx)).toBe('primary');+ });++ it('names the brand’s own pages and a competitor’s', () => {+ expect(sourceClass('https://blog.acme.example/post', ctx)).toBe('own');+ expect(sourceClass('https://rival.example/pricing', ctx)).toBe('competitor');+ });++ it('takes a competitor’s own page as primary on a page that compares', () => {+ for (const pageType of ['comparison', 'alternatives', 'best_of']) {+ expect(sourceClass('https://rival.example/pricing', { ...ctx, pageType })).toBe('primary');+ }+ });++ it('leaves out an address the rules can’t place', () => {+ expect(sourceClass('https://some-coffee-blog.example/post', ctx)).toBeNull();+ expect(sourceClass('not a link', { ...ctx, pageType: null })).toBeNull();+ });+});diff --git a/web/src/lib/content/source-class.ts b/web/src/lib/content/source-class.tsnew file mode 100644index 000000000..688fea004--- /dev/null+++ b/web/src/lib/content/source-class.ts@@ -0,0 +1,88 @@+import { classifyDomain, normalizeDomain } from '@/lib/citations/classify';++/**+ * What kind of source a page's link is (Quality spec CE-046, Trust §2.2):+ * primary (official, research, standards), secondary (news and magazines,+ * review sites), weak (forums and social posts), a competitor's page, or the+ * brand's own. Read from the address alone, by the citations' categories+ * (classifyDomain) and a short list of research and standards sites; an+ * address the rules can't place is left out (null), so it neither raises+ * nor lowers Trust.+ */++export type SourceClass = 'primary' | 'secondary' | 'weak' | 'competitor' | 'own';++/** Research, journals and standards bodies: primary wherever they're cited. */+const RESEARCH_DOMAINS = [+ 'doi.org',+ 'arxiv.org',+ 'nature.com',+ 'science.org',+ 'sciencedirect.com',+ 'springer.com',+ 'wiley.com',+ 'ieee.org',+ 'acm.org',+ 'jstor.org',+ 'ssrn.com',+ 'plos.org',+ 'thelancet.com',+ 'bmj.com',+ 'nejm.org',+ 'w3.org',+ 'ietf.org',+ 'rfc-editor.org',+ 'iso.org',+ 'whatwg.org',+];++/**+ * Sites the citations' categories call institutional whose pages anyone+ * writes or uploads: an encyclopedia anyone edits reads as secondary, a+ * site of uploaded papers as weak.+ */+const SECONDARY_DOMAINS = ['wikipedia.org'];+const WEAK_DOMAINS = ['academia.edu'];++/**+ * Pages that compare: a link to a competitor's own page (its pricing, its+ * docs) is where its facts come from (spec §11), so it counts as primary.+ */+const COMPARING = new Set(['comparison', 'alternatives', 'best_of']);++const onList = (host: string, list: string[]) =>+ list.some((entry) => host === entry || host.endsWith(`.${entry}`));++export function sourceClass(+ url: string,+ {+ brandDomains,+ competitorDomains,+ pageType,+ }: { brandDomains: string[]; competitorDomains: string[]; pageType: string | null },+): SourceClass | null {+ const host = normalizeDomain(url);+ if (!host) return null;+ if (onList(host, SECONDARY_DOMAINS)) return 'secondary';+ if (onList(host, WEAK_DOMAINS)) return 'weak';+ const kind = classifyDomain(host, {+ brandDomains: brandDomains.map(normalizeDomain).filter(Boolean),+ competitorDomains: competitorDomains.map(normalizeDomain).filter(Boolean),+ });+ switch (kind) {+ case 'you':+ return 'own';+ case 'competitor':+ return pageType && COMPARING.has(pageType) ? 'primary' : 'competitor';+ case 'institutional':+ return 'primary';+ case 'editorial':+ case 'review':+ return 'secondary';+ case 'forum':+ case 'social':+ return 'weak';+ default:+ return onList(host, RESEARCH_DOMAINS) ? 'primary' : null;+ }+}diff --git a/web/src/types/supabase.ts b/web/src/types/supabase.tsindex 915604375..cd97573a9 100644--- a/web/src/types/supabase.ts+++ b/web/src/types/supabase.ts@@ -989,6 +989,7 @@ export type Database = {created_at: stringcreated_by: string | nullid: string+ kept_sources: string[]method: stringmeta_description: string | nullmeta_title: string | null@@ -1022,6 +1023,7 @@ export type Database = {created_at?: stringcreated_by?: string | nullid?: string+ kept_sources?: string[]method?: stringmeta_description?: string | nullmeta_title?: string | null@@ -1055,6 +1057,7 @@ export type Database = {created_at?: stringcreated_by?: string | nullid?: string+ kept_sources?: string[]method?: stringmeta_description?: string | nullmeta_title?: string | null@@ -4278,6 +4281,10 @@ export type Database = {Args: { p_ids: string[]; p_status: string }Returns: number}+ content_draft_keep_source: {+ Args: { p_draft_id: string; p_url: string }+ Returns: string[]+ }content_draft_last_deliveries: {Args: { p_draft_ids: string[] }Returns: {