The Open Framework for Building Agents
site: update design and add per template page (#926)
Allen Zhouc61f8cae0c51
diff --git a/apps/docs/app/[lang]/resources/page.tsx b/apps/docs/app/[lang]/resources/page.tsxindex e4e96d39c..deed3b1fb 100644--- a/apps/docs/app/[lang]/resources/page.tsx+++ b/apps/docs/app/[lang]/resources/page.tsx@@ -1,63 +1,5 @@-import type { Metadata } from "next";-import Link from "next/link";-import { translations } from "@/geistdocs";-import { type Resource, resources } from "@/lib/resources/data";+import { permanentRedirect } from "next/navigation";-const title = "Templates";-const description = "Templates for building and deploying eve agents.";+const ResourcesPage = () => permanentRedirect("/templates");-export const metadata: Metadata = {- title,- description,-};--export const generateStaticParams = () => Object.keys(translations).map((lang) => ({ lang }));--const ResourceCard = ({ resource }: { resource: Resource }) => {- const isExternal = resource.href.startsWith("https://");- const className =- "flex h-full flex-col gap-3 rounded-xl border border-gray-alpha-400 bg-background-100 p-6 no-underline shadow-none transition-colors hover:bg-gray-100 dark:bg-gray-100 dark:hover:bg-gray-200";- const content = (- <>- <span className="inline-flex w-fit shrink-0 items-center justify-center rounded-full border border-transparent bg-gray-300 px-2 py-0.5 font-medium text-gray-1000 text-xs">- Template- </span>- <h2 className="line-clamp-2 text-balance font-medium text-base text-gray-1000 leading-snug">- {resource.title}- </h2>- <p className="line-clamp-2 text-gray-900 text-sm">{resource.description}</p>- </>- );-- if (isExternal) {- return (- <a className={className} href={resource.href} rel="noopener noreferrer" target="_blank">- {content}- </a>- );- }-- return (- <Link className={className} href={resource.href}>- {content}- </Link>- );-};--const TemplatesPage = () => (- <main className="mx-auto w-full max-w-5xl px-4 pt-16 pb-16 sm:pt-24">- <header className="space-y-4 pb-8">- <h1 className="text-balance font-semibold text-[40px] text-gray-1000 leading-[1.1] tracking-tight sm:text-5xl">- {title}- </h1>- <p className="max-w-2xl text-gray-900 text-lg leading-relaxed">{description}</p>- </header>- <div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">- {resources.map((resource) => (- <ResourceCard key={resource.title} resource={resource} />- ))}- </div>- </main>-);--export default TemplatesPage;+export default ResourcesPage;diff --git a/apps/docs/app/[lang]/templates/[slug]/file-viewer.tsx b/apps/docs/app/[lang]/templates/[slug]/file-viewer.tsxnew file mode 100644index 000000000..e98c8cf98--- /dev/null+++ b/apps/docs/app/[lang]/templates/[slug]/file-viewer.tsx@@ -0,0 +1,252 @@+"use client";++import {+ BotIcon,+ BracesIcon,+ ChevronRightIcon,+ FileTextIcon,+ type LucideIcon,+ MessageSquareIcon,+ PlugIcon,+ SettingsIcon,+ WrenchIcon,+} from "lucide-react";+import { type ReactNode, useMemo, useState } from "react";+import type { TemplateFile } from "@/lib/templates/data";+import { cn } from "@/lib/utils";++export interface HighlightedTemplateFile {+ code: ReactNode;+ language: TemplateFile["language"];+ relativePath: string;+}++interface FileViewerProps {+ files: HighlightedTemplateFile[];+}++interface CategoryStyle {+ icon: LucideIcon;+}++const categoryStyles: Record<string, CategoryStyle> = {+ "agent.ts": { icon: SettingsIcon },+ "instructions.md": { icon: FileTextIcon },+ channels: { icon: MessageSquareIcon },+ connections: { icon: PlugIcon },+ skills: { icon: FileTextIcon },+ tools: { icon: WrenchIcon },+ subagents: { icon: BotIcon },+ lib: { icon: BracesIcon },+};++const defaultStyle: CategoryStyle = { icon: FileTextIcon };+const categoryOrder = [+ "agent.ts",+ "instructions.md",+ "channels",+ "connections",+ "skills",+ "tools",+ "subagents",+ "lib",+];++interface FileEntry {+ file: HighlightedTemplateFile;+ label: string;+}++interface FolderNode {+ entries: FileEntry[];+ key: string;+ kind: "folder";+ style: CategoryStyle;+}++interface LeafNode {+ file: HighlightedTemplateFile;+ key: string;+ kind: "leaf";+ style: CategoryStyle;+}++type TreeNode = FolderNode | LeafNode;++const buildTree = (files: HighlightedTemplateFile[]): TreeNode[] => {+ const folders = new Map<string, FileEntry[]>();+ const leaves = new Map<string, HighlightedTemplateFile>();++ for (const sourceFile of files) {+ const parts = sourceFile.relativePath.split("/");+ if (parts[0] !== "agent" || parts.length < 2) {+ continue;+ }+ if (parts.length === 2) {+ leaves.set(parts[1], sourceFile);+ continue;+ }++ const directory = parts[1];+ const entries = folders.get(directory) ?? [];+ entries.push({ file: sourceFile, label: parts.slice(2).join("/") });+ folders.set(directory, entries);+ }++ const keys = new Set([...categoryOrder, ...leaves.keys(), ...folders.keys()]);++ return [...keys].flatMap<TreeNode>((key) => {+ const style = categoryStyles[key] ?? defaultStyle;+ const leaf = leaves.get(key);+ if (leaf) {+ return [{ file: leaf, key, kind: "leaf", style }];+ }++ const entries = folders.get(key);+ if (!entries) {+ return [];+ }+ entries.sort((a, b) => a.label.localeCompare(b.label));+ return [{ entries, key, kind: "folder", style }];+ });+};++export const FileViewer = ({ files }: FileViewerProps) => {+ const tree = useMemo(() => buildTree(files), [files]);+ const initialPath = files[0]?.relativePath ?? null;+ const [selectedPath, setSelectedPath] = useState<string | null>(initialPath);+ const [openFolders, setOpenFolders] = useState<ReadonlySet<string>>(() => {+ const initial = new Set<string>();+ const parts = initialPath?.split("/");+ if (parts && parts.length >= 3) {+ initial.add(parts[1]);+ }+ return initial;+ });+ const selected = files.find((sourceFile) => sourceFile.relativePath === selectedPath);++ const selectFolder = (folder: FolderNode) => {+ setOpenFolders((current) => new Set(current).add(folder.key));+ const firstFile = folder.entries[0]?.file;+ if (firstFile) {+ setSelectedPath(firstFile.relativePath);+ }+ };++ const toggleFolder = (key: string) => {+ setOpenFolders((current) => {+ const next = new Set(current);+ if (next.has(key)) {+ next.delete(key);+ } else {+ next.add(key);+ }+ return next;+ });+ };++ return (+ <div className="grid overflow-hidden rounded-lg border border-gray-alpha-400 bg-background-100 md:grid-cols-[200px_minmax(0,1fr)]">+ <nav+ aria-label="Template files"+ className="border-gray-alpha-400 border-b p-3 md:border-r md:border-b-0"+ >+ <p className="px-2 pb-2 text-gray-800 text-label-13-mono">agent/</p>+ <ul className="space-y-0.5">+ {tree.map((node) => {+ const Icon = node.style.icon;+ if (node.kind === "leaf") {+ const isSelected = node.file.relativePath === selectedPath;+ return (+ <li key={node.key}>+ <button+ aria-pressed={isSelected}+ className={cn(+ "flex min-h-11 w-full touch-manipulation items-center gap-2 rounded-sm px-2 text-left font-mono text-[13px] leading-none outline-none transition-colors focus-visible:ring-2 focus-visible:ring-blue-700 motion-reduce:transition-none md:min-h-7",+ isSelected+ ? "font-medium text-gray-1000"+ : "text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000",+ )}+ onClick={() => setSelectedPath(node.file.relativePath)}+ type="button"+ >+ <Icon aria-hidden="true" className="size-3.5 shrink-0 text-gray-900" />+ <span className="truncate">{node.key}</span>+ </button>+ </li>+ );+ }++ const isOpen = openFolders.has(node.key);+ const containsSelected = node.entries.some(+ (entry) => entry.file.relativePath === selectedPath,+ );+ return (+ <li key={node.key}>+ <button+ aria-expanded={isOpen}+ className={cn(+ "flex min-h-11 w-full touch-manipulation items-center gap-2 rounded-sm px-2 text-left font-mono text-[13px] leading-none outline-none transition-colors focus-visible:ring-2 focus-visible:ring-blue-700 motion-reduce:transition-none md:min-h-7",+ containsSelected+ ? "text-gray-1000"+ : "text-gray-900 hover:bg-gray-alpha-100 hover:text-gray-1000",+ )}+ onClick={() => (isOpen ? toggleFolder(node.key) : selectFolder(node))}+ type="button"+ >+ <ChevronRightIcon+ aria-hidden="true"+ className={cn(+ "size-3 shrink-0 text-gray-700 transition-transform",+ isOpen ? "rotate-90" : null,+ )}+ />+ <Icon aria-hidden="true" className="size-3.5 shrink-0 text-gray-900" />+ <span className="truncate">{node.key}/</span>+ </button>+ {isOpen ? (+ <ul className="mt-0.5 ml-[18px] space-y-0.5 border-gray-alpha-400 border-l pl-3">+ {node.entries.map((entry) => {+ const isSelected = entry.file.relativePath === selectedPath;+ return (+ <li key={entry.file.relativePath}>+ <button+ aria-pressed={isSelected}+ className={cn(+ "min-h-11 w-full touch-manipulation truncate rounded-sm px-2 text-left font-mono text-[13px] leading-none outline-none transition-colors focus-visible:ring-2 focus-visible:ring-blue-700 motion-reduce:transition-none md:min-h-7",+ isSelected+ ? "font-medium text-gray-1000"+ : "text-gray-800 hover:bg-gray-alpha-100 hover:text-gray-1000",+ )}+ onClick={() => setSelectedPath(entry.file.relativePath)}+ type="button"+ >+ {entry.label}+ </button>+ </li>+ );+ })}+ </ul>+ ) : null}+ </li>+ );+ })}+ </ul>+ </nav>++ <div className="flex min-w-0 flex-col">+ <div className="flex min-h-11 items-center justify-between gap-4 border-gray-alpha-400 border-b px-4">+ <code className="truncate text-copy-13-mono text-gray-1000">+ {selected?.relativePath ?? ""}+ </code>+ <span className="shrink-0 rounded-sm bg-gray-alpha-200 px-2 py-1 text-gray-900 text-label-12-mono">+ {selected?.language ?? ""}+ </span>+ </div>+ <div className="max-h-[560px] min-h-80 overflow-auto md:min-h-[420px] [&>div]:mb-0">+ {selected?.code ?? null}+ </div>+ </div>+ </div>+ );+};diff --git a/apps/docs/app/[lang]/templates/[slug]/page.tsx b/apps/docs/app/[lang]/templates/[slug]/page.tsxnew file mode 100644index 000000000..7a1d9dd17--- /dev/null+++ b/apps/docs/app/[lang]/templates/[slug]/page.tsx@@ -0,0 +1,152 @@+import { CodeBlock } from "@vercel/geistdocs/components/code-block";+import { geistShikiTheme } from "@vercel/geistdocs/shiki-theme";+import { highlight } from "fumadocs-core/highlight";+import { ArrowLeftIcon } from "lucide-react";+import type { Metadata } from "next";+import Link from "next/link";+import { notFound } from "next/navigation";+import type { ComponentProps } from "react";+import { translations } from "@/geistdocs";+import {+ getTemplateEntry,+ templateEntries,+ type TemplateEntry,+ type TemplateFile,+} from "@/lib/templates/data";+import { cn } from "@/lib/utils";+import { integrationIcons } from "../integration-icons";+import { FileViewer, type HighlightedTemplateFile } from "./file-viewer";+import { TemplateActions } from "./template-actions";++interface PageParams {+ lang: string;+ slug: string;+}++export const generateStaticParams = (): PageParams[] =>+ Object.keys(translations).flatMap((lang) =>+ templateEntries.map((entry) => ({ lang, slug: entry.slug })),+ );++export const dynamicParams = false;++export const generateMetadata = async ({+ params,+}: {+ params: Promise<PageParams>;+}): Promise<Metadata> => {+ const { slug } = await params;+ const entry = getTemplateEntry(slug);+ return entry+ ? { title: entry.title, description: entry.description }+ : { title: "Template not found" };+};++const TemplateDetailPage = async ({ params }: { params: Promise<PageParams> }) => {+ const { slug } = await params;+ const entry = getTemplateEntry(slug);+ if (!entry) {+ notFound();+ }+ const highlightedFiles = await Promise.all(entry.files.map(highlightFile));++ return (+ <main className="mx-auto max-w-[1080px] px-4 pt-10 pb-32 sm:px-6 sm:pt-12">+ <Link+ className="inline-flex min-h-8 items-center gap-1.5 rounded-sm text-gray-900 text-label-14 no-underline outline-none transition-colors hover:text-gray-1000 focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none"+ href="/templates"+ >+ <ArrowLeftIcon aria-hidden="true" className="size-3.5" />+ Templates+ </Link>++ <header className="mt-8 grid gap-4 lg:grid-cols-2 lg:items-start lg:gap-8">+ <div className="min-w-0">+ <h1 className="m-0 font-medium! text-heading-40 text-gray-1000 tracking-tighter sm:text-heading-48">+ {entry.title}+ </h1>+ <div className="hidden lg:block">+ <IntegrationList entry={entry} />+ </div>+ </div>+ <div className="min-w-0">+ <p className="max-w-[520px] text-copy-16 text-gray-900">{entry.description}</p>+ <div className="mt-6">+ <TemplateActions setupPrompt={entry.setupPrompt} sourceHref={entry.sourceHref} />+ </div>+ <div className="pt-3 lg:hidden">+ <IntegrationList entry={entry} />+ </div>+ </div>+ <dl className="flex flex-wrap gap-x-10 gap-y-4 border-gray-alpha-400 border-t pt-6 lg:col-span-2">+ <OverviewItem label="Model" value={entry.model} />+ <OverviewItem label="Authored files" value={String(entry.files.length)} />+ </dl>+ </header>++ <section className="mt-14">+ <div>+ <h2 className="text-heading-24 text-gray-1000">Filesystem</h2>+ <p className="mt-2 text-copy-14 text-gray-900">+ Browse the authored files at revision{" "}+ <code className="text-copy-13-mono">{entry.sourceRevision.slice(0, 7)}</code>.+ </p>+ </div>+ <div className="mt-4">+ <FileViewer files={highlightedFiles} />+ </div>+ </section>+ </main>+ );+};++const highlightFile = async (file: TemplateFile): Promise<HighlightedTemplateFile> => ({+ code: await highlight(file.contents, {+ lang: file.language,+ theme: geistShikiTheme,+ components: {+ pre: ({ children, ...props }: ComponentProps<"pre">) => (+ <CodeBlock+ {...props}+ className={cn(+ props.className,+ "overflow-x-hidden! whitespace-pre-wrap break-words rounded-none border-0 bg-transparent p-4 text-copy-13-mono [&>code]:min-w-0! [&>code]:w-full!",+ )}+ >+ {children}+ </CodeBlock>+ ),+ },+ }),+ language: file.language,+ relativePath: file.relativePath,+});++const IntegrationList = ({ entry }: { entry: TemplateEntry }) => (+ <ul+ aria-label="Integrations"+ className="mt-5 grid w-full grid-cols-2 gap-x-4 gap-y-3 sm:flex sm:w-auto sm:flex-wrap sm:items-center sm:gap-x-4 sm:gap-y-2"+ >+ {entry.integrations.map((integration) => {+ const Icon = integrationIcons[integration];+ return (+ <li+ className="inline-flex items-center justify-self-center gap-1.5 text-gray-900 text-label-13 sm:justify-self-auto"+ key={integration}+ >+ <Icon aria-hidden="true" className="size-4 grayscale" />+ {integration}+ </li>+ );+ })}+ </ul>+);++const OverviewItem = ({ label, value }: { label: string; value: string }) => (+ <div className="min-w-0">+ <dt className="text-gray-800 text-label-12">{label}</dt>+ <dd className="mt-1 break-all text-copy-13-mono text-gray-1000">{value}</dd>+ </div>+);++export default TemplateDetailPage;diff --git a/apps/docs/app/[lang]/templates/[slug]/template-actions.tsx b/apps/docs/app/[lang]/templates/[slug]/template-actions.tsxnew file mode 100644index 000000000..cd6569c65--- /dev/null+++ b/apps/docs/app/[lang]/templates/[slug]/template-actions.tsx@@ -0,0 +1,76 @@+"use client";++import { SiGithub } from "@icons-pack/react-simple-icons";+import { Button } from "@vercel/geistdocs/components/button";+import { CheckIcon, CopyIcon } from "lucide-react";+import { useEffect, useRef, useState } from "react";++interface TemplateActionsProps {+ setupPrompt: string;+ sourceHref: string;+}++export const TemplateActions = ({ setupPrompt, sourceHref }: TemplateActionsProps) => {+ const [copied, setCopied] = useState(false);+ const resetTimer = useRef<ReturnType<typeof setTimeout> | null>(null);++ useEffect(+ () => () => {+ if (resetTimer.current) {+ clearTimeout(resetTimer.current);+ }+ },+ [],+ );++ const copyPrompt = async () => {+ await navigator.clipboard.writeText(setupPrompt);+ setCopied(true);+ if (resetTimer.current) {+ clearTimeout(resetTimer.current);+ }+ resetTimer.current = setTimeout(() => setCopied(false), 3000);+ };++ return (+ <div className="grid gap-2 sm:flex sm:flex-wrap">+ <Button+ className="font-medium text-background-100! text-label-14"+ onClick={copyPrompt}+ type="button"+ >+ <span className="grid">+ <span+ aria-hidden="true"+ className="invisible col-start-1 row-start-1 flex items-center gap-2"+ >+ <CheckIcon aria-hidden="true" className="size-4" />+ Copied. Paste in your agent.+ </span>+ <span className="col-start-1 row-start-1 flex items-center justify-self-center gap-2">+ {copied ? (+ <>+ <CheckIcon aria-hidden="true" className="size-4" />+ Copied. Paste in your agent.+ </>+ ) : (+ <>+ <CopyIcon aria-hidden="true" className="size-4" />+ Setup with one prompt+ </>+ )}+ </span>+ </span>+ </Button>+ <Button asChild className="font-medium text-label-14" variant="outline">+ <a href={sourceHref} rel="noopener noreferrer" target="_blank">+ <SiGithub aria-hidden="true" className="size-4" />+ View GitHub+ </a>+ </Button>+ <span aria-live="polite" className="sr-only">+ {copied ? "Setup prompt copied to clipboard." : ""}+ </span>+ </div>+ );+};diff --git a/apps/docs/app/[lang]/templates/integration-icons.tsx b/apps/docs/app/[lang]/templates/integration-icons.tsxnew file mode 100644index 000000000..034448267--- /dev/null+++ b/apps/docs/app/[lang]/templates/integration-icons.tsx@@ -0,0 +1,15 @@+import { BracesIcon } from "lucide-react";+import type { ComponentType, SVGProps } from "react";+import { linearLogo, notionLogo, sentryLogo, slackLogo, webLogo } from "@/lib/integrations/logos";+import type { TemplateIntegration } from "@/lib/templates/data";++type IconComponent = ComponentType<SVGProps<SVGSVGElement>>;++export const integrationIcons: Record<TemplateIntegration, IconComponent> = {+ "HTTP API": BracesIcon,+ Linear: linearLogo,+ Notion: notionLogo,+ Sentry: sentryLogo,+ Slack: slackLogo,+ "Web chat": webLogo,+};diff --git a/apps/docs/app/[lang]/templates/page.tsx b/apps/docs/app/[lang]/templates/page.tsxnew file mode 100644index 000000000..50d3f5859--- /dev/null+++ b/apps/docs/app/[lang]/templates/page.tsx@@ -0,0 +1,29 @@+import type { Metadata } from "next";+import { translations } from "@/geistdocs";+import { templateEntries } from "@/lib/templates/data";+import { TemplateGallery } from "./template-gallery";++const title = "Templates";+const description =+ "Explore agents built on eve. Set one up with a prompt or use its source as a starting point.";++export const metadata: Metadata = {+ title,+ description,+};++export const generateStaticParams = () => Object.keys(translations).map((lang) => ({ lang }));++const TemplatesPage = () => (+ <main className="mx-auto max-w-[1080px] px-4 pb-32 sm:px-6">+ <header className="pt-12 pb-8 sm:pt-16 sm:pb-10">+ <h1 className="font-medium! text-heading-32 text-gray-1000 tracking-tighter sm:text-heading-40">+ {title}+ </h1>+ <p className="mt-3 max-w-[460px] text-copy-16 text-gray-900">{description}</p>+ </header>+ <TemplateGallery entries={templateEntries} />+ </main>+);++export default TemplatesPage;diff --git a/apps/docs/app/[lang]/templates/template-gallery.tsx b/apps/docs/app/[lang]/templates/template-gallery.tsxnew file mode 100644index 000000000..89bc413a3--- /dev/null+++ b/apps/docs/app/[lang]/templates/template-gallery.tsx@@ -0,0 +1,195 @@+"use client";++import { Button } from "@vercel/geistdocs/components/button";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuRadioGroup,+ DropdownMenuRadioItem,+ DropdownMenuTrigger,+} from "@vercel/geistdocs/components/dropdown-menu";+import { Input } from "@vercel/geistdocs/components/input";+import { ChevronDownIcon, SearchIcon } from "lucide-react";+import Link from "next/link";+import { useMemo, useState } from "react";+import type { TemplateCategory, TemplateEntry, TemplateIntegration } from "@/lib/templates/data";+import { integrationIcons } from "./integration-icons";++const ALL = "all" as const;++type FilterValue<T extends string> = typeof ALL | T;++interface TemplateGalleryProps {+ entries: TemplateEntry[];+}++interface FilterSelectProps<T extends string> {+ allLabel: string;+ label: string;+ onChange: (value: FilterValue<T>) => void;+ options: T[];+ value: FilterValue<T>;+}++const FilterSelect = <T extends string>({+ allLabel,+ label,+ onChange,+ options,+ value,+}: FilterSelectProps<T>) => (+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ aria-label={label}+ className="h-11 w-full justify-between px-3 md:h-9 md:w-44"+ variant="outline"+ >+ <span className="truncate">{value === ALL ? allLabel : value}</span>+ <ChevronDownIcon aria-hidden="true" className="size-3.5 text-gray-800" />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent align="start" className="w-[var(--radix-dropdown-menu-trigger-width)]">+ <DropdownMenuRadioGroup+ onValueChange={(nextValue) => onChange(nextValue as FilterValue<T>)}+ value={value}+ >+ <FilterOption label={allLabel} value={ALL} />+ {options.map((option) => (+ <FilterOption key={option} label={option} value={option} />+ ))}+ </DropdownMenuRadioGroup>+ </DropdownMenuContent>+ </DropdownMenu>+);++const FilterOption = ({ label, value }: { label: string; value: string }) => (+ <DropdownMenuRadioItem className="min-h-11 md:min-h-8" value={value}>+ {label}+ </DropdownMenuRadioItem>+);++const TemplateCard = ({ entry }: { entry: TemplateEntry }) => (+ <li>+ <Link+ className="flex min-h-36 flex-col rounded-lg border border-gray-alpha-400 bg-background-100 p-4 no-underline outline-none transition-colors hover:border-gray-alpha-500 hover:bg-gray-alpha-100 focus-visible:border-gray-alpha-600 focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-offset-2 focus-visible:ring-offset-background-100 motion-reduce:transition-none"+ href={`/templates/${entry.slug}`}+ >+ <h2 className="text-[16px] leading-none font-medium text-gray-1000">{entry.title}</h2>+ <p className="mt-2 line-clamp-2 max-w-[90%] text-balance text-[14px] leading-[1.3] text-gray-800">+ {entry.description}+ </p>+ <ul aria-label="Integrations" className="mt-auto flex items-center gap-2 pt-4">+ {entry.integrations.map((integration) => {+ const Icon = integrationIcons[integration];+ return (+ <li+ className="flex size-4 items-center justify-center text-gray-700 grayscale"+ key={integration}+ title={integration}+ >+ <Icon aria-hidden="true" className="size-3.5" />+ <span className="sr-only">{integration}</span>+ </li>+ );+ })}+ </ul>+ </Link>+ </li>+);++export const TemplateGallery = ({ entries }: TemplateGalleryProps) => {+ const [query, setQuery] = useState("");+ const [category, setCategory] = useState<FilterValue<TemplateCategory>>(ALL);+ const [integration, setIntegration] = useState<FilterValue<TemplateIntegration>>(ALL);++ const filterOptions = useMemo(() => {+ const categories = new Set<TemplateCategory>();+ const integrations = new Set<TemplateIntegration>();++ for (const entry of entries) {+ categories.add(entry.category);+ for (const entryIntegration of entry.integrations) {+ integrations.add(entryIntegration);+ }+ }++ return {+ categories: Array.from(categories).sort(),+ integrations: Array.from(integrations).sort(),+ };+ }, [entries]);++ const results = useMemo(() => {+ const normalizedQuery = query.trim().toLowerCase();++ return entries.filter((entry) => {+ if (category !== ALL && entry.category !== category) {+ return false;+ }+ if (integration !== ALL && !entry.integrations.includes(integration)) {+ return false;+ }+ if (!normalizedQuery) {+ return true;+ }++ return [entry.title, entry.description, entry.category, ...entry.integrations]+ .join(" ")+ .toLowerCase()+ .includes(normalizedQuery);+ });+ }, [category, entries, integration, query]);++ return (+ <section aria-label="Templates" className="flex flex-col gap-6">+ <div className="flex flex-col gap-2 md:flex-row">+ <div className="relative min-w-0 flex-1">+ <SearchIcon+ aria-hidden="true"+ className="pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 text-gray-800"+ />+ <Input+ aria-label="Search templates"+ className="h-11 pr-4 pl-9 text-copy-14 md:h-9"+ onChange={(event) => setQuery(event.target.value)}+ placeholder="Search templates and examples…"+ type="search"+ value={query}+ />+ </div>+ <div className="grid grid-cols-2 gap-2 md:flex md:shrink-0">+ <FilterSelect+ allLabel="All categories"+ label="Filter by category"+ onChange={setCategory}+ options={filterOptions.categories}+ value={category}+ />+ <FilterSelect+ allLabel="All integrations"+ label="Filter by integration"+ onChange={setIntegration}+ options={filterOptions.integrations}+ value={integration}+ />+ </div>+ </div>++ <div aria-live="polite">+ {results.length > 0 ? (+ <ul className="grid list-none gap-4 p-0 sm:grid-cols-2 lg:grid-cols-3">+ {results.map((entry) => (+ <TemplateCard entry={entry} key={entry.title} />+ ))}+ </ul>+ ) : (+ <div className="flex min-h-48 flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-gray-alpha-400 px-6 text-center">+ <p className="text-heading-16 text-gray-1000">No matching entries</p>+ <p className="text-copy-14 text-gray-900">Try a different search or filter.</p>+ </div>+ )}+ </div>+ </section>+ );+};diff --git a/apps/docs/app/sitemap.ts b/apps/docs/app/sitemap.tsindex 57780200e..a96a724bf 100644--- a/apps/docs/app/sitemap.ts+++ b/apps/docs/app/sitemap.ts@@ -2,6 +2,7 @@ import type { MetadataRoute } from "next";import { source } from "@/lib/geistdocs/source";import { getSiteOrigin } from "@/lib/geistdocs/url";+import { templateEntries } from "@/lib/templates/data";const baseUrl = getSiteOrigin();@@ -35,8 +36,13 @@ export default function sitemap(): MetadataRoute.Sitemap {{changeFrequency: "weekly",priority: 0.5,- url: url("/resources"),+ url: url("/templates"),},+ ...templateEntries.map((entry) => ({+ changeFrequency: "weekly" as const,+ priority: 0.4,+ url: url(`/templates/${entry.slug}`),+ })),...pages,];}diff --git a/apps/docs/geistdocs.tsx b/apps/docs/geistdocs.tsxindex 06f21e493..b72c14049 100644--- a/apps/docs/geistdocs.tsx+++ b/apps/docs/geistdocs.tsx@@ -19,7 +19,7 @@ export const nav = [},{label: "Templates",- href: "/resources",+ href: "/templates",},{label: "GitHub",diff --git a/apps/docs/lib/resources/data.ts b/apps/docs/lib/resources/data.tsdeleted file mode 100644index 3f9a1e72a..000000000--- a/apps/docs/lib/resources/data.ts+++ /dev/null@@ -1,26 +0,0 @@-export interface Resource {- description: string;- href: string;- title: string;-}--export const resources: Resource[] = [- {- title: "eve Chat Template",- description:- "A persisted Next.js chat template for eve, built with shadcn/ui, Tailwind CSS, Streamdown, Better Auth, Drizzle, Neon, and Upstash Redis.",- href: "https://vercel.com/templates/eve/eve-chat-template",- },- {- title: "eve Slack Agent",- description:- "A Slack agent template with webhook handling, Vercel Connect, a starter agent, and an example tool ready to deploy on Vercel.",- href: "https://vercel.com/templates/eve/eve-slack-agent",- },- {- title: "Weather Agent Fixture",- description:- "A small representative eve app with agent config, instructions, a typed weather tool, and a markdown skill.",- href: "https://github.com/vercel/eve/tree/main/apps/fixtures/weather-agent",- },-];diff --git a/apps/docs/lib/templates/data.ts b/apps/docs/lib/templates/data.tsnew file mode 100644index 000000000..a9020ac46--- /dev/null+++ b/apps/docs/lib/templates/data.ts@@ -0,0 +1,82 @@+export type TemplateCategory = "Chat" | "Collaboration" | "Example";+import { templateSourceFiles } from "./sources";++export type TemplateIntegration =+ | "HTTP API"+ | "Linear"+ | "Notion"+ | "Sentry"+ | "Slack"+ | "Web chat";+export type TemplateSource = "GitHub" | "Vercel Templates";++export interface TemplateFile {+ contents: string;+ language: "markdown" | "typescript";+ relativePath: string;+}++export interface TemplateEntry {+ category: TemplateCategory;+ description: string;+ files: TemplateFile[];+ integrations: TemplateIntegration[];+ model: string;+ slug: string;+ source: TemplateSource;+ sourceHref: string;+ sourceRevision: string;+ setupPrompt: string;+ title: string;+}++export const templateEntries: TemplateEntry[] = [+ {+ slug: "eve-chat-template",+ title: "Chat",+ setupPrompt:+ "Set up the eve chat template in my current workspace using https://github.com/vercel-labs/eve-chat-template/tree/main as the source. Copy the project files, install its dependencies, and follow the repository README to configure it. Preserve the existing project if the workspace is not empty, and tell me about any required environment variables or manual setup steps.",+ description:+ "A persisted Next.js chat template for eve, built with shadcn/ui, Tailwind CSS, Streamdown, Better Auth, Drizzle, Neon, and Upstash Redis.",+ sourceHref: "https://github.com/vercel-labs/eve-chat-template/tree/main",+ sourceRevision: "f7c164ac8901e5400f6e4ef00eead67ee71cd5d4",+ category: "Chat",+ model: "anthropic/claude-sonnet-5",+ integrations: ["Web chat", "Slack", "Linear", "Notion", "Sentry"],+ source: "Vercel Templates",+ files: templateSourceFiles["eve-chat-template"],+ },+ {+ slug: "eve-slack-agent",+ title: "Slack",+ setupPrompt:+ "Set up the eve Slack agent template in my current workspace using https://github.com/vercel-labs/eve-slack-agent-template/tree/main as the source. Copy the project files, install its dependencies, and follow the repository README to configure it. Preserve the existing project if the workspace is not empty, and tell me about any required environment variables or manual setup steps.",+ description:+ "A Slack agent template with webhook handling, Vercel Connect, a starter agent, and an example tool ready to deploy on Vercel.",+ sourceHref: "https://github.com/vercel-labs/eve-slack-agent-template/tree/main",+ sourceRevision: "bb35e1fb0159926c625d356d0b43ad618e11b44c",+ category: "Collaboration",+ model: "anthropic/claude-sonnet-5",+ integrations: ["Slack"],+ source: "Vercel Templates",+ files: templateSourceFiles["eve-slack-agent"],+ },+ {+ slug: "weather-agent-fixture",+ title: "Weather",+ setupPrompt:+ "Set up the eve weather agent in my current workspace using https://github.com/vercel/eve/tree/main/apps/fixtures/weather-agent as the source. Copy that fixture into a standalone project, install its dependencies, and make any minimal changes needed to run it outside the eve monorepo. Preserve the existing project if the workspace is not empty, and tell me about any required environment variables or manual setup steps.",+ description:+ "A small representative eve app with agent config, instructions, a typed weather tool, and a markdown skill.",+ sourceHref: "https://github.com/vercel/eve/tree/main/apps/fixtures/weather-agent",+ sourceRevision: "71d57185233d2bd9ff31fe0cd21915df7afa6e2e",+ category: "Example",+ model: "anthropic/claude-sonnet-5",+ integrations: ["HTTP API"],+ source: "GitHub",+ files: templateSourceFiles["weather-agent-fixture"],+ },+];++export const getTemplateEntry = (slug: string): TemplateEntry | undefined =>+ templateEntries.find((entry) => entry.slug === slug);diff --git a/apps/docs/lib/templates/sources.ts b/apps/docs/lib/templates/sources.tsnew file mode 100644index 000000000..3be8937e5--- /dev/null+++ b/apps/docs/lib/templates/sources.ts@@ -0,0 +1,297 @@+import type { TemplateFile } from "./data";++const file = (+ relativePath: string,+ language: TemplateFile["language"],+ contents: string,+): TemplateFile => ({ contents, language, relativePath });++export const templateSourceFiles: Record<string, TemplateFile[]> = {+ "eve-chat-template": [+ file(+ "agent/agent.ts",+ "typescript",+ `import { defineAgent } from "eve";++export default defineAgent({+ model: "anthropic/claude-sonnet-5",+});+`,+ ),+ file(+ "agent/channels/eve.ts",+ "typescript",+ `import { eveChannel } from "eve/channels/eve";+import { localDev, vercelOidc } from "eve/channels/auth";+import { betterAuthEveAuth } from "@/lib/eve-auth";++export default eveChannel({+ auth: [betterAuthEveAuth, localDev(), vercelOidc()],+ uploadPolicy: "disabled",+});+`,+ ),+ file(+ "agent/channels/slack.ts",+ "typescript",+ `import { connectSlackCredentials } from "@vercel/connect/eve";+import { slackChannel } from "eve/channels/slack";++// SLACK_CONNECTOR is the UID returned by \`vercel connect create slack\`.+// For local setup, create a connector with:+// \`vercel connect create slack --name eve-chat-template --triggers\`.+const slackConnector = process.env.SLACK_CONNECTOR ?? "slack/eve-chat-template";++export default slackChannel({+ credentials: connectSlackCredentials(slackConnector),+ uploadPolicy: "disabled",+});+`,+ ),+ file(+ "agent/connections/linear.ts",+ "typescript",+ `import { connect } from "@vercel/connect/eve";+import { defineMcpClientConnection } from "eve/connections";++// LINEAR_CONNECTOR is the UID returned by Vercel Connect. For local setup,+// create a connector with \`vercel connect create https://mcp.linear.app/mcp --name linear\`.+const linearConnector = process.env.LINEAR_CONNECTOR ?? "linear";++export default defineMcpClientConnection({+ url: "https://mcp.linear.app/mcp",+ description:+ "Linear workspace: search and update issues, projects, cycles, comments, and planning work.",+ auth: connect(linearConnector),+});+`,+ ),+ file(+ "agent/connections/notion.ts",+ "typescript",+ `import { connect } from "@vercel/connect/eve";+import { defineMcpClientConnection } from "eve/connections";++// NOTION_CONNECTOR is provisioned by the "Deploy with Vercel" flow. For local+// setup, create a connector with \`vercel connect create mcp.notion.com --name notion\`.+const notionConnector = process.env.NOTION_CONNECTOR ?? "notion";++export default defineMcpClientConnection({+ url: "https://mcp.notion.com/mcp",+ description: "Notion workspace: search and edit pages and databases.",+ auth: connect(notionConnector),+});+`,+ ),+ file(+ "agent/connections/sentry.ts",+ "typescript",+ `import { connect } from "@vercel/connect/eve";+import { defineMcpClientConnection } from "eve/connections";++// SENTRY_CONNECTOR is the UID returned by Vercel Connect. For local setup,+// create a connector with \`vercel connect create https://mcp.sentry.dev/mcp --name sentry\`.+const sentryConnector = process.env.SENTRY_CONNECTOR ?? "sentry";++export default defineMcpClientConnection({+ url: "https://mcp.sentry.dev/mcp",+ description:+ "Sentry workspace: investigate issues, events, traces, releases, and project health.",+ auth: connect(sentryConnector),+});+`,+ ),+ file(+ "agent/instructions.md",+ "markdown",+ `# Identity++You are a concise assistant built with eve (https://eve.dev), a framework for+building durable agents as ordinary files in a TypeScript project. Use tools+when they are available.++When users ask what eve is or what this agent is built on, explain that eve+lets developers create agents that can run locally or on Vercel, serve chat and+HTTP interfaces, call tools and connections, stream progress, pause for human+input, and resume durable sessions across turns. Keep the explanation concise+and practical.++Use \`get_weather\` before answering questions about current weather or suggesting+weather-dependent plans.++When a user asks to work with Notion, Linear, or Sentry, use the matching+connection directly. Never say that you are searching for tools, looking for+available tools, or checking internal tool discovery.+`,+ ),+ file(+ "agent/skills/plan_a_trip.md",+ "markdown",+ `---+description: Use when the user wants help planning a trip or deciding what to do in a destination.+---++When planning a trip:++1. Ask for the destination and dates if the user has not given them.+2. Check the destination's weather with the \`get_weather\` tool before suggesting activities.+3. Suggest a short itinerary that fits the weather: outdoor activities when it is clear, indoor alternatives otherwise.+4. Keep the plan concise — a few bullet points per day, not an essay.+`,+ ),+ file(+ "agent/tools/get_weather.ts",+ "typescript",+ `import { defineTool } from "eve/tools";+import { z } from "zod";++// The runtime tool name comes from the filename, so the model sees this as+// \`get_weather\`. Tool filenames must be snake_case ASCII.+export default defineTool({+ description: "Get the current weather for a city.",+ inputSchema: z.object({ city: z.string().min(1) }),+ async execute({ city }) {+ return { city, condition: "Sunny", temperatureF: 72 };+ },+});+`,+ ),+ ],+ "eve-slack-agent": [+ file(+ "agent/agent.ts",+ "typescript",+ `import { defineAgent } from "eve";++export default defineAgent({+ model: "anthropic/claude-sonnet-5",+});+`,+ ),+ file(+ "agent/channels/slack.ts",+ "typescript",+ `import { connectSlackCredentials } from "@vercel/connect/eve";+import { slackChannel } from "eve/channels/slack";++// SLACK_CONNECTOR is provisioned by the "Deploy with Vercel" button. To set it+// up yourself, create a connector with \`vercel connect create slack --triggers\`+// and put its UID in SLACK_CONNECTOR (or replace the fallback below).+export default slackChannel({+ credentials: connectSlackCredentials(+ process.env.SLACK_CONNECTOR ?? "slack/my-agent",+ ),+});+`,+ ),+ file(+ "agent/instructions.md",+ "markdown",+ `# Identity++You are a concise assistant. Use tools when they are available.++Use \`get_weather\` before answering questions about current weather or suggesting+weather-dependent plans.+`,+ ),+ file(+ "agent/skills/plan_a_trip.md",+ "markdown",+ `---+description: Use when the user wants help planning a trip or deciding what to do in a destination.+---++When planning a trip:++1. Ask for the destination and dates if the user has not given them.+2. Check the destination's weather with the \`get_weather\` tool before suggesting activities.+3. Suggest a short itinerary that fits the weather: outdoor activities when it is clear, indoor alternatives otherwise.+4. Keep the plan concise — a few bullet points per day, not an essay.+`,+ ),+ file(+ "agent/tools/get_weather.ts",+ "typescript",+ `import { defineTool } from "eve/tools";+import { z } from "zod";++// The runtime tool name comes from the filename, so the model sees this as+// \`get_weather\`. Tool filenames must be snake_case ASCII.+export default defineTool({+ description: "Get the current weather for a city.",+ inputSchema: z.object({ city: z.string().min(1) }),+ async execute({ city }) {+ return { city, condition: "Sunny", temperatureF: 72 };+ },+});+`,+ ),+ ],+ "weather-agent-fixture": [+ file(+ "agent/agent.ts",+ "typescript",+ `import { defineAgent } from "eve";++export default defineAgent({+ model: "anthropic/claude-sonnet-5",+ modelOptions: {+ providerOptions: {+ openai: {+ reasoningEffort: "high",+ reasoningSummary: "auto",+ },+ },+ },+});+`,+ ),+ file(+ "agent/instructions.md",+ "markdown",+ `You are a weather-focused assistant. Be concise, accurate, and explicit about when you are using the local weather tool.+`,+ ),+ file(+ "agent/skills/get-weather.md",+ "markdown",+ `---+description: Use the weather tool before answering forecast or temperature questions.+---++When the user asks about weather, temperature, or forecast conditions, call the \`get_weather\` tool before answering.+`,+ ),+ file(+ "agent/tools/get_weather.ts",+ "typescript",+ `import { defineTool } from "eve/tools";+import { never } from "eve/tools/approval";+import { z } from "zod";++const sleep = (ms: number) => new Promise((res) => setTimeout(res, ms));++export default defineTool({+ approval: never(),+ description: "Get the current weather for a city.",+ inputSchema: z.object({+ city: z.string(),+ }),+ async execute(input) {+ const city = input.city;++ await sleep(300);++ return {+ city,+ temperatureF: 72,+ condition: "Sunny",+ summary: \`Sunny in \${city} with a light breeze.\`,+ };+ },+});+`,+ ),+ ],+};