--- // /agents/ — chapter page. Migrated from agents/index.html in task 13. // Identical URL (/agents/), zero client JS, copy lives in // src/content/chapters/agents.json. import { getEntry } from 'astro:content'; import ChapterLayout from '../layouts/ChapterLayout.astro'; import ChapterHero from '../components/blocks/ChapterHero.astro'; // Required-field guard. The chapters schema marks section eyebrow / // panelLabel / panelCode / steps / copy as optional because the schema // does not know which page consumes which shape. These four pages do // consume them — fail loudly here rather than rendering a blank section. function requireField(value: T | undefined, name: string): T { if (value === undefined) { throw new Error(`agents chapter: missing required field "${name}"`); } return value; } const base = import.meta.env.BASE_URL; const chapter = await getEntry('chapters', 'agents'); if (!chapter) { throw new Error('agents chapter: missing collection entry'); } const lede = chapter.data.lede.en; const title = chapter.data.title.en; const eyebrow = chapter.data.eyebrow.en; const cards = chapter.data.cards ?? []; const sections = chapter.data.sections ?? []; const treeSection = sections[0]; const handoffSection = sections[1]; if (!treeSection) { throw new Error('agents chapter: missing sections[0]'); } if (!handoffSection) { throw new Error('agents chapter: missing sections[1]'); } // Narrow the section fields this page renders. Each `requireField` either // returns a non-null value or throws — TS narrows from `T | undefined` to `T`. const treeEyebrow = requireField(treeSection.eyebrow, 'sections[0].eyebrow'); const treePanelLabel = requireField(treeSection.panelLabel, 'sections[0].panelLabel'); const treePanelCode = requireField(treeSection.panelCode, 'sections[0].panelCode'); const handoffEyebrow = requireField(handoffSection.eyebrow, 'sections[1].eyebrow'); const handoffSteps = requireField(handoffSection.steps, 'sections[1].steps'); --- ]+>/g, '')}> ← ROUTE MAP 02 / AGENTS & TREES field guide ↗

{lede}

{treeEyebrow.en}

{treePanelLabel.en} {treePanelCode.en}
{ cards.map((card) => (
{card.label.en}

{card.title.en}

{card.copy.en}

)) }

{handoffEyebrow.en}

{ handoffSteps.map((step, index) => (
{String(index + 1).padStart(2, '0')}
{step.label.en} {step.copy.en}
)) }