Skip to content
30 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

The docs service answers every artifacts call: docs can be made, listed, shared, moved, trashed, restored, searched, versioned and edited live in their own rooms, agents read, write and recall them only where their person and everyone in the conversation can, and folio events go out on the bus, while Docs' pages keep working as before.1/**
2 * The templates g1t ships for folios. Docs' page templates
3 * (src/templates.ts) are the doc kind's, as they are; each later kind
4 * adds its own here (slides in Phase 4, dashboards in 5b, designs in 6b).
5 * A workspace's own are in `folio_templates`. Pure.
6 */
7import type { FolioKind, FolioTemplate } from "@g1t/contracts";
8
9import { BUILTIN_TEMPLATES } from "../templates.ts";
10
11/** Built-in ids are `builtin:<kind>:<slug>`; a doc's old `builtin:<slug>` is still found. */
12export const BUILTIN_FOLIO_TEMPLATES: FolioTemplate[] = BUILTIN_TEMPLATES.map((t) => ({
13 id: `builtin:doc:${t.id.replace(/^builtin:/, "")}`,
14 kind: "doc" as const,
15 name: t.name,
16 description: t.description,
17 icon: t.icon,
18 builtin: true,
19 body: t.markdown,
20 created_by: null,
21}));
22
23export function builtinFolioTemplate(id: string): FolioTemplate | null {
24 const wanted = String(id ?? "");
25 return BUILTIN_FOLIO_TEMPLATES.find((t) => t.id === wanted || t.id === `builtin:doc:${wanted.replace(/^builtin:/, "")}`) ?? null;
26}
27
28export function builtinFolioTemplates(kind?: FolioKind | null): FolioTemplate[] {
29 return kind ? BUILTIN_FOLIO_TEMPLATES.filter((t) => t.kind === kind) : BUILTIN_FOLIO_TEMPLATES;
30}