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): show the cited pages' length next to the brief's Length (CE-030) (#1402)
Cihan0db84e06081e
diff --git a/server/src/lib/content-brief.js b/server/src/lib/content-brief.jsindex d32e52543..88eb8f4c5 100644--- a/server/src/lib/content-brief.js+++ b/server/src/lib/content-brief.js@@ -13,6 +13,7 @@ import {startRun,stopIfStopped,} from './content-runs.js';+import { citedPagesLength } from './content-cited-length.js';import { reserveAiBudget } from './plan-guard.js';/**@@ -205,6 +206,13 @@ async function briefWithRun({ draft, draftId, brand, prompts, sources, run }) {modelId,draftId,});+ // The cited pages' length, read beside the model call (CE-030); never fails it.+ const citedLength = citedPagesLength({+ brandId: draft.brand_id,+ pages: sources.pages,+ ownUrl: draft.source_url,+ signal: run.signal,+ });let generated;try {@@ -249,6 +257,7 @@ async function briefWithRun({ draft, draftId, brand, prompts, sources, run }) {pages: sources.pages.length,queries: sources.queries.length,},+ citedLength: await citedLength,};// Stopped meanwhile: the brief stays as it was.await stopIfStopped(run);diff --git a/server/src/lib/content-brief.test.js b/server/src/lib/content-brief.test.jsindex 50a290b0b..a5c2e9e69 100644--- a/server/src/lib/content-brief.test.js+++ b/server/src/lib/content-brief.test.js@@ -52,6 +52,10 @@ vi.mock('./plan-guard.js', async (importOriginal) => ({reserveAiBudget: (...args) => reserveAiBudget(...args),}));vi.mock('./logger.js', () => ({ logger: { error: vi.fn(), warn: vi.fn() } }));+const citedPagesLength = vi.fn();+vi.mock('./content-cited-length.js', () => ({+ citedPagesLength: (...args) => citedPagesLength(...args),+}));const stopIfStopped = vi.fn();vi.mock('./content-runs.js', async (importOriginal) => ({...(await importOriginal()),@@ -95,6 +99,7 @@ const outline = [beforeEach(() => {stopIfStopped.mockReset().mockResolvedValue(undefined);+ citedPagesLength.mockReset().mockResolvedValue({ characters: 4300, pages: 1 });writes = [];filters = [];rows = {@@ -152,6 +157,15 @@ describe('rebuildDraftBrief', () => {keywords: ['espresso', 'grinder'],origin: 'rebuild',builtFrom: { prompts: 1, fanouts: 2, pages: 1, queries: 1 },+ // The cited pages' length (CE-030), read without the draft's own page.+ citedLength: { characters: 4300, pages: 1 },+ });+ expect(citedPagesLength).toHaveBeenCalledWith({+ brandId: BRAND,+ pages: [{ url: 'https://www.reddit.com/r/espresso/x', kind: 'forum' }],+ ownUrl: 'https://acme.example/guides/espresso',+ // The run's Stop ends the reads at once.+ signal: expect.any(AbortSignal),});expect(brief.outline).toEqual([{diff --git a/server/src/lib/content-cited-length.js b/server/src/lib/content-cited-length.jsnew file mode 100644index 000000000..d5771bf8c--- /dev/null+++ b/server/src/lib/content-cited-length.js@@ -0,0 +1,117 @@+import supabaseAdmin from '../config/supabase.js';+import { linkKey } from './content-links.js';+import { logger } from './logger.js';+import { MAX_CONTENT_LENGTH, extractPageContent, textLength } from './page-content.js';+import { fetchPage } from './safe-fetch.js';++/**+ * The cited pages' length (Content Editor v1.1, CE-030): the brief's Length+ * says "From the rules · a typical cited page has 4,300 characters", a benchmark+ * read when the brief is rebuilt. The first few cited pages kept in Sources+ * are read, their main text counted as the Rules tab counts length.+ *+ * Only addresses AI answers cited for the brand are read — never one a+ * request names alone — and only public ones (safe-fetch). Nothing read is+ * kept but the figure.+ */++/** How many cited pages a rebuild reads, and how long each may take. */+export const CITED_LENGTH_PAGES = 5;+const READ_TIMEOUT_MS = 8_000;+/** Fewer read than this, and one page would stand for "cited pages": no benchmark. */+export const CITED_MIN_PAGES = 2;+/** Shorter than this, what was read is a wall (a sign-in, a consent page), not the page. */+export const CITED_MIN_CHARACTERS = 500;++/** One page's main text length; it throws when the page can't be read, or `signal` ends it. */+async function readLength(url, signal) {+ const page = await fetchPage(url, { timeoutMs: READ_TIMEOUT_MS, signal });+ const content = extractPageContent(page.html, page.url);+ // Past what a page brought into the editor may be (content-pages.js): no benchmark.+ if (content.html.length > MAX_CONTENT_LENGTH) return null;+ return textLength(content.html);+}++/**+ * The first few addresses, in their order, that AI answers cited for the+ * brand: checked a few at a time, until enough are found.+ */+async function brandCited(brandId, urls) {+ const found = [];+ for (+ let at = 0;+ at < urls.length && found.length < CITED_LENGTH_PAGES;+ at += CITED_LENGTH_PAGES+ ) {+ const batch = urls.slice(at, at + CITED_LENGTH_PAGES);+ const { data, error } = await supabaseAdmin+ .from('citation_urls')+ .select('id, url')+ .in('url', batch);+ if (error) throw error;+ const cited = await Promise.all(+ (data ?? []).map(async (row) => {+ const { data: hit, error: hitError } = await supabaseAdmin+ .from('prompt_result_citations')+ .select('url_id')+ .eq('url_id', row.id)+ .eq('brand_id', brandId)+ .limit(1);+ if (hitError) throw hitError;+ return hit?.length ? row.url : null;+ }),+ );+ found.push(...batch.filter((url) => cited.includes(url)));+ }+ return found.slice(0, CITED_LENGTH_PAGES);+}++/** The middle of the lengths: one very long page (an encyclopedia's) doesn't set the bar. */+function median(lengths) {+ const sorted = [...lengths].sort((a, b) => a - b);+ const mid = Math.floor(sorted.length / 2);+ return sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;+}++/**+ * How long the cited pages kept are: the median of those read, rounded to a+ * hundred, and how many were read; null when fewer than two could be (no+ * number is made up). The page the draft optimizes is left out, however its address+ * was cited (www, tracking parameters): it is no benchmark for itself.+ *+ * @param {{ brandId: string, pages: { url: string }[], ownUrl?: string | null, signal?: AbortSignal | null }} input+ * `signal`: the run's Stop, which settles it on null at once.+ * @param {{ read?: (url: string) => Promise<number | null> }} [deps] tests replace the read+ * @returns {Promise<{ characters: number, pages: number } | null>}+ */+export async function citedPagesLength(+ { brandId, pages, ownUrl = null, signal = null },+ { read = readLength } = {},+) {+ // The run's Stop ends the reads, and the wait for them, at once.+ const stopped = new Promise((resolve) => {+ if (signal?.aborted) resolve(null);+ signal?.addEventListener('abort', () => resolve(null), { once: true });+ });+ return Promise.race([stopped, measure({ brandId, pages, ownUrl, signal }, read)]);+}++async function measure({ brandId, pages, ownUrl, signal }, read) {+ try {+ const own = ownUrl ? linkKey(ownUrl) : null;+ const urls = [...new Set(pages.map((p) => p.url))].filter(+ (url) => !own || linkKey(url) !== own,+ );+ if (!urls.length) return null;+ const picked = await brandCited(brandId, urls);+ const lengths = (+ await Promise.all(picked.map((url) => read(url, signal).catch(() => null)))+ ).filter((n) => Number.isFinite(n) && n >= CITED_MIN_CHARACTERS);+ if (lengths.length < CITED_MIN_PAGES) return null;+ return { characters: Math.round(median(lengths) / 100) * 100, pages: lengths.length };+ } catch (err) {+ // A benchmark is never worth the brief: it goes without one.+ logger.warn({ err }, 'cited pages length read failed');+ return null;+ }+}diff --git a/server/src/lib/content-cited-length.test.js b/server/src/lib/content-cited-length.test.jsnew file mode 100644index 000000000..7aadfdff7--- /dev/null+++ b/server/src/lib/content-cited-length.test.js@@ -0,0 +1,187 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';++/**+ * The cited pages' length (CE-030): a benchmark read when the brief is+ * rebuilt, only from addresses AI answers cited for the brand.+ */++const BRAND = '33333333-3333-3333-3333-333333333333';++let urlRows;+let citedIds;+let failRead;+const asked = [];++vi.mock('../config/supabase.js', () => ({+ default: {+ from: (table) => {+ const call = { table, filters: [] };+ asked.push(call);+ const chain = {+ select: () => chain,+ in: (col, v) => (call.filters.push(['in', col, v]), chain),+ eq: (col, v) => (call.filters.push(['eq', col, v]), chain),+ limit: async () => {+ const id = call.filters.find(([, col]) => col === 'url_id')?.[2];+ return { data: citedIds.includes(id) ? [{ url_id: id }] : [], error: null };+ },+ then: (resolve) => {+ if (failRead) return resolve({ data: null, error: new Error('down') });+ const urls = call.filters.find(([, col]) => col === 'url')[2];+ return resolve({ data: urlRows.filter((r) => urls.includes(r.url)), error: null });+ },+ };+ return chain;+ },+ },+}));+vi.mock('./logger.js', () => ({ logger: { warn: vi.fn(), error: vi.fn() } }));+const fetchPage = vi.fn();+vi.mock('./safe-fetch.js', () => ({ fetchPage: (...args) => fetchPage(...args) }));++const { CITED_LENGTH_PAGES, citedPagesLength } = await import('./content-cited-length.js');++const url = (n) => `https://site${n}.example/a`;+const page = (n) => ({ url: url(n), kind: 'blog' });+const lookups = () => asked.filter((c) => c.table === 'citation_urls');++beforeEach(() => {+ urlRows = Array.from({ length: 8 }, (_, i) => ({ id: i + 1, url: url(i + 1) }));+ citedIds = urlRows.map((r) => r.id);+ failRead = false;+ asked.length = 0;+ fetchPage.mockReset();+});++describe('citedPagesLength', () => {+ it('takes the middle of the cited pages read, rounded to a hundred', async () => {+ const lengths = { [url(1)]: 4210, [url(2)]: 4400, [url(3)]: 3000 };+ const read = vi.fn(async (address) => lengths[address]);+ expect(+ await citedPagesLength({ brandId: BRAND, pages: [page(1), page(2), page(3)] }, { read }),+ ).toEqual({ characters: 4200, pages: 3 });+ // Each address checked against the brand's own citations.+ const checks = asked.filter((c) => c.table === 'prompt_result_citations');+ expect(checks).toHaveLength(3);+ expect(checks[0].filters).toContainEqual(['eq', 'brand_id', BRAND]);+ });++ it('isn’t pulled up by one very long page, an encyclopedia’s', async () => {+ const lengths = { [url(1)]: 4000, [url(2)]: 104_100, [url(3)]: 4400, [url(4)]: 3800 };+ const read = vi.fn(async (address) => lengths[address]);+ expect(+ await citedPagesLength({ brandId: BRAND, pages: [1, 2, 3, 4].map(page) }, { read }),+ ).toEqual({ characters: 4200, pages: 4 });+ });++ it('reads only addresses AI answers cited for the brand, never one a request names alone', async () => {+ citedIds = [2, 3];+ const read = vi.fn(async () => 5000);+ const result = await citedPagesLength(+ {+ brandId: BRAND,+ pages: [page(1), page(2), { url: 'http://169.254.169.254/', kind: 'x' }, page(3)],+ },+ { read },+ );+ expect(read.mock.calls.map(([address]) => address)).toEqual([url(2), url(3)]);+ expect(result).toEqual({ characters: 5000, pages: 2 });+ });++ it('leaves out the draft’s own page, however its address was cited', async () => {+ const cited = 'https://www.site1.example/a/?utm_source=chatgpt.com';+ urlRows.push({ id: 9, url: cited });+ citedIds.push(9);+ const read = vi.fn(async () => 2000);+ await citedPagesLength(+ { brandId: BRAND, pages: [{ url: cited }, page(2)], ownUrl: url(1) },+ { read },+ );+ expect(read.mock.calls.map(([address]) => address)).toEqual([url(2)]);+ });++ it('reads at most a few, in the Sources order, and stops looking once it has them', async () => {+ const read = vi.fn(async () => 2000);+ await citedPagesLength(+ { brandId: BRAND, pages: urlRows.map((r) => ({ url: r.url })) },+ { read },+ );+ expect(read.mock.calls.map(([address]) => address)).toEqual(+ [1, 2, 3, 4, 5].map(url).slice(0, CITED_LENGTH_PAGES),+ );+ expect(lookups()).toHaveLength(1);+ expect(lookups()[0].filters[0][2]).toHaveLength(CITED_LENGTH_PAGES);++ // The first few weren't cited for the brand: it looks further.+ citedIds = [6, 7];+ asked.length = 0;+ read.mockClear();+ await citedPagesLength(+ { brandId: BRAND, pages: urlRows.map((r) => ({ url: r.url })) },+ { read },+ );+ expect(read.mock.calls.map(([address]) => address)).toEqual([url(6), url(7)]);+ expect(lookups()).toHaveLength(2);+ });++ it('counts a page’s main text as the Rules tab counts length; one that can’t be read is none', async () => {+ const words = 'Espresso needs a fine, even grind and fresh beans. '.repeat(20);+ fetchPage.mockImplementation(async (address) => {+ if (address === url(3)) throw Object.assign(new Error('HTTP 404'), { code: 'http_error' });+ return {+ url: address,+ status: 200,+ html: `<html><body><main><h1>Guide</h1><p>${words}</p></main></body></html>`,+ };+ });+ const result = await citedPagesLength({ brandId: BRAND, pages: [1, 2, 3].map(page) });+ expect(fetchPage).toHaveBeenCalledWith(url(1), { timeoutMs: 8000, signal: null });+ // Their main text, about 1,000 characters; the page that answered 404 isn't counted.+ expect(result).toEqual({ characters: 1000, pages: 2 });+ });++ it('makes up no number: null when fewer than two could be read, or only walls were', async () => {+ expect(await citedPagesLength({ brandId: BRAND, pages: [] })).toBeNull();+ const one = vi.fn(async (address) => (address === url(1) ? 104_100 : null));+ expect(+ await citedPagesLength({ brandId: BRAND, pages: [page(1), page(2)] }, { read: one }),+ ).toBeNull();+ const walls = vi.fn(async (address) => (address === url(1) ? 120 : null));+ expect(+ await citedPagesLength({ brandId: BRAND, pages: [page(1), page(2)] }, { read: walls }),+ ).toBeNull();+ const broken = vi.fn(async () => {+ throw new Error('timeout');+ });+ expect(+ await citedPagesLength({ brandId: BRAND, pages: [page(1)] }, { read: broken }),+ ).toBeNull();+ });++ it('settles on nothing at once when the run is stopped, its reads ended', async () => {+ const controller = new AbortController();+ const signals = [];+ const read = vi.fn(+ (address, signal) =>+ new Promise((_, reject) => {+ signals.push(signal);+ signal.addEventListener('abort', () => reject(new Error('aborted')));+ }),+ );+ const result = citedPagesLength(+ { brandId: BRAND, pages: [page(1), page(2)], signal: controller.signal },+ { read },+ );+ await vi.waitFor(() => expect(read).toHaveBeenCalledTimes(2));+ controller.abort();+ await expect(result).resolves.toBeNull();+ expect(signals.every((s) => s.aborted)).toBe(true);+ });++ it('never fails the brief: a read of the citations that fails is no benchmark', async () => {+ failRead = true;+ const read = vi.fn(async () => 4000);+ expect(await citedPagesLength({ brandId: BRAND, pages: [page(1)] }, { read })).toBeNull();+ expect(read).not.toHaveBeenCalled();+ });+});diff --git a/server/src/lib/content-rewrite.js b/server/src/lib/content-rewrite.jsindex f51e5e09e..27946ec3e 100644--- a/server/src/lib/content-rewrite.js+++ b/server/src/lib/content-rewrite.js@@ -4,6 +4,9 @@ import { z } from 'zod';import { HEADING_LIMITS, passageKey } from './content-agent.js';import { linkKey } from './content-links.js';import { sourcesField } from './content-sources.js';+import { textLength } from './page-content.js';++export { textLength };/*** Rewrite the page to these rules (Content Editor): the Content Agent@@ -68,22 +71,6 @@ How to rewrite:- "reason" says in one short sentence what you changed, e.g. "cut to about 8,000 characters and answered each heading first".- Write in the page's own language.`;-/**- * The page's text length as the Rules tab counts it (pageTextLength in- * web/src/lib/content/rules.ts): a space between blocks, an entity as one- * character, runs of spaces as one.- */-export function textLength(html) {- return String(html ?? '')- .replace(/<(script|style)\b[\s\S]*?<\/\1>/gi, ' ')- .replace(/<\/?(p|h[1-6]|li|td|th|blockquote|br|div)\b[^>]*>/gi, ' ')- .replace(/<[^>]*>/g, '')- .replace(/ /g, ' ')- .replace(/&[#a-z0-9]+;/gi, 'x')- .replace(/\s+/g, ' ')- .trim().length;-}-const clip = (text, max) => {const one = String(text ?? '').replace(/\s+/g, ' ')diff --git a/server/src/lib/page-content.js b/server/src/lib/page-content.jsindex 21dd9a0b2..8cab8fbad 100644--- a/server/src/lib/page-content.js+++ b/server/src/lib/page-content.js@@ -255,6 +255,22 @@ function commonAncestor($, a, b) {return el;}+/**+ * The page's text length as the Rules tab counts it (pageTextLength in+ * web/src/lib/content/rules.ts): a space between blocks, an entity as one+ * character, runs of spaces as one.+ */+export function textLength(html) {+ return String(html ?? '')+ .replace(/<(script|style)\b[\s\S]*?<\/\1>/gi, ' ')+ .replace(/<\/?(p|h[1-6]|li|td|th|blockquote|br|div)\b[^>]*>/gi, ' ')+ .replace(/<[^>]*>/g, '')+ .replace(/ /g, ' ')+ .replace(/&[#a-z0-9]+;/gi, 'x')+ .replace(/\s+/g, ' ')+ .trim().length;+}+/*** @param {string} html the page as fetched* @param {string} pageUrl the page's address after redirects, for its linksdiff --git a/server/src/lib/safe-fetch.js b/server/src/lib/safe-fetch.jsindex 50e5970c3..d8f139e6e 100644--- a/server/src/lib/safe-fetch.js+++ b/server/src/lib/safe-fetch.js@@ -218,7 +218,8 @@ function requestOnce(url, { signal, lookup, maxBytes }) {* A web page's HTML, fetched safely (see above).** @param {string} address- * @param {{ timeoutMs?: number, maxBytes?: number, maxRedirects?: number, lookup?: Function, ports?: string[] }} [opts]+ * @param {{ timeoutMs?: number, maxBytes?: number, maxRedirects?: number, lookup?: Function, ports?: string[], signal?: AbortSignal }} [opts]+ * `signal` ends the read early too (a run's Stop), as its timeout does.* `lookup` and `ports` replace the public-only lookup and the web ports;* tests use them to reach a local server.* @returns {Promise<{ url: string, status: number, html: string }>} url is the address after redirects@@ -230,8 +231,11 @@ export async function fetchPage(address, opts = {}) {maxRedirects = MAX_REDIRECTS,lookup = publicOnlyLookup,ports = WEB_PORTS,+ signal: outer = null,} = opts;- const signal = AbortSignal.timeout(timeoutMs);+ const signal = outer+ ? AbortSignal.any([outer, AbortSignal.timeout(timeoutMs)])+ : AbortSignal.timeout(timeoutMs);let url = checkPageUrl(address, ports);for (let hops = 0; ; hops += 1) {let res;diff --git a/web/messages/en.json b/web/messages/en.jsonindex 2f4b071f1..7dadeae31 100644--- a/web/messages/en.json+++ b/web/messages/en.json@@ -4017,6 +4017,7 @@"length": "Length","lengthValue": "{count} characters · ~{words} words","lengthFrom": "From the rules",+ "lengthFromCited": "From the rules · a typical cited page has {count} characters (median of {pages})","outline": "Outline","answers": "Answers “{fanout}”","keywords": "Keywords",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 4c748f17c..9ca7b15fd 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@@ -150,6 +150,16 @@ describe('the Brief tab', () => {expect(onRebuild).toHaveBeenCalledTimes(1);});+ it('says next to Length how long the cited pages are, once read (CE-030)', async () => {+ await render({+ status: 'ready',+ brief: { ...brief, citedLength: { characters: 4300, pages: 3 } },+ });+ expect(fields().Length).toBe(+ '3,000 characters · ~500 wordsFrom the rules · a typical cited page has 4,300 characters (median of 3)',+ );+ });+it('offers Run Agent for a new page without a brief, or H2s added by hand', async () => {await render({ status: 'ready', brief: null },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 052d50a68..d5dc4406a 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@@ -191,7 +191,14 @@ export function BriefTab({count: formatNumber(length),words: formatNumber(wordsForLength(length)),})}- <span className="block text-muted-foreground">{t('lengthFrom')}</span>+ <span className="block text-muted-foreground">+ {brief?.citedLength+ ? t('lengthFromCited', {+ count: formatNumber(brief.citedLength.characters),+ pages: brief.citedLength.pages,+ })+ : t('lengthFrom')}+ </span></dd></dl>diff --git a/web/src/lib/content/brief.test.ts b/web/src/lib/content/brief.test.tsindex ba94adb1f..8189ef5f8 100644--- a/web/src/lib/content/brief.test.ts+++ b/web/src/lib/content/brief.test.ts@@ -105,6 +105,16 @@ describe('the brief', () => {expect(draftBriefSchema.safeParse({ ...brief, origin: 'agent' }).success).toBe(false);});+ it('keeps the cited pages’ length, and reads a brief saved before it', () => {+ const cited = { ...brief, citedLength: { characters: 4300, pages: 3 } };+ expect(draftBriefSchema.parse(cited).citedLength).toEqual({ characters: 4300, pages: 3 });+ expect(draftBriefSchema.parse(brief).citedLength).toBeUndefined();+ expect(draftBriefSchema.parse({ ...brief, citedLength: null }).citedLength).toBeNull();+ expect(+ draftBriefSchema.safeParse({ ...brief, citedLength: { characters: 4300, pages: 0 } }).success,+ ).toBe(false);+ });+it('reads an opportunity’s brief until the draft has its own', () => {expect(briefFromOpportunity({diff --git a/web/src/lib/content/brief.ts b/web/src/lib/content/brief.tsindex f970d0806..6aee1ae34 100644--- a/web/src/lib/content/brief.ts+++ b/web/src/lib/content/brief.ts@@ -38,6 +38,12 @@ export interface DraftBrief {builtAt: string | null;/** The sources it was built from, by group. */builtFrom: { prompts: number; fanouts: number; pages: number; queries: number } | null;+ /**+ * How long the cited pages are, in characters (the median of those read),+ * and how many were read when it was rebuilt (CE-030); null or absent when+ * none could be.+ */+ citedLength?: { characters: number; pages: number } | null;}/** Limits a brief keeps to, the server's (content-brief.js) and the column's (00212). */@@ -68,6 +74,13 @@ export const draftBriefSchema = z.object({queries: z.number().int().min(0),}).nullable(),+ citedLength: z+ .object({+ characters: z.number().int().min(0).max(1_000_000),+ pages: z.number().int().min(1).max(30),+ })+ .nullable()+ .optional(),});/** The brief of the opportunity a draft started from, until the draft has its own. */