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-editor): show a version 2 brief's plan in the Brief tab and edit its TL;DR, angle, answers and proof (brief rules PR 9) (#1546)
Cihan54da3b18a92e
diff --git a/web/messages/en.json b/web/messages/en.jsonindex 34d3c1d59..cd4c6f8af 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -4377,6 +4377,58 @@"no_sources": "Keep at least one prompt, fan-out or Search Console query to build from.","failed": "Couldn't rebuild the brief. Try again."},+ "tldr": "TL;DR",+ "angle": "Angle",+ "answerFirst": "Answer first: {answer}",+ "formats": {+ "paragraphs": "Paragraphs",+ "list": "List",+ "steps": "Steps",+ "table": "Table",+ "faq": "FAQ"+ },+ "factSources": {+ "statistic": "Statistic",+ "study": "Study",+ "quote": "Quote",+ "example": "Example",+ "official": "Official source"+ },+ "fact": "{kind}: {claim}",+ "factFrom": "From {source}",+ "factToFind": "Source to find",+ "proof": {+ "title": "Proof to gather",+ "info": "What only your brand can show. Add it in Your input and the Content Agent writes from it.",+ "kinds": {+ "experience": "Experience",+ "data": "Data",+ "case": "Case",+ "test": "Test",+ "quote": "Quote"+ },+ "have": "In Your input",+ "add": "Add input",+ "addFor": "Add input: {what}"+ },+ "notes": {+ "title": "Writing notes",+ "names": "Names as written",+ "brand": "Brand: {name}",+ "products": "Products: {names}",+ "competitors": "Competitors: {names}",+ "links": "Links",+ "link": "<muted>{kind} · </muted>{anchor} <muted>→ {page} · {where}</muted>",+ "internal": "Internal",+ "outbound": "Outbound",+ "inSection": "in “{section}”",+ "anywhere": "anywhere",+ "freshness": "Freshness",+ "datedPoint": "Date: {point}",+ "updatedLine": "Show an “Updated” date",+ "yearInTitle": "Put the year in the title",+ "leftOut": "Left for another page"+ },"editor": {"goal": "Goal","audience": "Audience",@@ -4391,7 +4443,17 @@"cancel": "Cancel","saved": "Brief saved","failed": "Couldn't save the brief. Try again.",- "tooLong": "The brief is too long to save. Shorten its sections or key points."+ "tooLong": "The brief is too long to save. Shorten its sections or key points.",+ "tldr": "TL;DR: what the page's top must say",+ "angle": "Angle: what only this page can show",+ "answer": "Section {index} answer first",+ "answerLabel": "Answer first",+ "answerPlaceholder": "What the section's first sentences must answer",+ "proof": "Proof to gather",+ "proofKind": "Proof {index} kind",+ "proofWhat": "Proof {index}",+ "removeProof": "Remove proof {index}",+ "addProof": "Add proof"}},"export": {diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.test.tsxindex d8cdc262b..0d828e54a 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.test.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.test.tsx@@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import messages from '../../../../../../../../messages/en.json';import type { DraftBrief } from '@/lib/content/brief';import type { DraftMethod } from '@/lib/content/drafts';+import type { InputsGiven } from '@/lib/content/draft-inputs';import { BriefTab, type AgentRewrite, type BriefState } from './_brief-tab';const saveDraftBrief = vi.fn();@@ -53,6 +54,8 @@ async function render(length?: number;method?: DraftMethod;rewrite?: AgentRewrite;+ given?: InputsGiven | null;+ onAddInput?: () => void;} = {},) {await act(async () => {@@ -72,6 +75,8 @@ async function render(onRetry={onRetry}onSaved={onSaved}rewrite={extra.rewrite}+ given={extra.given}+ onAddInput={extra.onAddInput}/></NextIntlClientProvider>,);@@ -403,3 +408,219 @@ describe('the Brief tab', () => {expect(onRetry).toHaveBeenCalled();});});++/** A brief of version 2 (the brief rules, 2026), as the server writes it. */+const planned: DraftBrief = {+ ...brief,+ version: 2,+ tldr: 'Under $500, a single boiler with a PID wins.',+ angle: 'Our own shot-time tests on each machine.',+ proof: [+ { kind: 'test', what: 'Shot times on each machine' },+ { kind: 'data', what: 'Returns by model' },+ ],+ leftOut: ['home espresso grinder'],+ freshness: { datedPoint: 'Each price, with its month', updatedLine: true, yearInTitle: true },+ entities: { brand: 'Acme Coffee', products: ['Barista Pro'], competitors: ['Acme Rival'] },+ links: {+ internal: [+ {+ url: 'https://acme.example/guides/grinders',+ anchor: 'our grinder guide',+ section: 'Care and cleaning',+ },+ ],+ outbound: [{ url: 'https://sca.example/brew', anchor: 'brewing standards', section: null }],+ },+ outline: brief.outline.map((section, i) =>+ i === 0+ ? {+ ...section,+ answer: 'Name the best pick under $500 and why.',+ format: 'table' as const,+ facts: [+ {+ claim: 'Average price of a machine',+ sourceType: 'statistic' as const,+ source: {+ kind: 'cited_page' as const,+ ref: 'https://sca.example/brew',+ label: 'https://sca.example/brew',+ },+ },+ {+ claim: 'Share of buyers who pick a single boiler',+ sourceType: 'study' as const,+ source: null,+ },+ ],+ }+ : section,+ ),+};++const setValue = (el: HTMLInputElement | HTMLTextAreaElement, value: string) => {+ const proto =+ el instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;+ Object.getOwnPropertyDescriptor(proto, 'value')!.set!.call(el, value);+ el.dispatchEvent(new Event('input', { bubbles: true }));+};++describe('a brief of version 2 (the brief rules, 2026)', () => {+ it('shows the TL;DR, the angle and each section’s answer, format and facts', async () => {+ await render({ status: 'ready', brief: planned });+ expect(fields()).toMatchObject({+ 'TL;DR': 'Under $500, a single boiler with a PID wins.',+ Angle: 'Our own shot-time tests on each machine.',+ });+ const first = container.querySelectorAll('ol > li')[0]!.textContent;+ expect(first).toContain('Table');+ expect(first).toContain('Answer first: Name the best pick under $500 and why.');+ expect(first).toContain('Statistic: Average price of a machine');+ expect(first).toContain('From https://sca.example/brew');+ expect(first).toContain('Study: Share of buyers who pick a single boiler');+ expect(first).toContain('Source to find');+ });++ it('lists the proof to gather: marked when Your input has it, else Add input opens it', async () => {+ const onAddInput = vi.fn();+ await render(+ { status: 'ready', brief: planned },+ { given: { experience: false, data: true, quote: false }, onAddInput },+ );+ const rows = [...container.querySelectorAll('section li')].filter((li) =>+ /Shot times|Returns by model/.test(li.textContent ?? ''),+ );+ // A test is the person's experience: not in Your input yet.+ expect(rows[0]!.textContent).toContain('Test');+ expect(rows[0]!.textContent).toContain('Add input');+ expect(rows[1]!.textContent).toContain('In Your input');+ // Each named by its proof, for a screen reader; the visible words in the name.+ await act(async () => button('Add input: Shot times on each machine').click());+ expect(onAddInput).toHaveBeenCalledTimes(1);+ });++ it('offers no Add input until Your input is read', async () => {+ await render({ status: 'ready', brief: planned }, { given: null, onAddInput: vi.fn() });+ expect(container.textContent).toContain('Proof to gather');+ expect(container.textContent).not.toContain('Add input');+ });++ it('folds the writing notes until opened: names, links, freshness, fan-outs left out', async () => {+ await render({ status: 'ready', brief: planned });+ const notes = button('Writing notes');+ const region = document.getElementById(notes.getAttribute('aria-controls')!)!;+ expect(notes.getAttribute('aria-expanded')).toBe('false');+ // In the page, hidden while folded, so aria-controls names it.+ expect(region.hidden).toBe(true);+ await act(async () => notes.click());+ expect(notes.getAttribute('aria-expanded')).toBe('true');+ expect(region.hidden).toBe(false);+ const text = region.textContent ?? '';+ expect(text).toContain('Brand: Acme Coffee');+ expect(text).toContain('Products: Barista Pro');+ expect(text).toContain('Competitors: Acme Rival');+ expect(text).toContain('our grinder guide');+ expect(text).toContain('in “Care and cleaning”');+ expect(text).toContain('Internal · our grinder guide → /guides/grinders');+ // An outbound link names its site.+ expect(text).toContain('Outbound · brewing standards → sca.example/brew · anywhere');+ expect(text).toContain('Date: Each price, with its month');+ expect(text).toContain('Show an “Updated” date');+ expect(text).toContain('Put the year in the title');+ expect(text).toContain('home espresso grinder');+ });++ it('shows none of it for a brief before version 2', async () => {+ await render({ status: 'ready', brief });+ expect(container.textContent).not.toContain('Proof to gather');+ expect(container.textContent).not.toContain('Writing notes');+ expect(fields()).not.toHaveProperty('TL;DR');+ });++ it('edits the TL;DR, the angle, each section’s answer and the proof to gather', async () => {+ saveDraftBrief.mockImplementation(async (_id, next: DraftBrief) => ({ ...next }));+ await render({ status: 'ready', brief: planned });+ await act(async () => button('Edit brief').click());+ const area = (label: string) =>+ container.querySelector<HTMLTextAreaElement>(`textarea[aria-label="${label}"]`)!;+ const labelled = (text: string) =>+ [...container.querySelectorAll('label')]+ .find((l) => l.textContent?.startsWith(text))!+ .querySelector('textarea')!;+ await act(async () => {+ setValue(labelled('TL;DR'), ' A PID machine wins under $500. ');+ setValue(labelled('Angle'), '');+ setValue(area('Section 1 answer first'), ' Name the pick. ');+ setValue(+ container.querySelector<HTMLInputElement>('input[aria-label="Proof 2"]')!,+ ' Returns by model, 2026 ',+ );+ });+ await act(async () => button('Remove proof 1').click());+ await act(async () => button('Add proof').click());+ await act(async () => button('Save brief').click());+ const saved = saveDraftBrief.mock.calls[0][1] as DraftBrief;+ expect(saved).toMatchObject({+ tldr: 'A PID machine wins under $500.',+ angle: null,+ // An empty proof added goes.+ proof: [{ kind: 'data', what: 'Returns by model, 2026' }],+ // The notes it doesn't edit stay.+ entities: planned.entities,+ links: planned.links,+ freshness: planned.freshness,+ leftOut: planned.leftOut,+ });+ expect(saved.outline[0]).toMatchObject({+ answer: 'Name the pick.',+ format: 'table',+ facts: planned.outline[0].facts,+ });+ expect(saved.outline[1].answer).toBeNull();+ });++ it('adds no version 2 fields to an older brief it edits', async () => {+ saveDraftBrief.mockImplementation(async (_id, next: DraftBrief) => ({ ...next }));+ await render({ status: 'ready', brief });+ await act(async () => button('Edit brief').click());+ expect(container.textContent).not.toContain('TL;DR');+ await act(async () => button('Save brief').click());+ const saved = saveDraftBrief.mock.calls[0][1] as DraftBrief;+ expect(saved).not.toHaveProperty('tldr');+ expect(saved.outline[0]).not.toHaveProperty('answer');+ });++ it('changes a proof’s kind, and offers no more than six', async () => {+ saveDraftBrief.mockImplementation(async (_id, next: DraftBrief) => ({ ...next }));+ await render({ status: 'ready', brief: planned });+ await act(async () => button('Edit brief').click());+ const click = async (el: Element | undefined) => {+ await act(async () => {+ el!.dispatchEvent(new MouseEvent('pointerdown', { bubbles: true }));+ (el as HTMLElement).click();+ });+ };+ await click(container.querySelector('[aria-label="Proof 2 kind"]')!);+ const quote = [...document.querySelectorAll<HTMLElement>('[role="option"]')].find(+ (o) => o.textContent === 'Quote',+ )!;+ // Base UI picks the highlighted option: the pointer moves onto it first.+ await act(async () => {+ quote.dispatchEvent(new MouseEvent('mousemove', { bubbles: true }));+ });+ await click(quote);+ for (let i = 0; i < 4; i++) await act(async () => button('Add proof').click());+ // Six: no more to add.+ expect(container.querySelectorAll('input[aria-label^="Proof "]')).toHaveLength(6);+ expect(+ [...container.querySelectorAll('button')].some((b) => b.textContent === 'Add proof'),+ ).toBe(false);+ await act(async () => button('Save brief').click());+ const saved = saveDraftBrief.mock.calls[0][1] as DraftBrief;+ expect(saved.proof).toEqual([+ { kind: 'test', what: 'Shot times on each machine' },+ { kind: 'quote', what: 'Returns by model' },+ ]);+ });+});diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsxindex 4f483a92c..5929f0056 100644--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsx+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsx@@ -1,15 +1,30 @@'use client';-import { useState } from 'react';+import { useId, useState } from 'react';import { useTranslations } from 'next-intl';import { toast } from 'sonner';-import { Bot, Pencil, Plus, Trash2 } from 'lucide-react';+import { Bot, Check, ChevronDown, Pencil, Plus, Trash2 } from 'lucide-react';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+} from '@/components/ui/select';import { Textarea } from '@/components/ui/textarea';import { LoadingDots } from '@/components/ui/loading-dots';import { saveDraftBrief } from '@/lib/actions/content-drafts';-import { MAX_BRIEF_SECTIONS, builtFromCount, type DraftBrief } from '@/lib/content/brief';+import type { InputsGiven } from '@/lib/content/draft-inputs';+import {+ BRIEF_V2_LIMITS,+ MAX_BRIEF_SECTIONS,+ PROOF_KINDS,+ builtFromCount,+ type DraftBrief,+ type ProofKind,+} from '@/lib/content/brief';import type { DraftMethod } from '@/lib/content/drafts';import { platformNames } from '@/lib/content/impact';import { pagePath } from '@/lib/content/overlap';@@ -37,6 +52,15 @@ export type BriefState =| { status: 'failed' }| { status: 'ready'; brief: DraftBrief | null };+/** The input a kind of proof is given as: a case or a test is the person's experience. */+const PROOF_INPUT: Record<ProofKind, keyof InputsGiven> = {+ experience: 'experience',+ case: 'experience',+ test: 'experience',+ data: 'data',+ quote: 'quote',+};+/*** The Brief segment (Content Editor CE-007, spec §10; v1.1 CE-030): a card* saying whether there is a brief, with Run Agent to write it from the@@ -46,6 +70,12 @@ export type BriefState =* brief changes it by hand. Until the draft has a brief, the opportunity's* brief it started from is shown. Rewrite from brief hands the page to the* Content Agent with it.+ *+ * A brief of version 2 (the brief rules, 2026) shows its plan too: the+ * TL;DR and angle, each section's answer, format and facts, the brand's own+ * proof to gather (marked when Your input has it), and, folded, the writing+ * notes: names as written, links, freshness and the fan-outs left for+ * another page.*/export function BriefTab({draftId,@@ -61,6 +91,8 @@ export function BriefTab({rewrite,dataLine,blocked = null,+ given = null,+ onAddInput,}: {draftId: string;state: BriefState;@@ -79,6 +111,10 @@ export function BriefTab({dataLine?: React.ReactNode;/** Why Run Agent waits (another agent run from the page), or null. */blocked?: string | null;+ /** What Your input has, once read (draft-inputs.ts inputsGiven): proof it has is marked. */+ given?: InputsGiven | null;+ /** Opens Brief › Your input, for a proof to gather. */+ onAddInput?: () => void;}) {const t = useTranslations('contentEditor.editor.brief');const tTypes = useTranslations('contentEditor.pageTypes');@@ -186,6 +222,18 @@ export function BriefTab({<dd className={cn(!brief?.audience && 'text-muted-foreground')}>{brief?.audience || t('notSet')}</dd>+ {brief?.tldr && (+ <>+ <dt className="text-muted-foreground">{t('tldr')}</dt>+ <dd>{brief.tldr}</dd>+ </>+ )}+ {brief?.angle && (+ <>+ <dt className="text-muted-foreground">{t('angle')}</dt>+ <dd>{brief.angle}</dd>+ </>+ )}<dt className="text-muted-foreground">{t('length')}</dt><dd>{t('lengthValue', {@@ -212,10 +260,18 @@ export function BriefTab({<ol className="space-y-1.5">{brief.outline.map((section, i) => (<li key={i} className="rounded-lg border px-3 py-2">- <p className="text-xs font-medium">- <span className="mr-1.5 text-muted-foreground">H2</span>- {section.heading}+ <p className="flex items-start gap-1.5 text-xs font-medium">+ <span className="text-muted-foreground">H2</span>+ <span className="min-w-0 flex-1">{section.heading}</span>+ {section.format && (+ <span className="shrink-0 rounded-md border px-1.5 text-[10.5px] font-normal text-muted-foreground">+ {t(`formats.${section.format}`)}+ </span>+ )}</p>+ {section.answer && (+ <p className="mt-1 text-xs">{t('answerFirst', { answer: section.answer })}</p>+ )}{section.keyPoints.length > 0 && (<ul className="mt-1 list-disc space-y-0.5 pl-4 text-xs text-muted-foreground">{section.keyPoints.map((point, j) => (@@ -223,6 +279,28 @@ export function BriefTab({))}</ul>)}+ {(section.facts ?? []).length > 0 && (+ <ul className="mt-1.5 space-y-1 text-[11px]">+ {(section.facts ?? []).map((fact, j) => (+ <li key={j} className="min-w-0">+ <span className="break-words">+ {t('fact', {+ kind: t(`factSources.${fact.sourceType}`),+ claim: fact.claim,+ })}+ </span>+ <span+ className="block truncate text-muted-foreground"+ title={fact.source?.label}+ >+ {fact.source+ ? t('factFrom', { source: fact.source.label })+ : t('factToFind')}+ </span>+ </li>+ ))}+ </ul>+ )}{section.fanout && (<p className="mt-1.5 inline-flex max-w-full items-center gap-1 rounded-md bg-muted px-1.5 py-0.5 text-[11px]"><span className="truncate" title={section.fanout}>@@ -245,6 +323,10 @@ export function BriefTab({</p>)}+ {brief?.proof && brief.proof.length > 0 && (+ <ProofList proof={brief.proof} given={given} onAddInput={onAddInput} />+ )}+{brief && brief.keywords.length > 0 && (<section className="space-y-1.5"><h4 className="text-xs font-medium text-muted-foreground">{t('keywords')}</h4>@@ -258,6 +340,8 @@ export function BriefTab({</section>)}+ {brief && <WritingNotes brief={brief} />}+{brief && !empty && (<p className="text-[11px] text-muted-foreground">{brief.origin === 'opportunity'@@ -320,6 +404,175 @@ export function BriefTab({);}+/**+ * The brand's own proof to gather, each with its kind: marked when Brief ›+ * Your input has that kind, else Add input opens it.+ */+function ProofList({+ proof,+ given,+ onAddInput,+}: {+ proof: NonNullable<DraftBrief['proof']>;+ given: InputsGiven | null;+ onAddInput?: () => void;+}) {+ const t = useTranslations('contentEditor.editor.brief.proof');+ return (+ <section className="space-y-1.5">+ <h4 className="text-xs font-medium text-muted-foreground">{t('title')}</h4>+ <p className="text-[11px] text-muted-foreground">{t('info')}</p>+ <ul className="space-y-1.5">+ {proof.map((item, i) => {+ const have = given?.[PROOF_INPUT[item.kind]] === true;+ return (+ <li key={i} className="flex items-start gap-2 rounded-lg border px-3 py-2 text-xs">+ <span className="shrink-0 rounded-md bg-muted px-1.5 text-[10.5px]">+ {t(`kinds.${item.kind}`)}+ </span>+ <span className="min-w-0 flex-1 break-words">{item.what}</span>+ {have ? (+ <span className="inline-flex shrink-0 items-center gap-1 text-[11px] text-emerald-700 dark:text-emerald-400">+ <Check className="h-3 w-3" aria-hidden />+ {t('have')}+ </span>+ ) : (+ onAddInput &&+ given && (+ <button+ type="button"+ className="shrink-0 text-[11px] font-medium underline"+ // Each row's own name: "Add input" alone says nothing out of context.+ aria-label={t('addFor', { what: item.what })}+ onClick={onAddInput}+ >+ {t('add')}+ </button>+ )+ )}+ </li>+ );+ })}+ </ul>+ </section>+ );+}++/**+ * The writing notes of version 2, folded until opened: names as written,+ * the links planned, freshness and the fan-outs left for another page. The+ * writer reads them; they aren't edited here.+ */+function WritingNotes({ brief }: { brief: DraftBrief }) {+ const t = useTranslations('contentEditor.editor.brief.notes');+ const [open, setOpen] = useState(false);+ const id = useId();+ const names = brief.entities;+ const links = [+ ...(brief.links?.internal ?? []).map((link) => ({ ...link, kind: 'internal' as const })),+ ...(brief.links?.outbound ?? []).map((link) => ({ ...link, kind: 'outbound' as const })),+ ];+ const fresh = brief.freshness;+ const leftOut = brief.leftOut ?? [];+ const hasNames =+ !!names && (!!names.brand || names.products.length + names.competitors.length > 0);+ if (!hasNames && !links.length && !fresh && !leftOut.length) return null;+ const muted = (chunks: React.ReactNode) => (+ <span className="text-muted-foreground">{chunks}</span>+ );+ return (+ <section className="overflow-hidden rounded-lg border">+ <h4 className="text-xs font-medium">+ <button+ type="button"+ aria-expanded={open}+ aria-controls={id}+ onClick={() => setOpen((o) => !o)}+ className="flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none focus-visible:ring-inset"+ >+ {t('title')}+ <ChevronDown+ aria-hidden+ className={cn('ml-auto h-4 w-4 shrink-0 transition-transform', open && 'rotate-180')}+ />+ </button>+ </h4>+ {/* Kept in the page, hidden while folded, so aria-controls names it. */}+ <dl id={id} hidden={!open} className="space-y-2 border-t px-3 py-2 text-xs">+ {hasNames && names && (+ <div>+ <dt className="text-muted-foreground">{t('names')}</dt>+ <dd className="space-y-0.5 break-words">+ {names.brand && <p>{t('brand', { name: names.brand })}</p>}+ {names.products.length > 0 && (+ <p>{t('products', { names: names.products.join(', ') })}</p>+ )}+ {names.competitors.length > 0 && (+ <p>{t('competitors', { names: names.competitors.join(', ') })}</p>+ )}+ </dd>+ </div>+ )}+ {links.length > 0 && (+ <div>+ <dt className="text-muted-foreground">{t('links')}</dt>+ <dd>+ <ul className="space-y-0.5">+ {links.map((link, i) => (+ <li key={i} className="min-w-0 break-words" title={link.url}>+ {t.rich('link', {+ kind: t(link.kind),+ anchor: link.anchor,+ // An outbound link names its site; the brand's own, its page.+ page: link.kind === 'outbound' ? sitePage(link.url) : pagePath(link.url),+ where: link.section+ ? t('inSection', { section: link.section })+ : t('anywhere'),+ muted,+ })}+ </li>+ ))}+ </ul>+ </dd>+ </div>+ )}+ {fresh && (+ <div>+ <dt className="text-muted-foreground">{t('freshness')}</dt>+ <dd className="space-y-0.5 break-words">+ {fresh.datedPoint && <p>{t('datedPoint', { point: fresh.datedPoint })}</p>}+ {fresh.updatedLine && <p>{t('updatedLine')}</p>}+ {fresh.yearInTitle && <p>{t('yearInTitle')}</p>}+ </dd>+ </div>+ )}+ {leftOut.length > 0 && (+ <div>+ <dt className="text-muted-foreground">{t('leftOut')}</dt>+ <dd>+ <ul className="list-disc pl-4 break-words">+ {leftOut.map((query, i) => (+ <li key={i}>{query}</li>+ ))}+ </ul>+ </dd>+ </div>+ )}+ </dl>+ </section>+ );+}++/** A page on another site, as a writer tells it apart: its host and path. */+function sitePage(url: string): string {+ try {+ const parsed = new URL(url);+ return `${parsed.hostname.replace(/^www\./, '')}${parsed.pathname.replace(/\/$/, '')}`;+ } catch {+ return url;+ }+}+/** What Edit brief starts from when the draft has no brief: H2s added by hand. */const EMPTY_BRIEF: DraftBrief = {goal: '',@@ -350,6 +603,12 @@ function BriefEditor({brief.outline.map((s) => ({ ...s, points: s.keyPoints.join('\n') })),);const [keywords, setKeywords] = useState(brief.keywords.join(', '));+ // Version 2's plan, edited as the rest; a brief before it gets none added.+ // Read once, when Edit opens: a rebuild landing meanwhile doesn't change the form.+ const [v2] = useState(brief.version === 2);+ const [tldr, setTldr] = useState(brief.tldr ?? '');+ const [angle, setAngle] = useState(brief.angle ?? '');+ const [proof, setProof] = useState(brief.proof ?? []);const [saving, setSaving] = useState(false);const update = (index: number, change: Partial<(typeof sections)[number]>) =>@@ -362,7 +621,17 @@ function BriefEditor({...brief,goal: goal.trim(),audience: audience.trim(),- // What Edit brief doesn't show (version 2's answer, format, facts) is kept.+ ...(v2+ ? {+ tldr: tldr.trim() || null,+ angle: angle.trim() || null,+ proof: proof+ .map((p) => ({ ...p, what: p.what.trim() }))+ .filter((p) => p.what)+ .slice(0, BRIEF_V2_LIMITS.proof),+ }+ : {}),+ // What Edit brief doesn't show (version 2's format, facts) is kept.outline: sections.filter((s) => s.heading.trim()).map(({ points, ...s }) => ({@@ -372,6 +641,7 @@ function BriefEditor({.split('\n').map((p) => p.trim()).filter(Boolean),+ ...(v2 ? { answer: s.answer?.trim() || null } : {}),})),keywords: [...new Set(@@ -402,6 +672,28 @@ function BriefEditor({<span className="text-xs text-muted-foreground">{t('audience')}</span><Input value={audience} onChange={(e) => setAudience(e.target.value)} maxLength={500} /></label>+ {v2 && (+ <>+ <label className="block space-y-1">+ <span className="text-xs text-muted-foreground">{t('tldr')}</span>+ <Textarea+ value={tldr}+ onChange={(e) => setTldr(e.target.value)}+ rows={2}+ maxLength={BRIEF_V2_LIMITS.tldr}+ />+ </label>+ <label className="block space-y-1">+ <span className="text-xs text-muted-foreground">{t('angle')}</span>+ <Textarea+ value={angle}+ onChange={(e) => setAngle(e.target.value)}+ rows={2}+ maxLength={BRIEF_V2_LIMITS.angle}+ />+ </label>+ </>+ )}<div className="space-y-2"><span className="text-xs text-muted-foreground">{t('outline')}</span>{sections.map((section, i) => (@@ -424,6 +716,21 @@ function BriefEditor({<Trash2 className="h-3.5 w-3.5" /></Button></div>+ {v2 && (+ <div className="space-y-1">+ {/* Named on screen: once filled, its placeholder is gone. */}+ <span className="text-[11px] text-muted-foreground">{t('answerLabel')}</span>+ <Textarea+ value={section.answer ?? ''}+ onChange={(e) => update(i, { answer: e.target.value })}+ aria-label={t('answer', { index: i + 1 })}+ placeholder={t('answerPlaceholder')}+ rows={2}+ maxLength={BRIEF_V2_LIMITS.answer}+ className="text-xs"+ />+ </div>+ )}<Textareavalue={section.points}onChange={(e) => update(i, { points: e.target.value })}@@ -450,6 +757,7 @@ function BriefEditor({</Button>)}</div>+ {v2 && <ProofEditor proof={proof} onChange={setProof} />}<label className="block space-y-1"><span className="text-xs text-muted-foreground">{t('keywords')}</span><Input value={keywords} onChange={(e) => setKeywords(e.target.value)} />@@ -466,3 +774,74 @@ function BriefEditor({</div>);}++/** Edit brief's proof to gather: each with its kind, up to the web's limit. */+function ProofEditor({+ proof,+ onChange,+}: {+ proof: NonNullable<DraftBrief['proof']>;+ onChange: (proof: NonNullable<DraftBrief['proof']>) => void;+}) {+ const t = useTranslations('contentEditor.editor.brief');+ const items = PROOF_KINDS.map((kind) => ({ value: kind, label: t(`proof.kinds.${kind}`) }));+ const set = (index: number, change: Partial<(typeof proof)[number]>) =>+ onChange(proof.map((p, i) => (i === index ? { ...p, ...change } : p)));+ return (+ <div className="space-y-1.5">+ <span className="text-xs text-muted-foreground">{t('editor.proof')}</span>+ {proof.map((item, i) => (+ <div key={i} className="flex items-center gap-1.5">+ <Select+ items={items}+ value={item.kind}+ onValueChange={(value) => {+ if ((PROOF_KINDS as readonly string[]).includes(String(value))) {+ set(i, { kind: value as ProofKind });+ }+ }}+ >+ <SelectTrigger+ aria-label={t('editor.proofKind', { index: i + 1 })}+ className="h-8 w-28"+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {items.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <Input+ value={item.what}+ onChange={(e) => set(i, { what: e.target.value })}+ aria-label={t('editor.proofWhat', { index: i + 1 })}+ maxLength={BRIEF_V2_LIMITS.proofWhat}+ className="h-8"+ />+ <Button+ variant="ghost"+ size="icon-sm"+ aria-label={t('editor.removeProof', { index: i + 1 })}+ onClick={() => onChange(proof.filter((_, j) => j !== i))}+ >+ <Trash2 className="h-3.5 w-3.5" />+ </Button>+ </div>+ ))}+ {proof.length < BRIEF_V2_LIMITS.proof && (+ <Button+ variant="ghost"+ size="sm"+ onClick={() => onChange([...proof, { kind: 'experience', what: '' }])}+ >+ <Plus className="h-3.5 w-3.5" />+ {t('editor.addProof')}+ </Button>+ )}+ </div>+ );+}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 061bf513b..e4850bead 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@@ -7,6 +7,7 @@ import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';import { rulesForBrief, useRuleDescriber } from '@/lib/content/agent-write';import { isPageType, type ContentDraft } from '@/lib/content/drafts';import type { SiteType } from '@/lib/content/page-types';+import { inputsGiven } from '@/lib/content/draft-inputs';import { buildSourceGroups, includedCounts, type DraftSourceKind } from '@/lib/content/sources';import { formatNumber } from '@/lib/format';import { BAND_CLASSES, qualityBand, qualityPhase } from '@/lib/content/quality';@@ -472,6 +473,8 @@ export function EditorSidePanel({rewrite={agentRewrite}dataLine={dataLine}blocked={briefBlocked}+ given={yourInput?.status === 'ready' ? inputsGiven(yourInput.inputs) : null}+ onAddInput={onAddInput}/></div>)}diff --git a/web/src/lib/content/draft-inputs.ts b/web/src/lib/content/draft-inputs.tsindex bd69b079a..f9a32193c 100644--- a/web/src/lib/content/draft-inputs.ts+++ b/web/src/lib/content/draft-inputs.ts@@ -184,11 +184,14 @@ export function tableThatFits(tables: InputTable[], table: InputTable): InputTab}/** Which kinds of input the person gave, used or not. */-export function inputsGiven(inputs: DraftInputs): {+export interface InputsGiven {experience: boolean;data: boolean;quote: boolean;-} {+}++/** Which kinds of input the person gave, used or not. */+export function inputsGiven(inputs: DraftInputs): InputsGiven {return {experience: inputs.experience.trim().length > 0,data: inputs.data.length > 0 || inputs.ansvisorData.length > 0,