@aglyn/plugins-ai 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/components/ai-site-build-page.component.js +5 -3
- package/src/lib/components/ai-site-build-page.component.js.map +1 -1
- package/src/lib/components/ai-site-import-finish.component.d.ts +3 -1
- package/src/lib/components/ai-site-import-finish.component.js +3 -3
- package/src/lib/components/ai-site-import-finish.component.js.map +1 -1
- package/src/lib/components/ai-site-import-job.component.d.ts +4 -3
- package/src/lib/components/ai-site-import-job.component.js +141 -43
- package/src/lib/components/ai-site-import-job.component.js.map +1 -1
- package/src/lib/components/ai-site-import-plan.component.d.ts +42 -0
- package/src/lib/components/ai-site-import-plan.component.js +246 -0
- package/src/lib/components/ai-site-import-plan.component.js.map +1 -0
- package/src/lib/components/ai-site-import-start.component.d.ts +3 -1
- package/src/lib/components/ai-site-import-start.component.js +3 -2
- package/src/lib/components/ai-site-import-start.component.js.map +1 -1
- package/src/lib/components/ai-site-start-card.component.js +6 -2
- package/src/lib/components/ai-site-start-card.component.js.map +1 -1
- package/src/lib/components/ai-site-start-steps.component.d.ts +3 -2
- package/src/lib/components/ai-site-start-steps.component.js +12 -5
- package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.d.ts +47 -2
- package/src/lib/jobs/ai-job-import-step.js +356 -22
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.js +4 -1
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.d.ts +21 -2
- package/src/lib/jobs/ai-job-page-language.js +217 -5
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.d.ts +7 -0
- package/src/lib/jobs/ai-job-page-step.js +73 -12
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-plan-step.js +4 -2
- package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
- package/src/lib/jobs/ai-job-site-look.js +14 -5
- package/src/lib/jobs/ai-job-site-look.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.d.ts +10 -2
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-jobs.js +2 -1
- package/src/lib/jobs/ai-jobs.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.d.ts +43 -2
- package/src/lib/jobs/ai-site-import-compile.js +105 -62
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-document.d.ts +25 -1
- package/src/lib/jobs/ai-site-import-document.js +26 -7
- package/src/lib/jobs/ai-site-import-document.js.map +1 -1
- package/src/lib/jobs/ai-site-import-honesty.d.ts +65 -0
- package/src/lib/jobs/ai-site-import-honesty.js +271 -0
- package/src/lib/jobs/ai-site-import-honesty.js.map +1 -0
- package/src/lib/jobs/ai-site-import-improve.d.ts +233 -0
- package/src/lib/jobs/ai-site-import-improve.js +1151 -0
- package/src/lib/jobs/ai-site-import-improve.js.map +1 -0
- package/src/lib/jobs/ai-site-import-look.d.ts +4 -0
- package/src/lib/jobs/ai-site-import-look.js +16 -6
- package/src/lib/jobs/ai-site-import-look.js.map +1 -1
- package/src/lib/jobs/ai-site-import-pictures.d.ts +83 -0
- package/src/lib/jobs/ai-site-import-pictures.js +261 -0
- package/src/lib/jobs/ai-site-import-pictures.js.map +1 -0
- package/src/lib/jobs/ai-site-import-plan.d.ts +78 -0
- package/src/lib/jobs/ai-site-import-plan.js +627 -0
- package/src/lib/jobs/ai-site-import-plan.js.map +1 -0
- package/src/lib/jobs/ai-site-import-wording.js +2 -5
- package/src/lib/jobs/ai-site-import-wording.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -0
- package/src/lib/layout-language/ai-layout-compiler.js +10 -6
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/layout-language/ai-layout-design.d.ts +9 -0
- package/src/lib/layout-language/ai-layout-design.js +29 -3
- package/src/lib/layout-language/ai-layout-design.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame-source.d.ts +5 -0
- package/src/lib/layout-language/ai-layout-frame-source.js +4 -2
- package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -1
- package/src/lib/layout-language/ai-layout-frame.d.ts +2 -0
- package/src/lib/layout-language/ai-layout-frame.js +20 -12
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
- package/src/lib/layout-language/ai-layout-language.d.ts +8 -0
- package/src/lib/layout-language/ai-layout-language.js +7 -3
- package/src/lib/layout-language/ai-layout-language.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +62 -0
- package/src/lib/model/ai-site-import-fidelity.js +374 -0
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-ledger.d.ts +82 -0
- package/src/lib/model/ai-site-import-ledger.js +254 -0
- package/src/lib/model/ai-site-import-ledger.js.map +1 -0
- package/src/lib/model/ai-site-import-view.d.ts +110 -6
- package/src/lib/model/ai-site-import-view.js +166 -13
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +227 -2
- package/src/lib/model/ai-site-import.js +312 -15
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/model/ai-site-job.js +4 -0
- package/src/lib/model/ai-site-job.js.map +1 -1
- package/src/lib/model/ai-site-kinds.d.ts +2 -0
- package/src/lib/model/ai-site-kinds.js +7 -0
- package/src/lib/model/ai-site-kinds.js.map +1 -1
- package/src/lib/model/ai-site-look.d.ts +14 -5
- package/src/lib/model/ai-site-look.js +22 -16
- package/src/lib/model/ai-site-look.js.map +1 -1
- package/src/lib/model/ai-site-start.d.ts +37 -7
- package/src/lib/model/ai-site-start.js +54 -10
- package/src/lib/model/ai-site-start.js.map +1 -1
- package/src/lib/model/ai-site-starter-look.d.ts +69 -0
- package/src/lib/model/ai-site-starter-look.js +90 -0
- package/src/lib/model/ai-site-starter-look.js.map +1 -0
- package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -0
- package/src/lib/runtime/ai-doctrine-validators.js +3 -2
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-doctrine.d.ts +10 -0
- package/src/lib/runtime/ai-doctrine.js +16 -2
- package/src/lib/runtime/ai-doctrine.js.map +1 -1
- package/src/lib/server/ai-jobs-resume.js +12 -3
- package/src/lib/server/ai-jobs-resume.js.map +1 -1
- package/src/lib/server/ai-jobs-route.js +5 -1
- package/src/lib/server/ai-jobs-route.js.map +1 -1
- package/src/lib/server/ai-site-import-route.d.ts +6 -0
- package/src/lib/server/ai-site-import-route.js +8 -1
- package/src/lib/server/ai-site-import-route.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +46 -7
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +260 -14
- package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
- package/src/lib/site-import/fixtures/site-import-improve-answers.d.ts +33 -0
- package/src/lib/site-import/fixtures/site-import-improve-answers.js +457 -0
- package/src/lib/site-import/fixtures/site-import-improve-answers.js.map +1 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +29 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js +26 -0
- package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
- package/src/lib/site-import/site-import-flag.d.ts +17 -0
- package/src/lib/site-import/site-import-flag.js +15 -0
- package/src/lib/site-import/site-import-flag.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/layout-language/ai-layout-language.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AiTool } from '../providers/contract'\nimport { AI_ICON_WORDS } from '../runtime/ai-icon-library'\n\n/**\n * The compact layout language (AGL-3660): what a model designs a page, and a\n * site's header and footer, in — and the one place its shape is declared.\n *\n * ── Why a language, not a tree ───────────────────────────────────────────\n *\n * A page used to be asked for as a raw element tree, packed as escaped JSON\n * text inside a tool call and held to the doctrine's building rules: Grid\n * items sized as strings, every child attached, one h1, a destination on\n * every button, headings under their ceiling. A real model kept about half\n * of a page's sections on the first try, and a Free section was cut off at\n * its token ceiling. The founder chose a language over a library of section\n * templates (10/7): every page is designed for its own request, so no two\n * sites come out alike, and the rules hold because CODE writes the tree.\n *\n * So the model says WHAT each section is and how it is arranged, in a few\n * words of structure, and writes every word a visitor reads; the compiler\n * (`ai-layout-compiler.ts`) turns that into the element tree with the\n * palette's elements and the theme's tokens, by construction.\n *\n * ── The shape ────────────────────────────────────────────────────────────\n *\n * A page is its plan's sections, in order. A SECTION is\n * - `band` — its background: `plain` (the page), `soft` (a paper band),\n * `brand` (the brand color) or `dark` (always dark);\n * - `cols` — a row of columns by relative width, as `[7, 5]` or `[1, 1, 1]`,\n * up to four; absent, one column;\n * - `align` — `start` or `center`;\n * - `blocks` — what it shows, top to bottom.\n *\n * A BLOCK is one thing a visitor reads or uses. Its `kind` is one of\n * `AI_LAYOUT_BLOCK_KINDS`; `col` places it in a column of the row (0 first),\n * and a block with no `col` spans the section — above the row when it comes\n * before the first placed block, below it when it comes after. `text` is its\n * words, `to` where it goes, `style` its emphasis and `icon` a word from the\n * icon library. A group — `list`, `cards`, `steps`, `stats`, `quotes`,\n * `faq` — carries its `items`, each a `title`, a `text`, and optionally its\n * own `to` and `icon`.\n *\n * Where a block goes (`to`): `page:<id>` for a page of this site (its label\n * works too), `#<n>` for section n of this page, `form` for the site's form,\n * `phone` or `email` for the phone number or email the brief gives (a link\n * that calls or writes, AGL-3979), a form's or a component's id for a `form`\n * or `component` block, or an `https:` address the brief gave.\n *\n * A site's header and footer are two sections in the same language\n * (`AI_LAYOUT_FRAME_TOOL`): the header's brand and navigation are the\n * site's own and written by the compiler, so the model gives the header its\n * band, its alignment and an optional call-to-action button; the footer is\n * a section like any other.\n *\n * ── Cheap by shape ───────────────────────────────────────────────────────\n *\n * The schema is a structured object in the tool input (never JSON text in a\n * string), small enough for a strict tool (`tool-schema-limits.spec.ts`), and\n * the language's instructions ride in the cached prefix. A section is a few\n * dozen words of structure beside its copy, so a whole page is one answer.\n */\n\n/** Every kind of block, in the order the schema lists them. */\nexport const AI_LAYOUT_BLOCK_KINDS = [\n 'eyebrow',\n 'heading',\n 'lede',\n 'text',\n 'note',\n 'list',\n 'button',\n 'image',\n 'cards',\n 'steps',\n 'stats',\n 'quotes',\n 'faq',\n 'form',\n 'component',\n] as const\n\nexport type AiLayoutBlockKind = (typeof AI_LAYOUT_BLOCK_KINDS)[number]\n\n/** The kinds that carry `items`. */\nexport const AI_LAYOUT_GROUP_KINDS: ReadonlySet<string> = new Set<AiLayoutBlockKind>([\n 'list',\n 'cards',\n 'steps',\n 'stats',\n 'quotes',\n 'faq',\n])\n\nexport const AI_LAYOUT_BANDS = ['plain', 'soft', 'brand', 'dark'] as const\nexport type AiLayoutBand = (typeof AI_LAYOUT_BANDS)[number]\n\nexport const AI_LAYOUT_ALIGNS = ['start', 'center'] as const\nexport type AiLayoutAlign = (typeof AI_LAYOUT_ALIGNS)[number]\n\nexport const AI_LAYOUT_STYLES = [\n 'primary',\n 'secondary',\n 'quiet',\n 'large',\n] as const\nexport type AiLayoutStyle = (typeof AI_LAYOUT_STYLES)[number]\n\n/** The most columns a row holds; a fifth is folded into the fourth. */\nexport const AI_LAYOUT_MAX_COLS = 4\n\n/**\n * The most items a group shows: one under the eight copies rule 8 reads as a\n * list typed out by hand, which belongs in a dataset.\n */\nexport const AI_LAYOUT_MAX_ITEMS = 7\n\n/** The most quotes a group shows: each is a gap the owner fills with a real one. */\nexport const AI_LAYOUT_MAX_QUOTES = 3\n\nexport interface AiLayoutItem {\n title: string\n text: string\n to?: string\n icon?: string\n // ── A page brought in (AGL-4107): what the source's item shows beside its\n // title and text, every word as written. No model writes these: no tool\n // schema names them, and the compiler draws them only on a verbatim page.\n /** Its own icon, the source's drawing as a path on the 24-unit square. */\n iconPath?: string\n /** A figure that leads it: a step's number, a plan's price. */\n figure?: string\n /** Its further paragraphs, each its own line. */\n more?: string[]\n /** Its bullet points (a plan's features). */\n list?: string[]\n /** The mark each bullet carries, as a path on the 24-unit square. */\n listIconPath?: string\n /** Its own calls to action, last in it. */\n links?: AiLayoutLink[]\n /** The picture over it, from the site's library. */\n picture?: AiLayoutPicture\n /** A tag on it, drawn beside its title: \"Popular\" (AGL-4083). */\n badge?: string\n /** What its figure is for, drawn beside it: \"/mo\" (AGL-4083). */\n period?: string\n /** Its title names a row and is no heading of the source's (AGL-4083). */\n label?: true\n /** The filled square its icon sits in, and the icon's color in it, as theme roles (AGL-4138). */\n tile?: { fill: AiLayoutColorRole; color: AiLayoutColorRole | null }\n /** A second icon at the end of its first row, an arrow that it is a link, as a path on the 24-unit square (AGL-4138). */\n markPath?: string\n /** Its figure is set in the muted words' color (AGL-4138). */\n figureMuted?: true\n}\n\n/**\n * A theme color a page brought in draws a source's own color as (AGL-4138):\n * never a value, always one of the theme's roles.\n */\nexport type AiLayoutColorRole =\n | 'primary.main'\n | 'primary.contrastText'\n | 'tertiary.main'\n | 'tertiary.contrastText'\n | 'text.primary'\n | 'text.secondary'\n | 'action.hover'\n | 'divider'\n\n/**\n * How the source frames a picture of a page brought in (AGL-4138): the shape\n * a frame draws it at, as `aspect-ratio` writes it (\"1600 / 900\") — its own,\n * or one the source crops it to — or a height in px it is cropped to; its\n * fit; whether the source rounds it or sets it on a shadow.\n */\nexport interface AiLayoutPictureFit {\n ratio?: string\n height?: number\n /** The source crops it: `ratio` or `height` is a box of the source's, not the picture's own shape. */\n cropped?: true\n objectFit?: 'cover' | 'contain'\n /** Rounded by the source, 10 px or more. */\n rounded?: true\n shadow?: true\n /** Held narrower than its column by the source, to the theme's width at that breakpoint. */\n measure?: Exclude<AiLayoutWidth, 'xl'>\n}\n\n/** A link of a page brought in (AGL-4107): its words and where it goes, `page:<id>`, `https:`, `mailto:` or `tel:`. */\nexport interface AiLayoutLink {\n text: string\n to?: string\n style?: AiLayoutStyle\n}\n\n/** A picture of a page brought in (AGL-4107): the library's copy of the source's own. */\nexport interface AiLayoutPicture {\n src: string\n alt: string\n /** Its width over its height, where the library knows them. */\n ratio?: number\n /** Where pressing it goes. */\n to?: string\n /** A byline's portrait beside a few words, drawn small. */\n small?: boolean\n /** How the source frames it (AGL-4138). */\n fit?: AiLayoutPictureFit\n /** The film this picture is the poster of (AGL-4140): the Video element plays it from here. */\n video?: AiLayoutVideo\n}\n\n/**\n * A film of a page brought in (AGL-4140), as its source plays it: where it\n * plays from — a video host's link the Video element plays in that host's\n * player, or the file the old site serves, which plays from its address —\n * and what a search engine reads of it, as the source wrote them.\n */\nexport interface AiLayoutVideo {\n /** Which of the page's videos it is: what a button that plays it names (`video:<index>`). */\n index: number\n src: string\n title?: string\n description?: string\n /** `YYYY-MM-DD`. */\n uploadDate?: string\n durationSeconds?: number\n /** The box the source plays it in casts a shadow. */\n shadow?: boolean\n}\n\n/**\n * The block kinds only a page brought in draws (AGL-4107), never in a tool\n * schema: a TABLE of rows of cells, TABS whose panels hold blocks, a strip\n * of LOGOS — pictures, or short words as chips — and a VIDEO, the source's\n * film poster first (AGL-4140), and a ROW of columns past a section's first\n * (AGL-4152), which is the one `cols` names.\n */\nexport const AI_LAYOUT_IMPORT_BLOCK_KINDS = ['table', 'tabs', 'logos', 'video', 'row'] as const\nexport type AiLayoutImportBlockKind = (typeof AI_LAYOUT_IMPORT_BLOCK_KINDS)[number]\n\n/** A tab of a page brought in: its label and the blocks its panel shows. */\nexport interface AiLayoutTab {\n label: string\n /** The tab the source shows open. */\n selected?: boolean\n blocks: AiLayoutBlock[]\n /**\n * The row of columns the source sets in the panel (AGL-4114), as a\n * section's `cols`: relative widths, its blocks placed by `col`.\n */\n cols?: number[]\n}\n\nexport interface AiLayoutBlock {\n kind: AiLayoutBlockKind | AiLayoutImportBlockKind\n col?: number\n text?: string\n to?: string\n style?: AiLayoutStyle\n icon?: string\n items?: AiLayoutItem[]\n // ── A page brought in (AGL-4107), never in a tool schema ──\n /** An image block's picture, the source's own. */\n picture?: AiLayoutPicture\n /** A table's rows, each its cells' words; `header` when its first row names the columns. */\n rows?: Array<{ cells: string[] }>\n header?: boolean\n /** A tab strip's tabs. */\n tabs?: AiLayoutTab[]\n /** How a group is drawn, as the page's design answer chose (`submit_design`). */\n variant?: AiLayoutGroupStyle\n /** The columns the source lays a group's items out in on a wide screen. */\n columns?: number\n /** Each item is a row of its own, its parts side by side, one under another (AGL-4083). */\n inline?: true\n // ── A page brought in (AGL-4138): how the source draws it, never in a tool\n // schema, and read only on a verbatim page ──\n /** An eyebrow set in a pill of its own. */\n chip?: true\n /** An eyebrow's color, as a theme role. */\n color?: AiLayoutColorRole\n /** A group's columns on a tablet, where they are fewer than on a wide screen. */\n columnsSm?: number\n /** How a group's items set their words, where it is not their section's alignment. */\n itemsAlign?: AiLayoutAlign\n /** The line a group's items are drawn with along one side, in place of a box. */\n rule?: { side: 'top' | 'right' | 'bottom' | 'left'; width: 1 | 2 | 3; color: AiLayoutColorRole | null }\n /** A video block's film (AGL-4140); its `picture` is the poster. */\n video?: AiLayoutVideo\n /** A row block's columns (AGL-4152), by relative width, each its blocks top to bottom. */\n row?: Array<{ weight: number; blocks: AiLayoutBlock[] }>\n}\n\n/** How a group of a page brought in is drawn (AGL-4107): the compiler's group variants a source can show. */\nexport const AI_LAYOUT_GROUP_STYLES = ['cards', 'ruled', 'icons', 'pictures', 'articles'] as const\nexport type AiLayoutGroupStyle = (typeof AI_LAYOUT_GROUP_STYLES)[number]\n\n/** The heroes a page brought in may open with (AGL-4107): each lays the source's own picture beside, behind or under its words. */\nexport const AI_LAYOUT_IMPORT_HEROES = ['split', 'bleed', 'cover', 'poster', 'column', 'editorial', 'panel'] as const\nexport type AiLayoutImportHero = (typeof AI_LAYOUT_IMPORT_HEROES)[number]\n\nexport interface AiLayoutSection {\n band?: AiLayoutBand\n cols?: number[]\n align?: AiLayoutAlign\n blocks: AiLayoutBlock[]\n /** A page brought in (AGL-4107): the hero its first section opens as, around the source's picture. */\n hero?: AiLayoutImportHero\n /** A page brought in (AGL-4083): its Container's Max Width, as wide as its source runs. */\n width?: AiLayoutWidth\n /**\n * A page brought in and kept as it is (AGL-4152): the width its opening's\n * words are held to, the theme's breakpoint nearest the source's heading\n * measure. Absent, the hero's own share of its Container.\n */\n measure?: AiLayoutWidth\n}\n\n/** The Container element's Max Width choices a page brought in draws a section at (AGL-4083). */\nexport type AiLayoutWidth = 'sm' | 'md' | 'lg' | 'xl'\n\n/**\n * How a page brought in is finished (AGL-4152): `keep` draws it as its source\n * lays it out; `improve` lets its design move the layout. Either way every\n * word, item, picture and link is the source's.\n */\nexport type AiLayoutImportFinish = 'keep' | 'improve'\n\n/** A page: its plan's sections, in order. */\nexport interface AiLayoutPageDoc {\n sections: AiLayoutSection[]\n}\n\n/** A site's frame: the header and the footer every page renders between. */\nexport interface AiLayoutFrameDoc {\n header: AiLayoutSection\n footer: AiLayoutSection\n}\n\nconst ITEM_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['title', 'text', 'to', 'icon'],\n properties: {\n title: { type: 'string' },\n text: { type: 'string' },\n to: { type: 'string' },\n icon: { type: 'string' },\n },\n} as const\n\nconst BLOCK_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['kind', 'col', 'text', 'to', 'style', 'icon', 'items'],\n properties: {\n kind: { type: 'string', enum: [...AI_LAYOUT_BLOCK_KINDS] },\n col: { type: 'integer' },\n text: { type: 'string' },\n to: { type: 'string' },\n style: { type: 'string', enum: [...AI_LAYOUT_STYLES, 'none'] },\n icon: { type: 'string' },\n items: { type: 'array', items: ITEM_SCHEMA },\n },\n} as const\n\nconst SECTION_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['band', 'cols', 'align', 'blocks'],\n properties: {\n band: { type: 'string', enum: [...AI_LAYOUT_BANDS] },\n cols: { type: 'array', items: { type: 'integer' } },\n align: { type: 'string', enum: [...AI_LAYOUT_ALIGNS] },\n blocks: { type: 'array', items: BLOCK_SCHEMA },\n },\n} as const\n\n/** The page tool: every section of one page, in plan order, in one answer. */\nexport const AI_LAYOUT_PAGE_TOOL: AiTool = {\n name: 'submit_page',\n description:\n 'Submit the page: one entry in sections for each planned section, in order, in the layout language.',\n strict: true,\n inputSchema: {\n type: 'object',\n additionalProperties: false,\n required: ['sections'],\n properties: { sections: { type: 'array', items: SECTION_SCHEMA } },\n },\n}\n\n/** The frame tool: the site's header and footer, in the same language. */\nexport const AI_LAYOUT_FRAME_TOOL: AiTool = {\n name: 'submit_frame',\n description:\n \"Submit the site's header and footer, each as a section in the layout language.\",\n strict: true,\n inputSchema: {\n type: 'object',\n additionalProperties: false,\n required: ['header', 'footer'],\n properties: { header: SECTION_SCHEMA, footer: SECTION_SCHEMA },\n },\n}\n\n/**\n * The language as a model is taught it: the cached instructions both doors\n * share. Every word of copy is the model's; this says only how a design is\n * written down and what each word becomes.\n */\nexport const AI_LAYOUT_LANGUAGE_TEXT = [\n \"You design web pages in a compact layout language. You decide the structure and write every word; the platform turns your design into the page, with the site's theme, spacing and type, so never describe styling beyond the words below.\",\n '',\n 'A page is a list of sections, one for each section the plan names, in that order. A section has:',\n '- band: plain (the page background), soft (a light band), brand (the brand color) or dark (always dark). Vary the bands down a page so neighboring sections read apart; keep brand and dark to one or two sections a page.',\n '- cols: relative column widths for a row, such as [1, 1] for halves, [7, 5] for a wide and a narrow column, or [1, 1, 1]; at most 4. [] for one column.',\n '- align: start or center.',\n '- blocks: what the section shows, top to bottom. A block with col 0 or more goes in that column of the row (0 is the first); a block with col -1 spans the whole section, above the row when it comes first and below it when it comes last.',\n 'Every field is always written: a block that does not use one writes \"\" (text, to, icon), \"none\" (style), -1 (col) or [] (items); an item that does not use one writes \"\".',\n '',\n 'Block kinds:',\n \"- eyebrow: a short label above a heading. heading: a heading; the first heading of the page's first section is the page's title, and the first heading of every other section is that section's heading. lede: the larger sentence under a heading. text: a paragraph. note: small print.\",\n '- button: text is the label and to says where it goes; style primary, secondary or quiet. Two buttons in a row read as a pair.',\n '- image: text describes the picture to place, which becomes its alt text; the owner adds the picture. icon names a drawing to show until then. to lightbox opens it large when pressed.',\n '- list: items are the lines (title only; text may be empty).',\n \"- cards, steps, stats, faq: items, each with a title and a text. cards are features or services; steps are numbered; stats are a figure (title) with its label (text), only for figures the brief gives; faq items are a question (title) and its answer (text). Use no quotes block: the site has no customer's words to show.\",\n \"- form: places a saved form by its id in to. component: places a reusable component by its id in to; its items fill the component's props, title the prop name and text the value.\",\n '- style large on a heading makes the page title display-sized. icon (on a block or an item) is one of: ' +\n AI_ICON_WORDS.join(', ') +\n '.',\n '',\n \"Where a link goes (to): page:<page id> for a page of this site; #<n> for section n of this page (counted from 1); form for the site's form; phone or email to call or write to the phone number or email the brief gives; or an https: address the brief gives. A button the page has nowhere to send is left out. A to value is never written into words: in text, name a page by its title.\",\n '',\n \"Writing: plain, specific copy in the site's voice, from the brief, the business and its audience, never filler. Keep a page title under 70 characters and a section heading under 80. The site is published exactly as you write it, so where the brief leaves out a fact such as a price, a figure, a name, a phone number, an email, an address or opening hours, leave it out: write the sentence without it, and make no list line, card or contact row for it. Never write a placeholder or a gap in square brackets, and never invent the fact. Never invent a customer, a review, an award or a statistic.\",\n '',\n 'Design each page for this business and this request: choose the bands, the rows and the blocks that tell its story best, so no two sites read alike.',\n].join('\\n')\n\n// ── Reading an answer ────────────────────────────────────────────────────\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value : undefined\n}\n\nfunction oneOf<T extends string>(\n value: unknown,\n values: readonly T[],\n): T | undefined {\n return typeof value === 'string' &&\n (values as readonly string[]).includes(value)\n ? (value as T)\n : undefined\n}\n\n/** What the reader settled on its own, for the job's record and the specs. */\nexport interface AiLayoutSettlement {\n /** Where: `sections[2].blocks[1]`, `header`. */\n at: string\n what: string\n}\n\nfunction readItem(raw: unknown): AiLayoutItem | null {\n if (!isRecord(raw)) return null\n const item: AiLayoutItem = {\n title: typeof raw['title'] === 'string' ? raw['title'] : '',\n text: typeof raw['text'] === 'string' ? raw['text'] : '',\n }\n if (!item.title.trim() && !item.text.trim()) return null\n const to = text(raw['to'])\n const icon = text(raw['icon'])\n return { ...item, ...(to ? { to } : {}), ...(icon ? { icon } : {}) }\n}\n\nfunction readBlock(\n raw: unknown,\n at: string,\n settled: AiLayoutSettlement[],\n): AiLayoutBlock | null {\n if (!isRecord(raw)) {\n settled.push({ at, what: 'not a block; left out' })\n return null\n }\n const kind = oneOf(raw['kind'], AI_LAYOUT_BLOCK_KINDS)\n if (!kind) {\n settled.push({\n at,\n what: `unknown kind ${JSON.stringify(raw['kind'] ?? null)}; left out`,\n })\n return null\n }\n const block: AiLayoutBlock = { kind }\n if (\n typeof raw['col'] === 'number' &&\n Number.isInteger(raw['col']) &&\n raw['col'] >= 0\n )\n block.col = raw['col']\n const words = text(raw['text'])\n if (words) block.text = words\n const to = text(raw['to'])\n if (to) block.to = to.trim()\n const style = oneOf(raw['style'], AI_LAYOUT_STYLES)\n if (style) block.style = style\n const icon = text(raw['icon'])\n if (icon) block.icon = icon.trim().toLowerCase()\n if (AI_LAYOUT_GROUP_KINDS.has(kind) || kind === 'component') {\n const items = (Array.isArray(raw['items']) ? raw['items'] : [])\n .map(readItem)\n .filter((item): item is AiLayoutItem => !!item)\n const most =\n kind === 'quotes'\n ? AI_LAYOUT_MAX_QUOTES\n : kind === 'component'\n ? Infinity\n : AI_LAYOUT_MAX_ITEMS\n if (items.length > most)\n settled.push({\n at,\n what: `${items.length} items; the first ${most} kept`,\n })\n if (items.length) block.items = items.slice(0, most)\n }\n // A block with nothing to show is no block: a group with no items, words\n // with no words. A form or a component may name its record alone.\n const empty = AI_LAYOUT_GROUP_KINDS.has(kind)\n ? !block.items?.length\n : kind === 'form' || kind === 'component'\n ? false\n : !block.text\n if (empty) {\n settled.push({ at, what: `an empty ${kind}; left out` })\n return null\n }\n return block\n}\n\n/** A section read from an answer, or `null` with why it could not be. */\nexport function aiReadLayoutSection(\n raw: unknown,\n at: string,\n settled: AiLayoutSettlement[],\n): AiLayoutSection | null {\n if (!isRecord(raw)) return null\n const section: AiLayoutSection = { blocks: [] }\n const band = oneOf(raw['band'], AI_LAYOUT_BANDS)\n if (band) section.band = band\n const align = oneOf(raw['align'], AI_LAYOUT_ALIGNS)\n if (align) section.align = align\n if (Array.isArray(raw['cols'])) {\n const cols = raw['cols'].filter(\n (value): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value > 0,\n )\n if (cols.length > AI_LAYOUT_MAX_COLS) {\n settled.push({\n at: `${at}.cols`,\n what: `${cols.length} columns; the first ${AI_LAYOUT_MAX_COLS} kept`,\n })\n }\n if (cols.length >= 2)\n section.cols = cols\n .slice(0, AI_LAYOUT_MAX_COLS)\n .map((value) => Math.min(12, Math.max(1, Math.round(value))))\n }\n const blocks = Array.isArray(raw['blocks']) ? raw['blocks'] : []\n blocks.forEach((entry, index) => {\n const block = readBlock(entry, `${at}.blocks[${index}]`, settled)\n if (!block) return\n if (\n block.col !== undefined &&\n section.cols &&\n block.col >= section.cols.length\n ) {\n settled.push({\n at: `${at}.blocks[${index}]`,\n what: `column ${block.col} of ${section.cols.length}; placed in the last`,\n })\n block.col = section.cols.length - 1\n }\n if (block.col !== undefined && !section.cols) delete block.col\n section.blocks.push(block)\n })\n return section.blocks.length ? section : null\n}\n\n/** A page answer read: the sections it gave, by plan position, and the positions it could not. */\nexport interface AiLayoutPageReading {\n /** One entry per planned section; `null` where the answer gave nothing usable. */\n sections: Array<AiLayoutSection | null>\n settled: AiLayoutSettlement[]\n}\n\n/** What a planned section is, as the reader matches an answer's sections to it. */\nexport interface AiLayoutPlannedSection {\n name: string\n items: number\n /** What the plan places in it: a form it binds there is one of these. */\n uses?: readonly string[]\n}\n\n/** A planned section's name that asks for a form: a contact, an inquiry, a booking. */\nconst FORM_SECTION =\n /\\b(form|contact|get in touch|reach|write|message|inquir(?:y|ies|e)|enquir(?:y|ies|e)|book(?:ing|ings)?|reserv(?:e|ation|ations)|quote|appointments?|rsvp|sign ?up|subscribe|newsletter|apply|application|register)\\b/i\n\n/** Whether a planned section is one a form may fill: it names one, or the plan binds a form there. */\nfunction takesForm(planned: AiLayoutPlannedSection): boolean {\n return FORM_SECTION.test(planned.name) || (planned.uses ?? []).some((ref) => /\\bform\\b/i.test(ref))\n}\n\n/** What a form's section scores against a planned section that asks for no form: never chosen while another fits. */\nconst AI_LAYOUT_FORM_MISFIT = -100\n\n/**\n * A word as a heading and a plan's name are compared: letters in any script,\n * with their accents (AGL-3791). As ASCII, \"Menú\" was \"men\", which every\n * \"mensajes\" began with, and \"galería\" was \"galer\" and \"a\".\n */\nconst WORD = /[\\p{L}\\p{M}\\p{N}]+/gu\nconst STOP = new Set(['a', 'an', 'and', 'the', 'of', 'for', 'to', 'our', 'your', 'with', 'in', 'on', 'we', 'us', 'you'])\nconst wordsOf = (text: string) => new Set((text.toLowerCase().match(WORD) ?? []).filter((word) => !STOP.has(word)))\n\n/** The kinds that show a section's repeated items. */\nconst ITEM_KINDS = new Set(['list', 'cards', 'steps', 'stats', 'quotes', 'faq', 'component'])\n\n/**\n * How well an answer's section fits a planned one: the words its headings\n * share with the plan's name, and whether it shows items where the plan\n * asked for them and none where it asked for none.\n *\n * A shared heading word outweighs the items (AGL-3660): a live portfolio's\n * plan gave \"Works Gallery\" no items, and its \"Selected works\" cards lost the\n * place to an inquiry form that shared no word with it. A section holding a\n * form fills only a planned section that asks for one — by its name, or a\n * form the plan binds there — so the form is never a page's stand-in.\n */\nfunction fit(raw: unknown, planned: AiLayoutPlannedSection): number {\n const blocks = isRecord(raw) && Array.isArray(raw['blocks']) ? raw['blocks'].filter(isRecord) : []\n const said = wordsOf(\n blocks\n .filter((block) => block['kind'] === 'heading' || block['kind'] === 'eyebrow')\n .map((block) => String(block['text'] ?? ''))\n .join(' '),\n )\n const named = wordsOf(planned.name)\n let shared = 0\n for (const word of named) if (said.has(word) || [...said].some((other) => other.startsWith(word) || word.startsWith(other))) shared += 1\n const showsItems = blocks.some((block) => ITEM_KINDS.has(String(block['kind'])) && (block['kind'] === 'component' || (Array.isArray(block['items']) && block['items'].length > 0)))\n const wantsItems = planned.items > 0\n const holdsForm = blocks.some((block) => block['kind'] === 'form')\n if (holdsForm && !takesForm(planned)) return AI_LAYOUT_FORM_MISFIT\n return shared * 2 + (wantsItems === showsItems ? 0.5 : -0.5)\n}\n\n/**\n * The answer's sections that best match the plan, in order, where it gave\n * more than the plan names (AGL-3660): a model that opened a page with a\n * hero of its own, or closed it with a call to action, shifted every planned\n * section by one, and the cut fell on the plan's last sections — the ones\n * that carried its items. Each planned section takes the answer's section\n * that fits it best, keeping the answer's order.\n */\nfunction alignSections(given: readonly unknown[], planned: readonly AiLayoutPlannedSection[]): number[] {\n const n = given.length\n const m = planned.length\n // best[i][j]: the best score placing plan sections j.. on answer sections i..\n const best: number[][] = Array.from({ length: n + 1 }, () => Array(m + 1).fill(-Infinity))\n for (let i = 0; i <= n; i += 1) best[i][m] = 0\n for (let i = n - 1; i >= 0; i -= 1) {\n for (let j = m - 1; j >= 0; j -= 1) {\n if (n - i < m - j) continue\n best[i][j] = Math.max(best[i + 1][j], fit(given[i], planned[j]) + best[i + 1][j + 1])\n }\n }\n const picked: number[] = []\n let i = 0\n for (let j = 0; j < m; j += 1) {\n while (i < n && best[i][j] !== fit(given[i], planned[j]) + best[i + 1][j + 1]) i += 1\n picked.push(i)\n i += 1\n }\n return picked\n}\n\n/**\n * The page an answer describes, against the sections its plan names: each\n * planned section takes the answer's section at its position — or, where the\n * answer gave more sections than the plan names and the plan's sections are\n * given, the one that fits it best (`alignSections`) — an answer's extra\n * sections are left out, and a planned section the answer left empty or out\n * is `null` — the one thing a re-ask asks for again.\n */\nexport function aiReadLayoutPage(\n raw: unknown,\n planned: number,\n plan?: readonly AiLayoutPlannedSection[],\n): AiLayoutPageReading {\n const settled: AiLayoutSettlement[] = []\n const given =\n isRecord(raw) && Array.isArray(raw['sections']) ? raw['sections'] : []\n const aligned =\n given.length > planned && plan && plan.length === planned\n ? alignSections(given, plan)\n : Array.from({ length: planned }, (_, index) => index)\n if (given.length > planned) {\n settled.push({\n at: 'sections',\n what: `${given.length} sections for a plan of ${planned}; ${\n aligned.every((at, index) => at === index) ? 'the extra left out' : `sections ${aligned.map((at) => at + 1).join(', ')} kept as the plan's`\n }`,\n })\n }\n const sections = aligned.map((at, index) =>\n aiReadLayoutSection(given[at], `sections[${index}]`, settled),\n )\n return { sections, settled }\n}\n\n/** A frame answer read: a header and a footer, either `null` where it was not usable. */\nexport function aiReadLayoutFrame(raw: unknown): {\n header: AiLayoutSection | null\n footer: AiLayoutSection | null\n settled: AiLayoutSettlement[]\n} {\n const settled: AiLayoutSettlement[] = []\n const record = isRecord(raw) ? raw : {}\n // A header needs no block of its own: its brand and navigation are the\n // site's, so an empty one is a plain bar.\n const header = isRecord(record['header'])\n ? (aiReadLayoutSection(record['header'], 'header', settled) ??\n readBare(record['header']))\n : null\n const footer = aiReadLayoutSection(record['footer'], 'footer', settled)\n return { header, footer, settled }\n}\n\n/** A section with no usable block, keeping only its band and alignment. */\nfunction readBare(raw: Record<string, unknown>): AiLayoutSection {\n const band = oneOf(raw['band'], AI_LAYOUT_BANDS)\n const align = oneOf(raw['align'], AI_LAYOUT_ALIGNS)\n return { ...(band ? { band } : {}), ...(align ? { align } : {}), blocks: [] }\n}\n\n// ── The design of a page brought in (AGL-4107) ───────────────────────────\n\n/**\n * A page brought in from its owner's own website is laid out as its source\n * lays it out (AGL-4107): the reader reads its sections, bands, rows, groups,\n * pictures and icons (`site-import/site-import-layout.ts`), and code compiles\n * that structure with every word as written (`jobs/ai-site-import-compile.ts`).\n * The one question left for a model is the page's DESIGN, over the structure\n * it is shown: which hero the opening becomes around its picture, how each\n * group is drawn, a band where the source gave none, the kind of a group the\n * reader could not tell, and an alignment. The schema below names only those\n * choices, so no word of copy, no line and no structure has anywhere to go.\n */\n\n/** A section's choice where the source's own stands: its band, its alignment, a group's kind. */\nexport const AI_LAYOUT_DESIGN_SOURCE = 'source'\n\n/** The kinds a group the reader could not tell may be read as. */\nexport const AI_LAYOUT_DESIGN_GROUP_KINDS = ['cards', 'steps', 'stats', 'list'] as const\nexport type AiLayoutDesignGroupKind = (typeof AI_LAYOUT_DESIGN_GROUP_KINDS)[number]\n\n/** The bands a design answer may give a section the source drew on no band of its own. */\nexport const AI_LAYOUT_DESIGN_BANDS = ['plain', 'soft', 'dark'] as const\n\nexport interface AiLayoutDesignGroup {\n /** The group's kind, where the answer reads it otherwise than the reader did. */\n kind?: AiLayoutDesignGroupKind\n style?: AiLayoutGroupStyle\n}\n\nexport interface AiLayoutDesignSection {\n /** The hero the opening becomes, or `none` to keep it as the source lays it out. */\n hero?: AiLayoutImportHero | 'none'\n band?: (typeof AI_LAYOUT_DESIGN_BANDS)[number]\n align?: AiLayoutAlign\n /** One for each group of the section, in order. */\n groups: AiLayoutDesignGroup[]\n}\n\n/** A design answer read: one entry per section of the page, `null` where it gave none. */\nexport interface AiLayoutDesignAnswer {\n sections: Array<AiLayoutDesignSection | null>\n}\n\nconst DESIGN_GROUP_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['kind', 'style'],\n properties: {\n kind: { type: 'string', enum: [AI_LAYOUT_DESIGN_SOURCE, ...AI_LAYOUT_DESIGN_GROUP_KINDS] },\n style: { type: 'string', enum: [...AI_LAYOUT_GROUP_STYLES] },\n },\n} as const\n\nconst DESIGN_SECTION_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['hero', 'band', 'align', 'groups'],\n properties: {\n hero: { type: 'string', enum: ['none', ...AI_LAYOUT_IMPORT_HEROES] },\n band: { type: 'string', enum: [AI_LAYOUT_DESIGN_SOURCE, ...AI_LAYOUT_DESIGN_BANDS] },\n align: { type: 'string', enum: [AI_LAYOUT_DESIGN_SOURCE, ...AI_LAYOUT_ALIGNS] },\n groups: { type: 'array', items: DESIGN_GROUP_SCHEMA },\n },\n} as const\n\n/** The design tool: one entry per section of a page brought in, in order, naming design choices only. */\nexport const AI_LAYOUT_DESIGN_TOOL: AiTool = {\n name: 'submit_design',\n description: \"Submit the page's design: one entry in sections for each section of the page, in order, with one entry in groups for each of its groups.\",\n strict: true,\n inputSchema: {\n type: 'object',\n additionalProperties: false,\n required: ['sections'],\n properties: { sections: { type: 'array', items: DESIGN_SECTION_SCHEMA } },\n },\n}\n\nfunction readDesignSection(raw: unknown): AiLayoutDesignSection | null {\n if (!isRecord(raw)) return null\n const section: AiLayoutDesignSection = { groups: [] }\n const hero = oneOf(raw['hero'], ['none', ...AI_LAYOUT_IMPORT_HEROES] as const)\n if (hero) section.hero = hero\n const band = oneOf(raw['band'], AI_LAYOUT_DESIGN_BANDS)\n if (band) section.band = band\n const align = oneOf(raw['align'], AI_LAYOUT_ALIGNS)\n if (align) section.align = align\n for (const entry of Array.isArray(raw['groups']) ? raw['groups'] : []) {\n const group: AiLayoutDesignGroup = {}\n if (isRecord(entry)) {\n const kind = oneOf(entry['kind'], AI_LAYOUT_DESIGN_GROUP_KINDS)\n if (kind) group.kind = kind\n const style = oneOf(entry['style'], AI_LAYOUT_GROUP_STYLES)\n if (style) group.style = style\n }\n section.groups.push(group)\n }\n return section\n}\n\n/**\n * A design answer read (AGL-4107): each section's choices by position, and\n * `null` for one it gave nothing usable for, which is then drawn as its\n * source has it. An answer carries no words, and none would be read.\n */\nexport function aiReadLayoutDesign(raw: unknown, sections: number): AiLayoutDesignAnswer {\n const given = isRecord(raw) && Array.isArray(raw['sections']) ? raw['sections'] : []\n return { sections: Array.from({ length: Math.max(0, sections) }, (_, index) => readDesignSection(given[index])) }\n}\n"],"names":["AI_ICON_WORDS","AI_LAYOUT_BLOCK_KINDS","AI_LAYOUT_GROUP_KINDS","Set","AI_LAYOUT_BANDS","AI_LAYOUT_ALIGNS","AI_LAYOUT_STYLES","AI_LAYOUT_MAX_COLS","AI_LAYOUT_MAX_ITEMS","AI_LAYOUT_MAX_QUOTES","AI_LAYOUT_IMPORT_BLOCK_KINDS","AI_LAYOUT_GROUP_STYLES","AI_LAYOUT_IMPORT_HEROES","ITEM_SCHEMA","type","additionalProperties","required","properties","title","text","to","icon","BLOCK_SCHEMA","kind","enum","col","style","items","SECTION_SCHEMA","band","cols","align","blocks","AI_LAYOUT_PAGE_TOOL","name","description","strict","inputSchema","sections","AI_LAYOUT_FRAME_TOOL","header","footer","AI_LAYOUT_LANGUAGE_TEXT","join","isRecord","value","Array","isArray","trim","undefined","oneOf","values","includes","readItem","raw","item","readBlock","at","settled","block","push","what","JSON","stringify","Number","isInteger","words","toLowerCase","has","map","filter","most","Infinity","length","slice","empty","aiReadLayoutSection","section","isFinite","Math","min","max","round","forEach","entry","index","FORM_SECTION","takesForm","planned","test","uses","some","ref","AI_LAYOUT_FORM_MISFIT","WORD","STOP","wordsOf","match","word","ITEM_KINDS","fit","said","String","named","shared","other","startsWith","showsItems","wantsItems","holdsForm","alignSections","given","n","m","best","from","fill","i","j","picked","aiReadLayoutPage","plan","aligned","_","every","aiReadLayoutFrame","record","readBare","AI_LAYOUT_DESIGN_SOURCE","AI_LAYOUT_DESIGN_GROUP_KINDS","AI_LAYOUT_DESIGN_BANDS","DESIGN_GROUP_SCHEMA","DESIGN_SECTION_SCHEMA","hero","groups","AI_LAYOUT_DESIGN_TOOL","readDesignSection","group","aiReadLayoutDesign"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAAS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,GAAG,CAAC,SAAS,IAAIA,GAAG,CAAC,SAAS,GAAG,EAAE,CAAE;QACrE,MAAMmF,QAA6B,CAAC;QACpC,IAAI7F,SAASwC,QAAQ;YACnB,MAAM7D,OAAO2B,MAAMkC,KAAK,CAAC,OAAO,EAAE6C;YAClC,IAAI1G,MAAMkH,MAAMlH,IAAI,GAAGA;YACvB,MAAMG,QAAQwB,MAAMkC,KAAK,CAAC,QAAQ,EAAEzE;YACpC,IAAIe,OAAO+G,MAAM/G,KAAK,GAAGA;QAC3B;QACAmD,QAAQyD,MAAM,CAAC1E,IAAI,CAAC6E;IACtB;IACA,OAAO5D;AACT;AAEA;;;;CAIC,GACD,OAAO,SAAS6D,mBAAmBpF,GAAY,EAAEhB,QAAgB;IAC/D,MAAMyE,QAAQnE,SAASU,QAAQR,MAAMC,OAAO,CAACO,GAAG,CAAC,WAAW,IAAIA,GAAG,CAAC,WAAW,GAAG,EAAE;IACpF,OAAO;QAAEhB,UAAUQ,MAAMqE,IAAI,CAAC;YAAE1C,QAAQM,KAAKE,GAAG,CAAC,GAAG3C;QAAU,GAAG,CAACqF,GAAGtC,QAAUmD,kBAAkBzB,KAAK,CAAC1B,MAAM;IAAG;AAClH"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/layout-language/ai-layout-language.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AiTool } from '../providers/contract'\nimport { AI_ICON_WORDS } from '../runtime/ai-icon-library'\n\n/**\n * The compact layout language (AGL-3660): what a model designs a page, and a\n * site's header and footer, in — and the one place its shape is declared.\n *\n * ── Why a language, not a tree ───────────────────────────────────────────\n *\n * A page used to be asked for as a raw element tree, packed as escaped JSON\n * text inside a tool call and held to the doctrine's building rules: Grid\n * items sized as strings, every child attached, one h1, a destination on\n * every button, headings under their ceiling. A real model kept about half\n * of a page's sections on the first try, and a Free section was cut off at\n * its token ceiling. The founder chose a language over a library of section\n * templates (10/7): every page is designed for its own request, so no two\n * sites come out alike, and the rules hold because CODE writes the tree.\n *\n * So the model says WHAT each section is and how it is arranged, in a few\n * words of structure, and writes every word a visitor reads; the compiler\n * (`ai-layout-compiler.ts`) turns that into the element tree with the\n * palette's elements and the theme's tokens, by construction.\n *\n * ── The shape ────────────────────────────────────────────────────────────\n *\n * A page is its plan's sections, in order. A SECTION is\n * - `band` — its background: `plain` (the page), `soft` (a paper band),\n * `brand` (the brand color) or `dark` (always dark);\n * - `cols` — a row of columns by relative width, as `[7, 5]` or `[1, 1, 1]`,\n * up to four; absent, one column;\n * - `align` — `start` or `center`;\n * - `blocks` — what it shows, top to bottom.\n *\n * A BLOCK is one thing a visitor reads or uses. Its `kind` is one of\n * `AI_LAYOUT_BLOCK_KINDS`; `col` places it in a column of the row (0 first),\n * and a block with no `col` spans the section — above the row when it comes\n * before the first placed block, below it when it comes after. `text` is its\n * words, `to` where it goes, `style` its emphasis and `icon` a word from the\n * icon library. A group — `list`, `cards`, `steps`, `stats`, `quotes`,\n * `faq` — carries its `items`, each a `title`, a `text`, and optionally its\n * own `to` and `icon`.\n *\n * Where a block goes (`to`): `page:<id>` for a page of this site (its label\n * works too), `#<n>` for section n of this page, `form` for the site's form,\n * `phone` or `email` for the phone number or email the brief gives (a link\n * that calls or writes, AGL-3979), a form's or a component's id for a `form`\n * or `component` block, or an `https:` address the brief gave.\n *\n * A site's header and footer are two sections in the same language\n * (`AI_LAYOUT_FRAME_TOOL`): the header's brand and navigation are the\n * site's own and written by the compiler, so the model gives the header its\n * band, its alignment and an optional call-to-action button; the footer is\n * a section like any other.\n *\n * ── Cheap by shape ───────────────────────────────────────────────────────\n *\n * The schema is a structured object in the tool input (never JSON text in a\n * string), small enough for a strict tool (`tool-schema-limits.spec.ts`), and\n * the language's instructions ride in the cached prefix. A section is a few\n * dozen words of structure beside its copy, so a whole page is one answer.\n */\n\n/** Every kind of block, in the order the schema lists them. */\nexport const AI_LAYOUT_BLOCK_KINDS = [\n 'eyebrow',\n 'heading',\n 'lede',\n 'text',\n 'note',\n 'list',\n 'button',\n 'image',\n 'cards',\n 'steps',\n 'stats',\n 'quotes',\n 'faq',\n 'form',\n 'component',\n] as const\n\nexport type AiLayoutBlockKind = (typeof AI_LAYOUT_BLOCK_KINDS)[number]\n\n/** The kinds that carry `items`. */\nexport const AI_LAYOUT_GROUP_KINDS: ReadonlySet<string> = new Set<AiLayoutBlockKind>([\n 'list',\n 'cards',\n 'steps',\n 'stats',\n 'quotes',\n 'faq',\n])\n\nexport const AI_LAYOUT_BANDS = ['plain', 'soft', 'brand', 'dark'] as const\nexport type AiLayoutBand = (typeof AI_LAYOUT_BANDS)[number]\n\nexport const AI_LAYOUT_ALIGNS = ['start', 'center'] as const\nexport type AiLayoutAlign = (typeof AI_LAYOUT_ALIGNS)[number]\n\nexport const AI_LAYOUT_STYLES = [\n 'primary',\n 'secondary',\n 'quiet',\n 'large',\n] as const\nexport type AiLayoutStyle = (typeof AI_LAYOUT_STYLES)[number]\n\n/** The most columns a row holds; a fifth is folded into the fourth. */\nexport const AI_LAYOUT_MAX_COLS = 4\n\n/**\n * The most items a group shows: one under the eight copies rule 8 reads as a\n * list typed out by hand, which belongs in a dataset.\n */\nexport const AI_LAYOUT_MAX_ITEMS = 7\n\n/** The most quotes a group shows: each is a gap the owner fills with a real one. */\nexport const AI_LAYOUT_MAX_QUOTES = 3\n\nexport interface AiLayoutItem {\n title: string\n text: string\n to?: string\n icon?: string\n // ── A page brought in (AGL-4107): what the source's item shows beside its\n // title and text, every word as written. No model writes these: no tool\n // schema names them, and the compiler draws them only on a verbatim page.\n /** Its own icon, the source's drawing as a path on the 24-unit square. */\n iconPath?: string\n /** A figure that leads it: a step's number, a plan's price. */\n figure?: string\n /** Its further paragraphs, each its own line. */\n more?: string[]\n /** Its bullet points (a plan's features). */\n list?: string[]\n /** The mark each bullet carries, as a path on the 24-unit square. */\n listIconPath?: string\n /** Its own calls to action, last in it. */\n links?: AiLayoutLink[]\n /** The picture over it, from the site's library. */\n picture?: AiLayoutPicture\n /** A tag on it, drawn beside its title: \"Popular\" (AGL-4083). */\n badge?: string\n /** What its figure is for, drawn beside it: \"/mo\" (AGL-4083). */\n period?: string\n /** Its title names a row and is no heading of the source's (AGL-4083). */\n label?: true\n /** The filled square its icon sits in, and the icon's color in it, as theme roles (AGL-4138). */\n tile?: { fill: AiLayoutColorRole; color: AiLayoutColorRole | null }\n /** A second icon at the end of its first row, an arrow that it is a link, as a path on the 24-unit square (AGL-4138). */\n markPath?: string\n /** Its figure is set in the muted words' color (AGL-4138). */\n figureMuted?: true\n /** The source's picture a redesigned item shows (`submit_improved_page`, AGL-4152), by its ledger ref. */\n ref?: string\n}\n\n/**\n * A theme color a page brought in draws a source's own color as (AGL-4138):\n * never a value, always one of the theme's roles.\n */\nexport type AiLayoutColorRole =\n | 'primary.main'\n | 'primary.contrastText'\n | 'tertiary.main'\n | 'tertiary.contrastText'\n | 'text.primary'\n | 'text.secondary'\n | 'action.hover'\n | 'divider'\n\n/**\n * How the source frames a picture of a page brought in (AGL-4138): the shape\n * a frame draws it at, as `aspect-ratio` writes it (\"1600 / 900\") — its own,\n * or one the source crops it to — or a height in px it is cropped to; its\n * fit; whether the source rounds it or sets it on a shadow.\n */\nexport interface AiLayoutPictureFit {\n ratio?: string\n height?: number\n /** The source crops it: `ratio` or `height` is a box of the source's, not the picture's own shape. */\n cropped?: true\n objectFit?: 'cover' | 'contain'\n /** Rounded by the source, 10 px or more. */\n rounded?: true\n shadow?: true\n /** Held narrower than its column by the source, to the theme's width at that breakpoint. */\n measure?: Exclude<AiLayoutWidth, 'xl'>\n}\n\n/** A link of a page brought in (AGL-4107): its words and where it goes, `page:<id>`, `https:`, `mailto:` or `tel:`. */\nexport interface AiLayoutLink {\n text: string\n to?: string\n style?: AiLayoutStyle\n}\n\n/** A picture of a page brought in (AGL-4107): the library's copy of the source's own. */\nexport interface AiLayoutPicture {\n src: string\n alt: string\n /** Its width over its height, where the library knows them. */\n ratio?: number\n /** Where pressing it goes. */\n to?: string\n /** A byline's portrait beside a few words, drawn small. */\n small?: boolean\n /** How the source frames it (AGL-4138). */\n fit?: AiLayoutPictureFit\n /** The film this picture is the poster of (AGL-4140): the Video element plays it from here. */\n video?: AiLayoutVideo\n}\n\n/**\n * A film of a page brought in (AGL-4140), as its source plays it: where it\n * plays from — a video host's link the Video element plays in that host's\n * player, or the file the old site serves, which plays from its address —\n * and what a search engine reads of it, as the source wrote them.\n */\nexport interface AiLayoutVideo {\n /** Which of the page's videos it is: what a button that plays it names (`video:<index>`). */\n index: number\n src: string\n title?: string\n description?: string\n /** `YYYY-MM-DD`. */\n uploadDate?: string\n durationSeconds?: number\n /** The box the source plays it in casts a shadow. */\n shadow?: boolean\n}\n\n/**\n * The block kinds only a page brought in draws (AGL-4107), never in a tool\n * schema: a TABLE of rows of cells, TABS whose panels hold blocks, a strip\n * of LOGOS — pictures, or short words as chips — and a VIDEO, the source's\n * film poster first (AGL-4140), and a ROW of columns past a section's first\n * (AGL-4152), which is the one `cols` names.\n */\nexport const AI_LAYOUT_IMPORT_BLOCK_KINDS = ['table', 'tabs', 'logos', 'video', 'row'] as const\nexport type AiLayoutImportBlockKind = (typeof AI_LAYOUT_IMPORT_BLOCK_KINDS)[number]\n\n/** A tab of a page brought in: its label and the blocks its panel shows. */\nexport interface AiLayoutTab {\n label: string\n /** The tab the source shows open. */\n selected?: boolean\n blocks: AiLayoutBlock[]\n /**\n * The row of columns the source sets in the panel (AGL-4114), as a\n * section's `cols`: relative widths, its blocks placed by `col`.\n */\n cols?: number[]\n}\n\nexport interface AiLayoutBlock {\n kind: AiLayoutBlockKind | AiLayoutImportBlockKind\n col?: number\n text?: string\n to?: string\n style?: AiLayoutStyle\n icon?: string\n items?: AiLayoutItem[]\n // ── A page brought in (AGL-4107), never in a tool schema ──\n /** An image block's picture, the source's own. */\n picture?: AiLayoutPicture\n /** A table's rows, each its cells' words; `header` when its first row names the columns. */\n rows?: Array<{ cells: string[] }>\n header?: boolean\n /** A tab strip's tabs. */\n tabs?: AiLayoutTab[]\n /** How a group is drawn, as the page's design answer chose (`submit_design`). */\n variant?: AiLayoutGroupStyle\n /** The columns the source lays a group's items out in on a wide screen. */\n columns?: number\n /** Each item is a row of its own, its parts side by side, one under another (AGL-4083). */\n inline?: true\n // ── A page brought in (AGL-4138): how the source draws it, never in a tool\n // schema, and read only on a verbatim page ──\n /** An eyebrow set in a pill of its own. */\n chip?: true\n /** An eyebrow's color, as a theme role. */\n color?: AiLayoutColorRole\n /** A group's columns on a tablet, where they are fewer than on a wide screen. */\n columnsSm?: number\n /** How a group's items set their words, where it is not their section's alignment. */\n itemsAlign?: AiLayoutAlign\n /** The line a group's items are drawn with along one side, in place of a box. */\n rule?: { side: 'top' | 'right' | 'bottom' | 'left'; width: 1 | 2 | 3; color: AiLayoutColorRole | null }\n /** A video block's film (AGL-4140); its `picture` is the poster. */\n video?: AiLayoutVideo\n /** A row block's columns (AGL-4152), by relative width, each its blocks top to bottom. */\n row?: Array<{ weight: number; blocks: AiLayoutBlock[] }>\n}\n\n/** How a group of a page brought in is drawn (AGL-4107): the compiler's group variants a source can show. */\nexport const AI_LAYOUT_GROUP_STYLES = ['cards', 'ruled', 'icons', 'pictures', 'articles'] as const\nexport type AiLayoutGroupStyle = (typeof AI_LAYOUT_GROUP_STYLES)[number]\n\n/** The heroes a page brought in may open with (AGL-4107): each lays the source's own picture beside, behind or under its words. */\nexport const AI_LAYOUT_IMPORT_HEROES = ['split', 'bleed', 'cover', 'poster', 'column', 'editorial', 'panel'] as const\nexport type AiLayoutImportHero = (typeof AI_LAYOUT_IMPORT_HEROES)[number]\n\nexport interface AiLayoutSection {\n band?: AiLayoutBand\n cols?: number[]\n align?: AiLayoutAlign\n blocks: AiLayoutBlock[]\n /** A page brought in (AGL-4107): the hero its first section opens as, around the source's picture. */\n hero?: AiLayoutImportHero\n /** A page brought in (AGL-4083): its Container's Max Width, as wide as its source runs. */\n width?: AiLayoutWidth\n /**\n * A page brought in and kept as it is (AGL-4152): the width its opening's\n * words are held to, the theme's breakpoint nearest the source's heading\n * measure. Absent, the hero's own share of its Container.\n */\n measure?: AiLayoutWidth\n}\n\n/** The Container element's Max Width choices a page brought in draws a section at (AGL-4083). */\nexport type AiLayoutWidth = 'sm' | 'md' | 'lg' | 'xl'\n\n/**\n * How a page brought in is finished (AGL-4152): `keep` draws it as its source\n * lays it out; `improve` lets its design move the layout. Either way every\n * word, item, picture and link is the source's.\n */\nexport type AiLayoutImportFinish = 'keep' | 'improve'\n\n/** A page: its plan's sections, in order. */\nexport interface AiLayoutPageDoc {\n sections: AiLayoutSection[]\n}\n\n/** A site's frame: the header and the footer every page renders between. */\nexport interface AiLayoutFrameDoc {\n header: AiLayoutSection\n footer: AiLayoutSection\n}\n\nconst ITEM_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['title', 'text', 'to', 'icon'],\n properties: {\n title: { type: 'string' },\n text: { type: 'string' },\n to: { type: 'string' },\n icon: { type: 'string' },\n },\n} as const\n\nconst BLOCK_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['kind', 'col', 'text', 'to', 'style', 'icon', 'items'],\n properties: {\n kind: { type: 'string', enum: [...AI_LAYOUT_BLOCK_KINDS] },\n col: { type: 'integer' },\n text: { type: 'string' },\n to: { type: 'string' },\n style: { type: 'string', enum: [...AI_LAYOUT_STYLES, 'none'] },\n icon: { type: 'string' },\n items: { type: 'array', items: ITEM_SCHEMA },\n },\n} as const\n\nconst SECTION_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['band', 'cols', 'align', 'blocks'],\n properties: {\n band: { type: 'string', enum: [...AI_LAYOUT_BANDS] },\n cols: { type: 'array', items: { type: 'integer' } },\n align: { type: 'string', enum: [...AI_LAYOUT_ALIGNS] },\n blocks: { type: 'array', items: BLOCK_SCHEMA },\n },\n} as const\n\n/** The page tool: every section of one page, in plan order, in one answer. */\nexport const AI_LAYOUT_PAGE_TOOL: AiTool = {\n name: 'submit_page',\n description:\n 'Submit the page: one entry in sections for each planned section, in order, in the layout language.',\n strict: true,\n inputSchema: {\n type: 'object',\n additionalProperties: false,\n required: ['sections'],\n properties: { sections: { type: 'array', items: SECTION_SCHEMA } },\n },\n}\n\n/** The frame tool: the site's header and footer, in the same language. */\nexport const AI_LAYOUT_FRAME_TOOL: AiTool = {\n name: 'submit_frame',\n description:\n \"Submit the site's header and footer, each as a section in the layout language.\",\n strict: true,\n inputSchema: {\n type: 'object',\n additionalProperties: false,\n required: ['header', 'footer'],\n properties: { header: SECTION_SCHEMA, footer: SECTION_SCHEMA },\n },\n}\n\n/**\n * The language as a model is taught it: the cached instructions both doors\n * share. Every word of copy is the model's; this says only how a design is\n * written down and what each word becomes.\n */\nexport const AI_LAYOUT_LANGUAGE_TEXT = [\n \"You design web pages in a compact layout language. You decide the structure and write every word; the platform turns your design into the page, with the site's theme, spacing and type, so never describe styling beyond the words below.\",\n '',\n 'A page is a list of sections, one for each section the plan names, in that order. A section has:',\n '- band: plain (the page background), soft (a light band), brand (the brand color) or dark (always dark). Vary the bands down a page so neighboring sections read apart; keep brand and dark to one or two sections a page.',\n '- cols: relative column widths for a row, such as [1, 1] for halves, [7, 5] for a wide and a narrow column, or [1, 1, 1]; at most 4. [] for one column.',\n '- align: start or center.',\n '- blocks: what the section shows, top to bottom. A block with col 0 or more goes in that column of the row (0 is the first); a block with col -1 spans the whole section, above the row when it comes first and below it when it comes last.',\n 'Every field is always written: a block that does not use one writes \"\" (text, to, icon), \"none\" (style), -1 (col) or [] (items); an item that does not use one writes \"\".',\n '',\n 'Block kinds:',\n \"- eyebrow: a short label above a heading. heading: a heading; the first heading of the page's first section is the page's title, and the first heading of every other section is that section's heading. lede: the larger sentence under a heading. text: a paragraph. note: small print.\",\n '- button: text is the label and to says where it goes; style primary, secondary or quiet. Two buttons in a row read as a pair.',\n '- image: text describes the picture to place, which becomes its alt text; the owner adds the picture. icon names a drawing to show until then. to lightbox opens it large when pressed.',\n '- list: items are the lines (title only; text may be empty).',\n \"- cards, steps, stats, faq: items, each with a title and a text. cards are features or services; steps are numbered; stats are a figure (title) with its label (text), only for figures the brief gives; faq items are a question (title) and its answer (text). Use no quotes block: the site has no customer's words to show.\",\n \"- form: places a saved form by its id in to. component: places a reusable component by its id in to; its items fill the component's props, title the prop name and text the value.\",\n '- style large on a heading makes the page title display-sized. icon (on a block or an item) is one of: ' +\n AI_ICON_WORDS.join(', ') +\n '.',\n '',\n \"Where a link goes (to): page:<page id> for a page of this site; #<n> for section n of this page (counted from 1); form for the site's form; phone or email to call or write to the phone number or email the brief gives; or an https: address the brief gives. A button the page has nowhere to send is left out. A to value is never written into words: in text, name a page by its title.\",\n '',\n \"Writing: plain, specific copy in the site's voice, from the brief, the business and its audience, never filler. Keep a page title under 70 characters and a section heading under 80. The site is published exactly as you write it, so where the brief leaves out a fact such as a price, a figure, a name, a phone number, an email, an address or opening hours, leave it out: write the sentence without it, and make no list line, card or contact row for it. Never write a placeholder or a gap in square brackets, and never invent the fact. Never invent a customer, a review, an award or a statistic.\",\n '',\n 'Design each page for this business and this request: choose the bands, the rows and the blocks that tell its story best, so no two sites read alike.',\n].join('\\n')\n\n// ── Reading an answer ────────────────────────────────────────────────────\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value : undefined\n}\n\nfunction oneOf<T extends string>(\n value: unknown,\n values: readonly T[],\n): T | undefined {\n return typeof value === 'string' &&\n (values as readonly string[]).includes(value)\n ? (value as T)\n : undefined\n}\n\n/** What the reader settled on its own, for the job's record and the specs. */\nexport interface AiLayoutSettlement {\n /** Where: `sections[2].blocks[1]`, `header`. */\n at: string\n what: string\n}\n\nfunction readItem(raw: unknown): AiLayoutItem | null {\n if (!isRecord(raw)) return null\n const item: AiLayoutItem = {\n title: typeof raw['title'] === 'string' ? raw['title'] : '',\n text: typeof raw['text'] === 'string' ? raw['text'] : '',\n }\n if (!item.title.trim() && !item.text.trim()) return null\n const to = text(raw['to'])\n const icon = text(raw['icon'])\n const ref = text(raw['ref'])\n return { ...item, ...(to ? { to } : {}), ...(icon ? { icon } : {}), ...(ref ? { ref: ref.trim() } : {}) }\n}\n\n/** One block of an answer read, or `null` with why it could not be. */\nexport function aiReadLayoutBlock(\n raw: unknown,\n at: string,\n settled: AiLayoutSettlement[],\n /** The most items a group keeps, where a door sets its own (AGL-4152): a page brought in keeps every item its owner has. */\n options: { mostItems?: number } = {},\n): AiLayoutBlock | null {\n if (!isRecord(raw)) {\n settled.push({ at, what: 'not a block; left out' })\n return null\n }\n const kind = oneOf(raw['kind'], AI_LAYOUT_BLOCK_KINDS)\n if (!kind) {\n settled.push({\n at,\n what: `unknown kind ${JSON.stringify(raw['kind'] ?? null)}; left out`,\n })\n return null\n }\n const block: AiLayoutBlock = { kind }\n if (\n typeof raw['col'] === 'number' &&\n Number.isInteger(raw['col']) &&\n raw['col'] >= 0\n )\n block.col = raw['col']\n const words = text(raw['text'])\n if (words) block.text = words\n const to = text(raw['to'])\n if (to) block.to = to.trim()\n const style = oneOf(raw['style'], AI_LAYOUT_STYLES)\n if (style) block.style = style\n const icon = text(raw['icon'])\n if (icon) block.icon = icon.trim().toLowerCase()\n if (AI_LAYOUT_GROUP_KINDS.has(kind) || kind === 'component') {\n const items = (Array.isArray(raw['items']) ? raw['items'] : [])\n .map(readItem)\n .filter((item): item is AiLayoutItem => !!item)\n const most =\n kind === 'quotes'\n ? AI_LAYOUT_MAX_QUOTES\n : kind === 'component'\n ? Infinity\n : (options.mostItems ?? AI_LAYOUT_MAX_ITEMS)\n if (items.length > most)\n settled.push({\n at,\n what: `${items.length} items; the first ${most} kept`,\n })\n if (items.length) block.items = items.slice(0, most)\n }\n // A block with nothing to show is no block: a group with no items, words\n // with no words. A form or a component may name its record alone.\n const empty = AI_LAYOUT_GROUP_KINDS.has(kind)\n ? !block.items?.length\n : kind === 'form' || kind === 'component'\n ? false\n : !block.text\n if (empty) {\n settled.push({ at, what: `an empty ${kind}; left out` })\n return null\n }\n return block\n}\n\n/** A section read from an answer, or `null` with why it could not be. */\nexport function aiReadLayoutSection(\n raw: unknown,\n at: string,\n settled: AiLayoutSettlement[],\n): AiLayoutSection | null {\n if (!isRecord(raw)) return null\n const section: AiLayoutSection = { blocks: [] }\n const band = oneOf(raw['band'], AI_LAYOUT_BANDS)\n if (band) section.band = band\n const align = oneOf(raw['align'], AI_LAYOUT_ALIGNS)\n if (align) section.align = align\n if (Array.isArray(raw['cols'])) {\n const cols = raw['cols'].filter(\n (value): value is number =>\n typeof value === 'number' && Number.isFinite(value) && value > 0,\n )\n if (cols.length > AI_LAYOUT_MAX_COLS) {\n settled.push({\n at: `${at}.cols`,\n what: `${cols.length} columns; the first ${AI_LAYOUT_MAX_COLS} kept`,\n })\n }\n if (cols.length >= 2)\n section.cols = cols\n .slice(0, AI_LAYOUT_MAX_COLS)\n .map((value) => Math.min(12, Math.max(1, Math.round(value))))\n }\n const blocks = Array.isArray(raw['blocks']) ? raw['blocks'] : []\n blocks.forEach((entry, index) => {\n const block = aiReadLayoutBlock(entry, `${at}.blocks[${index}]`, settled)\n if (!block) return\n if (\n block.col !== undefined &&\n section.cols &&\n block.col >= section.cols.length\n ) {\n settled.push({\n at: `${at}.blocks[${index}]`,\n what: `column ${block.col} of ${section.cols.length}; placed in the last`,\n })\n block.col = section.cols.length - 1\n }\n if (block.col !== undefined && !section.cols) delete block.col\n section.blocks.push(block)\n })\n return section.blocks.length ? section : null\n}\n\n/** A page answer read: the sections it gave, by plan position, and the positions it could not. */\nexport interface AiLayoutPageReading {\n /** One entry per planned section; `null` where the answer gave nothing usable. */\n sections: Array<AiLayoutSection | null>\n settled: AiLayoutSettlement[]\n}\n\n/** What a planned section is, as the reader matches an answer's sections to it. */\nexport interface AiLayoutPlannedSection {\n name: string\n items: number\n /** What the plan places in it: a form it binds there is one of these. */\n uses?: readonly string[]\n}\n\n/** A planned section's name that asks for a form: a contact, an inquiry, a booking. */\nconst FORM_SECTION =\n /\\b(form|contact|get in touch|reach|write|message|inquir(?:y|ies|e)|enquir(?:y|ies|e)|book(?:ing|ings)?|reserv(?:e|ation|ations)|quote|appointments?|rsvp|sign ?up|subscribe|newsletter|apply|application|register)\\b/i\n\n/** Whether a planned section is one a form may fill: it names one, or the plan binds a form there. */\nfunction takesForm(planned: AiLayoutPlannedSection): boolean {\n return FORM_SECTION.test(planned.name) || (planned.uses ?? []).some((ref) => /\\bform\\b/i.test(ref))\n}\n\n/** What a form's section scores against a planned section that asks for no form: never chosen while another fits. */\nconst AI_LAYOUT_FORM_MISFIT = -100\n\n/**\n * A word as a heading and a plan's name are compared: letters in any script,\n * with their accents (AGL-3791). As ASCII, \"Menú\" was \"men\", which every\n * \"mensajes\" began with, and \"galería\" was \"galer\" and \"a\".\n */\nconst WORD = /[\\p{L}\\p{M}\\p{N}]+/gu\nconst STOP = new Set(['a', 'an', 'and', 'the', 'of', 'for', 'to', 'our', 'your', 'with', 'in', 'on', 'we', 'us', 'you'])\nconst wordsOf = (text: string) => new Set((text.toLowerCase().match(WORD) ?? []).filter((word) => !STOP.has(word)))\n\n/** The kinds that show a section's repeated items. */\nconst ITEM_KINDS = new Set(['list', 'cards', 'steps', 'stats', 'quotes', 'faq', 'component'])\n\n/**\n * How well an answer's section fits a planned one: the words its headings\n * share with the plan's name, and whether it shows items where the plan\n * asked for them and none where it asked for none.\n *\n * A shared heading word outweighs the items (AGL-3660): a live portfolio's\n * plan gave \"Works Gallery\" no items, and its \"Selected works\" cards lost the\n * place to an inquiry form that shared no word with it. A section holding a\n * form fills only a planned section that asks for one — by its name, or a\n * form the plan binds there — so the form is never a page's stand-in.\n */\nfunction fit(raw: unknown, planned: AiLayoutPlannedSection): number {\n const blocks = isRecord(raw) && Array.isArray(raw['blocks']) ? raw['blocks'].filter(isRecord) : []\n const said = wordsOf(\n blocks\n .filter((block) => block['kind'] === 'heading' || block['kind'] === 'eyebrow')\n .map((block) => String(block['text'] ?? ''))\n .join(' '),\n )\n const named = wordsOf(planned.name)\n let shared = 0\n for (const word of named) if (said.has(word) || [...said].some((other) => other.startsWith(word) || word.startsWith(other))) shared += 1\n const showsItems = blocks.some((block) => ITEM_KINDS.has(String(block['kind'])) && (block['kind'] === 'component' || (Array.isArray(block['items']) && block['items'].length > 0)))\n const wantsItems = planned.items > 0\n const holdsForm = blocks.some((block) => block['kind'] === 'form')\n if (holdsForm && !takesForm(planned)) return AI_LAYOUT_FORM_MISFIT\n return shared * 2 + (wantsItems === showsItems ? 0.5 : -0.5)\n}\n\n/**\n * The answer's sections that best match the plan, in order, where it gave\n * more than the plan names (AGL-3660): a model that opened a page with a\n * hero of its own, or closed it with a call to action, shifted every planned\n * section by one, and the cut fell on the plan's last sections — the ones\n * that carried its items. Each planned section takes the answer's section\n * that fits it best, keeping the answer's order.\n */\nfunction alignSections(given: readonly unknown[], planned: readonly AiLayoutPlannedSection[]): number[] {\n const n = given.length\n const m = planned.length\n // best[i][j]: the best score placing plan sections j.. on answer sections i..\n const best: number[][] = Array.from({ length: n + 1 }, () => Array(m + 1).fill(-Infinity))\n for (let i = 0; i <= n; i += 1) best[i][m] = 0\n for (let i = n - 1; i >= 0; i -= 1) {\n for (let j = m - 1; j >= 0; j -= 1) {\n if (n - i < m - j) continue\n best[i][j] = Math.max(best[i + 1][j], fit(given[i], planned[j]) + best[i + 1][j + 1])\n }\n }\n const picked: number[] = []\n let i = 0\n for (let j = 0; j < m; j += 1) {\n while (i < n && best[i][j] !== fit(given[i], planned[j]) + best[i + 1][j + 1]) i += 1\n picked.push(i)\n i += 1\n }\n return picked\n}\n\n/**\n * The page an answer describes, against the sections its plan names: each\n * planned section takes the answer's section at its position — or, where the\n * answer gave more sections than the plan names and the plan's sections are\n * given, the one that fits it best (`alignSections`) — an answer's extra\n * sections are left out, and a planned section the answer left empty or out\n * is `null` — the one thing a re-ask asks for again.\n */\nexport function aiReadLayoutPage(\n raw: unknown,\n planned: number,\n plan?: readonly AiLayoutPlannedSection[],\n): AiLayoutPageReading {\n const settled: AiLayoutSettlement[] = []\n const given =\n isRecord(raw) && Array.isArray(raw['sections']) ? raw['sections'] : []\n const aligned =\n given.length > planned && plan && plan.length === planned\n ? alignSections(given, plan)\n : Array.from({ length: planned }, (_, index) => index)\n if (given.length > planned) {\n settled.push({\n at: 'sections',\n what: `${given.length} sections for a plan of ${planned}; ${\n aligned.every((at, index) => at === index) ? 'the extra left out' : `sections ${aligned.map((at) => at + 1).join(', ')} kept as the plan's`\n }`,\n })\n }\n const sections = aligned.map((at, index) =>\n aiReadLayoutSection(given[at], `sections[${index}]`, settled),\n )\n return { sections, settled }\n}\n\n/** A frame answer read: a header and a footer, either `null` where it was not usable. */\nexport function aiReadLayoutFrame(raw: unknown): {\n header: AiLayoutSection | null\n footer: AiLayoutSection | null\n settled: AiLayoutSettlement[]\n} {\n const settled: AiLayoutSettlement[] = []\n const record = isRecord(raw) ? raw : {}\n // A header needs no block of its own: its brand and navigation are the\n // site's, so an empty one is a plain bar.\n const header = isRecord(record['header'])\n ? (aiReadLayoutSection(record['header'], 'header', settled) ??\n readBare(record['header']))\n : null\n const footer = aiReadLayoutSection(record['footer'], 'footer', settled)\n return { header, footer, settled }\n}\n\n/** A section with no usable block, keeping only its band and alignment. */\nfunction readBare(raw: Record<string, unknown>): AiLayoutSection {\n const band = oneOf(raw['band'], AI_LAYOUT_BANDS)\n const align = oneOf(raw['align'], AI_LAYOUT_ALIGNS)\n return { ...(band ? { band } : {}), ...(align ? { align } : {}), blocks: [] }\n}\n\n// ── The design of a page brought in (AGL-4107) ───────────────────────────\n\n/**\n * A page brought in from its owner's own website is laid out as its source\n * lays it out (AGL-4107): the reader reads its sections, bands, rows, groups,\n * pictures and icons (`site-import/site-import-layout.ts`), and code compiles\n * that structure with every word as written (`jobs/ai-site-import-compile.ts`).\n * The one question left for a model is the page's DESIGN, over the structure\n * it is shown: which hero the opening becomes around its picture, how each\n * group is drawn, a band where the source gave none, the kind of a group the\n * reader could not tell, and an alignment. The schema below names only those\n * choices, so no word of copy, no line and no structure has anywhere to go.\n */\n\n/** A section's choice where the source's own stands: its band, its alignment, a group's kind. */\nexport const AI_LAYOUT_DESIGN_SOURCE = 'source'\n\n/** The kinds a group the reader could not tell may be read as. */\nexport const AI_LAYOUT_DESIGN_GROUP_KINDS = ['cards', 'steps', 'stats', 'list'] as const\nexport type AiLayoutDesignGroupKind = (typeof AI_LAYOUT_DESIGN_GROUP_KINDS)[number]\n\n/** The bands a design answer may give a section the source drew on no band of its own. */\nexport const AI_LAYOUT_DESIGN_BANDS = ['plain', 'soft', 'dark'] as const\n\nexport interface AiLayoutDesignGroup {\n /** The group's kind, where the answer reads it otherwise than the reader did. */\n kind?: AiLayoutDesignGroupKind\n style?: AiLayoutGroupStyle\n}\n\nexport interface AiLayoutDesignSection {\n /** The hero the opening becomes, or `none` to keep it as the source lays it out. */\n hero?: AiLayoutImportHero | 'none'\n band?: (typeof AI_LAYOUT_DESIGN_BANDS)[number]\n align?: AiLayoutAlign\n /** One for each group of the section, in order. */\n groups: AiLayoutDesignGroup[]\n}\n\n/** A design answer read: one entry per section of the page, `null` where it gave none. */\nexport interface AiLayoutDesignAnswer {\n sections: Array<AiLayoutDesignSection | null>\n}\n\nconst DESIGN_GROUP_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['kind', 'style'],\n properties: {\n kind: { type: 'string', enum: [AI_LAYOUT_DESIGN_SOURCE, ...AI_LAYOUT_DESIGN_GROUP_KINDS] },\n style: { type: 'string', enum: [...AI_LAYOUT_GROUP_STYLES] },\n },\n} as const\n\nconst DESIGN_SECTION_SCHEMA = {\n type: 'object',\n additionalProperties: false,\n required: ['hero', 'band', 'align', 'groups'],\n properties: {\n hero: { type: 'string', enum: ['none', ...AI_LAYOUT_IMPORT_HEROES] },\n band: { type: 'string', enum: [AI_LAYOUT_DESIGN_SOURCE, ...AI_LAYOUT_DESIGN_BANDS] },\n align: { type: 'string', enum: [AI_LAYOUT_DESIGN_SOURCE, ...AI_LAYOUT_ALIGNS] },\n groups: { type: 'array', items: DESIGN_GROUP_SCHEMA },\n },\n} as const\n\n/** The design tool: one entry per section of a page brought in, in order, naming design choices only. */\nexport const AI_LAYOUT_DESIGN_TOOL: AiTool = {\n name: 'submit_design',\n description: \"Submit the page's design: one entry in sections for each section of the page, in order, with one entry in groups for each of its groups.\",\n strict: true,\n inputSchema: {\n type: 'object',\n additionalProperties: false,\n required: ['sections'],\n properties: { sections: { type: 'array', items: DESIGN_SECTION_SCHEMA } },\n },\n}\n\nfunction readDesignSection(raw: unknown): AiLayoutDesignSection | null {\n if (!isRecord(raw)) return null\n const section: AiLayoutDesignSection = { groups: [] }\n const hero = oneOf(raw['hero'], ['none', ...AI_LAYOUT_IMPORT_HEROES] as const)\n if (hero) section.hero = hero\n const band = oneOf(raw['band'], AI_LAYOUT_DESIGN_BANDS)\n if (band) section.band = band\n const align = oneOf(raw['align'], AI_LAYOUT_ALIGNS)\n if (align) section.align = align\n for (const entry of Array.isArray(raw['groups']) ? raw['groups'] : []) {\n const group: AiLayoutDesignGroup = {}\n if (isRecord(entry)) {\n const kind = oneOf(entry['kind'], AI_LAYOUT_DESIGN_GROUP_KINDS)\n if (kind) group.kind = kind\n const style = oneOf(entry['style'], AI_LAYOUT_GROUP_STYLES)\n if (style) group.style = style\n }\n section.groups.push(group)\n }\n return section\n}\n\n/**\n * A design answer read (AGL-4107): each section's choices by position, and\n * `null` for one it gave nothing usable for, which is then drawn as its\n * source has it. An answer carries no words, and none would be read.\n */\nexport function aiReadLayoutDesign(raw: unknown, sections: number): AiLayoutDesignAnswer {\n const given = isRecord(raw) && Array.isArray(raw['sections']) ? raw['sections'] : []\n return { sections: Array.from({ length: Math.max(0, sections) }, (_, index) => readDesignSection(given[index])) }\n}\n"],"names":["AI_ICON_WORDS","AI_LAYOUT_BLOCK_KINDS","AI_LAYOUT_GROUP_KINDS","Set","AI_LAYOUT_BANDS","AI_LAYOUT_ALIGNS","AI_LAYOUT_STYLES","AI_LAYOUT_MAX_COLS","AI_LAYOUT_MAX_ITEMS","AI_LAYOUT_MAX_QUOTES","AI_LAYOUT_IMPORT_BLOCK_KINDS","AI_LAYOUT_GROUP_STYLES","AI_LAYOUT_IMPORT_HEROES","ITEM_SCHEMA","type","additionalProperties","required","properties","title","text","to","icon","BLOCK_SCHEMA","kind","enum","col","style","items","SECTION_SCHEMA","band","cols","align","blocks","AI_LAYOUT_PAGE_TOOL","name","description","strict","inputSchema","sections","AI_LAYOUT_FRAME_TOOL","header","footer","AI_LAYOUT_LANGUAGE_TEXT","join","isRecord","value","Array","isArray","trim","undefined","oneOf","values","includes","readItem","raw","item","ref","aiReadLayoutBlock","at","settled","options","block","push","what","JSON","stringify","Number","isInteger","words","toLowerCase","has","map","filter","most","Infinity","mostItems","length","slice","empty","aiReadLayoutSection","section","isFinite","Math","min","max","round","forEach","entry","index","FORM_SECTION","takesForm","planned","test","uses","some","AI_LAYOUT_FORM_MISFIT","WORD","STOP","wordsOf","match","word","ITEM_KINDS","fit","said","String","named","shared","other","startsWith","showsItems","wantsItems","holdsForm","alignSections","given","n","m","best","from","fill","i","j","picked","aiReadLayoutPage","plan","aligned","_","every","aiReadLayoutFrame","record","readBare","AI_LAYOUT_DESIGN_SOURCE","AI_LAYOUT_DESIGN_GROUP_KINDS","AI_LAYOUT_DESIGN_BANDS","DESIGN_GROUP_SCHEMA","DESIGN_SECTION_SCHEMA","hero","groups","AI_LAYOUT_DESIGN_TOOL","readDesignSection","group","aiReadLayoutDesign"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAGD,SAASA,aAAa,QA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OqB,MAAMI,GAAG,CAAC,OAAO,EAAE8E;IAChC,IAAIvG,MAAMmD,QAAQnD,IAAI,GAAGA;IACzB,MAAME,QAAQmB,MAAMI,GAAG,CAAC,QAAQ,EAAEjD;IAClC,IAAI0B,OAAOiD,QAAQjD,KAAK,GAAGA;IAC3B,KAAK,MAAMwD,SAASzC,MAAMC,OAAO,CAACO,GAAG,CAAC,SAAS,IAAIA,GAAG,CAAC,SAAS,GAAG,EAAE,CAAE;QACrE,MAAMqF,QAA6B,CAAC;QACpC,IAAI/F,SAAS2C,QAAQ;YACnB,MAAMhE,OAAO2B,MAAMqC,KAAK,CAAC,OAAO,EAAE4C;YAClC,IAAI5G,MAAMoH,MAAMpH,IAAI,GAAGA;YACvB,MAAMG,QAAQwB,MAAMqC,KAAK,CAAC,QAAQ,EAAE5E;YACpC,IAAIe,OAAOiH,MAAMjH,KAAK,GAAGA;QAC3B;QACAsD,QAAQwD,MAAM,CAAC1E,IAAI,CAAC6E;IACtB;IACA,OAAO3D;AACT;AAEA;;;;CAIC,GACD,OAAO,SAAS4D,mBAAmBtF,GAAY,EAAEhB,QAAgB;IAC/D,MAAM2E,QAAQrE,SAASU,QAAQR,MAAMC,OAAO,CAACO,GAAG,CAAC,WAAW,IAAIA,GAAG,CAAC,WAAW,GAAG,EAAE;IACpF,OAAO;QAAEhB,UAAUQ,MAAMuE,IAAI,CAAC;YAAEzC,QAAQM,KAAKE,GAAG,CAAC,GAAG9C;QAAU,GAAG,CAACuF,GAAGrC,QAAUkD,kBAAkBzB,KAAK,CAACzB,MAAM;IAAG;AAClH"}
|
|
@@ -198,6 +198,66 @@ export interface SiteImportPageFidelity {
|
|
|
198
198
|
};
|
|
199
199
|
/** Under improved words (G4): how much of each line's content its rewrite keeps, held at `floor` a line. */
|
|
200
200
|
meaning?: SiteImportFidelityMeaning;
|
|
201
|
+
/** Under a generative Improve it (AGL-4152): the kept ledger, held at 1, and the design lines. */
|
|
202
|
+
improved?: SiteImportImprovedFidelity;
|
|
203
|
+
}
|
|
204
|
+
/** One line a generative Improve it is held to (AGL-4152): how much of what it asks the page does, and whether that is enough. */
|
|
205
|
+
export interface SiteImportImprovedLine {
|
|
206
|
+
done: number;
|
|
207
|
+
of: number;
|
|
208
|
+
ok: boolean;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A page a generative Improve it built, scored (AGL-4152). Its sections and
|
|
212
|
+
* words are the redesign's own, so what is scored is what must have come
|
|
213
|
+
* through and whether it reads as designed.
|
|
214
|
+
*/
|
|
215
|
+
export interface SiteImportImprovedFidelity {
|
|
216
|
+
/** What must have come through, each at 1. */
|
|
217
|
+
ledger: {
|
|
218
|
+
/** Every fact the source says, on the page. */
|
|
219
|
+
facts: SiteImportImprovedLine & {
|
|
220
|
+
missing: string[];
|
|
221
|
+
};
|
|
222
|
+
/** Facts and names on the page that nothing the import read says: none. */
|
|
223
|
+
invented: SiteImportImprovedLine & {
|
|
224
|
+
found: string[];
|
|
225
|
+
};
|
|
226
|
+
/** Every thing that must land, on the page. */
|
|
227
|
+
held: SiteImportImprovedLine & {
|
|
228
|
+
missing: string[];
|
|
229
|
+
};
|
|
230
|
+
/** Every link's destination, on the page. */
|
|
231
|
+
links: SiteImportImprovedLine & {
|
|
232
|
+
missing: string[];
|
|
233
|
+
};
|
|
234
|
+
/** The source's content words on the page, at `SITE_IMPORT_IMPROVED_MEANING` or more. */
|
|
235
|
+
meaning: SiteImportImprovedLine;
|
|
236
|
+
};
|
|
237
|
+
/** How it reads; a line is `null` where the page asks it nothing, or what it reads is not given. */
|
|
238
|
+
design: Record<SiteImportImprovedLineName, SiteImportImprovedLine | null>;
|
|
239
|
+
/** Whether the ledger holds whole. */
|
|
240
|
+
holds: boolean;
|
|
241
|
+
/** The lines short of the bar, ledger first. */
|
|
242
|
+
red: string[];
|
|
243
|
+
}
|
|
244
|
+
/** The design lines of a generative Improve it (AGL-4152). */
|
|
245
|
+
export declare const SITE_IMPORT_IMPROVED_LINES: readonly ["cta", "rhythm", "columns", "framing", "contrast", "frame", "phone"];
|
|
246
|
+
export type SiteImportImprovedLineName = (typeof SITE_IMPORT_IMPROVED_LINES)[number];
|
|
247
|
+
/** The share of a source's content words a redesign keeps on its page (AGL-4152). */
|
|
248
|
+
export declare const SITE_IMPORT_IMPROVED_MEANING = 0.6;
|
|
249
|
+
/** What a generative Improve it is scored against, besides its source. */
|
|
250
|
+
export interface SiteImportImprovedOptions {
|
|
251
|
+
/** Every other line the import read: a fact one of these says is no invention. */
|
|
252
|
+
scope?: readonly string[];
|
|
253
|
+
/** Every destination the source's links have on the new site (`page:<id>`, an address). Absent, not measured. */
|
|
254
|
+
destinations?: readonly string[];
|
|
255
|
+
/** How many forms have a saved form to place. Absent, every form the source has. */
|
|
256
|
+
forms?: number;
|
|
257
|
+
/** The site's header and footer, for the `frame` line. Absent, not measured. */
|
|
258
|
+
frame?: SiteImportFidelityTree | null;
|
|
259
|
+
/** A page the site's plan proposed: new, so no source's facts or meaning to hold, only what it says. */
|
|
260
|
+
proposed?: boolean;
|
|
201
261
|
}
|
|
202
262
|
/** How a page was finished and its words kept (AGL-4152), and the theme it is drawn in. */
|
|
203
263
|
export interface SiteImportFidelityOptions {
|
|
@@ -212,6 +272,8 @@ export interface SiteImportFidelityOptions {
|
|
|
212
272
|
* measured.
|
|
213
273
|
*/
|
|
214
274
|
theme?: SiteImportFidelityTheme | null;
|
|
275
|
+
/** Scored as a generative Improve it (AGL-4152): its kept ledger and design lines, in place of its structure. */
|
|
276
|
+
improved?: SiteImportImprovedOptions | null;
|
|
215
277
|
}
|
|
216
278
|
/** One scheme of a theme, as the fidelity reads it. */
|
|
217
279
|
export interface SiteImportFidelityScheme {
|