import { z } from "zod"; import { datasourceInternalManifest } from "../datasources/types"; import { genericFormSchema } from "../form/types"; import { resolveSiteAttributes, siteAttributesSchema } from "./attributes"; import { sitemapSchema } from "./sitemap"; export const siteSchema = z.object({ id: z.string().describe("The unique identifier for the site."), label: z.string().describe("The label (name) of the site, only displayed to the site owner"), hostname: z.string().describe("The hostname of the site, e.g. example.com"), attributes: siteAttributesSchema, datasources: z.array(datasourceInternalManifest), sitemap: sitemapSchema, sitePrompt: z.string().describe("The user prompt that describes the site purpose and content"), promptFiles: z .array(z.object({ type: z.string(), path: z.string(), name: z.string() })) .optional() .describe("Array of object keys for files uploaded along with the site prompt"), }); export type Site = z.infer; export type PublicSite = Omit; export function createEmptyConfig(sitePrompt: string): Site { return { id: crypto.randomUUID(), label: `My site ${new Date().toLocaleString(undefined, { dateStyle: "short", timeStyle: "short" })}`, hostname: "example.com", sitePrompt, sitemap: [], attributes: resolveSiteAttributes(), datasources: [], }; }