@aglyn/plugins-ai 1.15.2 → 1.17.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.
Files changed (46) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-import-plan.component.js +1 -1
  3. package/src/lib/components/ai-site-import-plan.component.js.map +1 -1
  4. package/src/lib/jobs/ai-job-import-step.js +6 -4
  5. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  6. package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
  7. package/src/lib/jobs/ai-job-page-language.js +29 -14
  8. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  9. package/src/lib/jobs/ai-job-page-step.js +3 -1
  10. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  11. package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
  12. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  13. package/src/lib/jobs/ai-site-import-compile.d.ts +9 -1
  14. package/src/lib/jobs/ai-site-import-compile.js +67 -1
  15. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  16. package/src/lib/jobs/ai-site-import-honesty.d.ts +6 -2
  17. package/src/lib/jobs/ai-site-import-honesty.js +5 -5
  18. package/src/lib/jobs/ai-site-import-honesty.js.map +1 -1
  19. package/src/lib/jobs/ai-site-import-improve.d.ts +93 -4
  20. package/src/lib/jobs/ai-site-import-improve.js +465 -24
  21. package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
  22. package/src/lib/jobs/ai-site-import-pictures.js +4 -2
  23. package/src/lib/jobs/ai-site-import-pictures.js.map +1 -1
  24. package/src/lib/jobs/ai-site-import-plan.d.ts +15 -1
  25. package/src/lib/jobs/ai-site-import-plan.js +27 -1
  26. package/src/lib/jobs/ai-site-import-plan.js.map +1 -1
  27. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -1
  28. package/src/lib/layout-language/ai-layout-compiler.js +20 -4
  29. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  30. package/src/lib/model/ai-site-import-fidelity.d.ts +18 -2
  31. package/src/lib/model/ai-site-import-fidelity.js +35 -11
  32. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  33. package/src/lib/model/ai-site-import-ledger.js +10 -2
  34. package/src/lib/model/ai-site-import-ledger.js.map +1 -1
  35. package/src/lib/model/ai-site-import-marks.d.ts +30 -0
  36. package/src/lib/model/ai-site-import-marks.js +39 -0
  37. package/src/lib/model/ai-site-import-marks.js.map +1 -0
  38. package/src/lib/model/ai-site-import-view.js +6 -1
  39. package/src/lib/model/ai-site-import-view.js.map +1 -1
  40. package/src/lib/model/ai-site-import.d.ts +8 -1
  41. package/src/lib/model/ai-site-import.js +12 -4
  42. package/src/lib/model/ai-site-import.js.map +1 -1
  43. package/src/lib/runtime/ai-node-tree.js +8 -0
  44. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  45. package/src/lib/runtime/ai-palette.generated.js +36 -5
  46. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
@@ -41,6 +41,10 @@ export interface AiSiteImportHonestyScope {
41
41
  /** Where a link may go, as an answer writes it, and the ledger's links' own destinations. */
42
42
  destinations: ReadonlyMap<string, string>;
43
43
  framing?: AiCopyFraming | null;
44
+ /** Words the platform's own request put to the answer, no one's name or fact (`siteImportFactScope`). */
45
+ vocabulary?: readonly string[];
46
+ /** This page's own `page:<id>`, where it has one: a link the source makes to the page it is on asks nothing of the answer. */
47
+ own?: string | null;
44
48
  }
45
49
  /** Whether text is in the source's own words: its fact tokens, and whatever a scope says of it. */
46
50
  export interface AiSiteImportHonestyFacts {
@@ -49,8 +53,8 @@ export interface AiSiteImportHonestyFacts {
49
53
  /** The source's words, as one text, for what a claim is checked against. */
50
54
  said: string;
51
55
  }
52
- /** What every line of an answer is checked against. */
53
- export declare function aiSiteImportHonestyFacts(scope: readonly string[]): AiSiteImportHonestyFacts;
56
+ /** What every line of an answer is checked against; `vocabulary` is said, and names and claims nothing. */
57
+ export declare function aiSiteImportHonestyFacts(scope: readonly string[], vocabulary?: readonly string[]): AiSiteImportHonestyFacts;
54
58
  /** What one line of new copy says that the source does not: a reason in words, or `null`. */
55
59
  export declare function aiSiteImportInventedIn(text: string, held: AiSiteImportHonestyFacts): string | null;
56
60
  /**
@@ -106,8 +106,8 @@ export const AI_SITE_IMPORT_DROPPED_ITEM_CODE = 'improve-dropped-item';
106
106
  /\b(?:two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty|thirty|forty|fifty)\s+(?:years?|clients?|customers?|families|projects?|homes?|offices?|locations?|reviews?|stars?)\b/i
107
107
  ];
108
108
  /** A word that opens a line in quotation marks and runs on: a testimonial, whoever is made to say it. */ const QUOTED = /^["“”'‘][^"“”]{15,}["“”]/;
109
- /** What every line of an answer is checked against. */ export function aiSiteImportHonestyFacts(scope) {
110
- const facts = siteImportFactScope(scope);
109
+ /** What every line of an answer is checked against; `vocabulary` is said, and names and claims nothing. */ export function aiSiteImportHonestyFacts(scope, vocabulary = []) {
110
+ const facts = siteImportFactScope(scope, vocabulary);
111
111
  return {
112
112
  facts,
113
113
  tokens: new Set(scope.flatMap((text)=>siteImportFactTokens(text, facts, false))),
@@ -198,9 +198,9 @@ const dropped = (message)=>({
198
198
  * An answer held to what the import read, and to its ledger (AGL-4152). No
199
199
  * violation is a redesign that may be built; each one names its line.
200
200
  */ export function aiSiteImportHonesty(sections, input) {
201
- var _ref;
201
+ var _input_vocabulary, _ref;
202
202
  var _sections_;
203
- const held = aiSiteImportHonestyFacts(input.scope);
203
+ const held = aiSiteImportHonestyFacts(input.scope, (_input_vocabulary = input.vocabulary) != null ? _input_vocabulary : []);
204
204
  const contacts = input.scope.join(' \n ');
205
205
  const out = [];
206
206
  const refs = new Map(input.ledger.items.map((item)=>[
@@ -262,7 +262,7 @@ const dropped = (message)=>({
262
262
  const keptLines = new Set(input.ledger.items.filter((item)=>kept.has(item.ref)).flatMap((item)=>item.lines));
263
263
  for (const link of input.ledger.links){
264
264
  const to = input.destinations.get(link.ref);
265
- if (!to || links.has(to) || keptLines.has(link.line)) continue;
265
+ if (!to || to === input.own || links.has(to) || keptLines.has(link.line)) continue;
266
266
  out.push(dropped(`${link.ref} ("${link.text.slice(0, 60)}") goes nowhere on the page. Link to it from a button or an item.`));
267
267
  }
268
268
  return out;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-site-import-honesty.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\n/*==========================================\n * NEW COPY MAY SAY WHAT THE SOURCE SUPPORTS, AND NOTHING IT DOES NOT (AGL-4152).\n *\n * A redesign may describe what the source says and what this kind of business\n * generally does. It may not make up a name, number, price, date, testimonial,\n * client, award, credential, address or guarantee, and it may not lose what\n * the ledger holds. This is the gate, pure, one answer at a time:\n *\n * - `improve-invented-fact`: a word of its copy says a fact, a name, a\n * credential or a guarantee outside what the import read, or a link goes\n * somewhere the source does not.\n * - `improve-dropped-item`: something the ledger holds is not on the page, or\n * is on it twice.\n *\n * Each names the line, so the one re-ask can mend that line.\n *=========================================*/\n\nimport { aiLayoutGuardContacts } from '../layout-language/ai-layout-copy'\nimport type { AiLayoutBlock, AiLayoutItem } from '../layout-language/ai-layout-language'\nimport { siteImportFactScope, siteImportFactTokens, type SiteImportFactScope } from '../model/ai-site-import-fidelity'\nimport type { SiteImportLedger } from '../model/ai-site-import-ledger'\nimport { detectOffVoiceCopy, type AiCopyFraming, type AiDoctrineViolation } from '../runtime/ai-doctrine-validators'\nimport { aiPlaceholderTokens } from '../runtime/ai-placeholder-tokens'\n\nexport const AI_SITE_IMPORT_INVENTED_FACT_CODE = 'improve-invented-fact'\nexport const AI_SITE_IMPORT_DROPPED_ITEM_CODE = 'improve-dropped-item'\n\n/** A block a redesign answered: the layout language, or a `keep` of a ledger ref. */\nexport type AiSiteImportImprovedBlock = AiLayoutBlock | { kind: 'keep'; ref: string; col?: number }\n\n/** A section a redesign answered. */\nexport interface AiSiteImportImprovedSection {\n band?: 'plain' | 'soft' | 'brand' | 'dark'\n cols?: number[]\n align?: 'start' | 'center'\n blocks: AiSiteImportImprovedBlock[]\n}\n\n/** What a redesign's copy is held against. */\nexport interface AiSiteImportHonestyScope {\n ledger: SiteImportLedger\n /** Every line the import read: this page's, the wave's other pages', and what the home page says of the site. */\n scope: readonly string[]\n /** Where a link may go, as an answer writes it, and the ledger's links' own destinations. */\n destinations: ReadonlyMap<string, string>\n framing?: AiCopyFraming | null\n}\n\n/** Words past a sentence's first that are no one's name, in any heading: the short form of a question list. */\nconst NO_NAMES = new Set(['FAQ', 'FAQs', 'I'])\n\n/**\n * Credentials and guarantees: outside what the source says, each is a claim\n * only its owner can make, however a sentence puts it.\n */\nconst CLAIMS: ReadonlyArray<readonly [string, RegExp]> = [\n ['licensed', /\\blicen[sc]ed\\b/i],\n ['certified', /\\b(?:board-)?certified\\b/i],\n ['accredited', /\\baccredited\\b/i],\n ['insured', /\\binsured\\b/i],\n ['bonded', /\\bbonded\\b/i],\n ['award', /\\baward(?:s|-winning)?\\b/i],\n ['guarantee', /\\bguarantee[ds]?\\b/i],\n ['warranty', /\\bwarrant(?:y|ies)\\b/i],\n ['money-back', /\\bmoney[- ]back\\b/i],\n ['top-rated', /\\btop[- ]rated\\b/i],\n ['five-star', /\\b(?:5|five)[- ]star\\b/i],\n ['voted', /\\bvoted\\b/i],\n ['featured in', /\\bfeatured in\\b/i],\n ['trusted by', /\\btrusted by\\b/i],\n]\n\n/** A count no digit says: \"hundreds of clients\", \"two decades\", \"ten years\". */\nconst COUNTS = [\n /\\b(?:hundreds|thousands|millions|dozens|decades?|centur(?:y|ies))\\b/i,\n /\\b(?:two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty|thirty|forty|fifty)\\s+(?:years?|clients?|customers?|families|projects?|homes?|offices?|locations?|reviews?|stars?)\\b/i,\n]\n\n/** A word that opens a line in quotation marks and runs on: a testimonial, whoever is made to say it. */\nconst QUOTED = /^[\"“”'‘][^\"“”]{15,}[\"“”]/\n\n/** Whether text is in the source's own words: its fact tokens, and whatever a scope says of it. */\nexport interface AiSiteImportHonestyFacts {\n facts: SiteImportFactScope\n tokens: ReadonlySet<string>\n /** The source's words, as one text, for what a claim is checked against. */\n said: string\n}\n\n/** What every line of an answer is checked against. */\nexport function aiSiteImportHonestyFacts(scope: readonly string[]): AiSiteImportHonestyFacts {\n const facts = siteImportFactScope(scope)\n return { facts, tokens: new Set(scope.flatMap((text) => siteImportFactTokens(text, facts, false))), said: scope.join(' \\n ') }\n}\n\nconst shown = (token: string) => `\"${token.replace(/^[a-z]+:/, '')}\"`\n\n/** What one line of new copy says that the source does not: a reason in words, or `null`. */\nexport function aiSiteImportInventedIn(text: string, held: AiSiteImportHonestyFacts): string | null {\n const invented = siteImportFactTokens(text, held.facts, true).filter((token) => !held.tokens.has(token) && !(token.startsWith('name:') && NO_NAMES.has(token.slice(5))))\n if (invented.length) return `it says ${[...new Set(invented)].map(shown).join(', ')}, which nothing the site says supports. Say only names and figures the site gives; a heading is in sentence case, so a capital reads as a name.`\n for (const [claim, pattern] of CLAIMS) {\n if (pattern.test(text) && !pattern.test(held.said)) return `it claims ${shown(claim)}, which the site does not. Leave credentials, awards and guarantees to the owner.`\n }\n for (const pattern of COUNTS) {\n const found = pattern.exec(text)?.[0]\n if (found && !new RegExp(`\\\\b${found.replace(/\\s+/g, '\\\\s+')}\\\\b`, 'i').test(held.said)) return `it says ${shown(found)}, a count the site does not give.`\n }\n if (QUOTED.test(text.trim()) && !held.said.includes(text.trim().slice(1, 20))) return 'it reads as a testimonial the site does not have. Quote a customer only by keeping their quote.'\n return null\n}\n\n/** Each written line of a block, as its place on the page names it. */\nfunction writtenLines(block: AiLayoutBlock, at: string): Array<{ at: string; text: string }> {\n const out: Array<{ at: string; text: string }> = []\n if (block.text && block.kind !== 'image') out.push({ at, text: block.text })\n ;(block.items ?? []).forEach((item: AiLayoutItem, index) => {\n if (item.title.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.title })\n if (item.text.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.text })\n })\n return out\n}\n\n/** Where a block sends a visitor, its own and its items'. */\nconst linksOf = (block: AiLayoutBlock): string[] => [...(block.to ? [block.to] : []), ...(block.items ?? []).flatMap((item) => (item.to ? [item.to] : []))]\n\n/**\n * Every ledger ref an answer places, as often as it places it: each `keep`,\n * each picture on an item, and what a group kept whole holds (AGL-4152).\n */\nexport function aiSiteImportImprovedPlaced(sections: readonly AiSiteImportImprovedSection[], ledger: Pick<SiteImportLedger, 'items'>): string[] {\n const holds = new Map(ledger.items.map((item) => [item.ref, item.holds ?? []]))\n return sections.flatMap((section) =>\n section.blocks.flatMap((block) => (block.kind === 'keep' ? [block.ref, ...(holds.get(block.ref) ?? [])] : (block.items ?? []).flatMap((item) => (item.ref ? [item.ref] : [])))),\n )\n}\n\nconst invented = (message: string, detail?: string): AiDoctrineViolation => ({ rule: 14, code: AI_SITE_IMPORT_INVENTED_FACT_CODE, message, ...(detail ? { detail } : {}) })\nconst dropped = (message: string): AiDoctrineViolation => ({ rule: null, code: AI_SITE_IMPORT_DROPPED_ITEM_CODE, message })\n\n/**\n * An answer held to what the import read, and to its ledger (AGL-4152). No\n * violation is a redesign that may be built; each one names its line.\n */\nexport function aiSiteImportHonesty(sections: readonly AiSiteImportImprovedSection[], input: AiSiteImportHonestyScope): AiDoctrineViolation[] {\n const held = aiSiteImportHonestyFacts(input.scope)\n const contacts = input.scope.join(' \\n ')\n const out: AiDoctrineViolation[] = []\n const refs = new Map(input.ledger.items.map((item) => [item.ref, item]))\n const placed = aiSiteImportImprovedPlaced(sections, input.ledger)\n const links = new Set<string>()\n sections.forEach((section, index) => {\n section.blocks.forEach((raw, position) => {\n if (raw.kind === 'keep') return\n const block = raw\n const at = `section ${index + 1}, block ${position + 1}`\n for (const line of writtenLines(block, at)) {\n const reason = aiSiteImportInventedIn(line.text, held)\n if (reason) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": ${reason}`))\n else if (aiLayoutGuardContacts(line.text, contacts) !== line.text) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it gives a phone number or email the site does not.`))\n else if (/\\[[^\\]]*\\]/.test(line.text) || aiPlaceholderTokens(line.text).length || detectOffVoiceCopy([{ at: 'line', text: line.text }], input.framing ?? null).length) {\n out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it holds filler, a placeholder or a word that calls the work simple or cheap. Write real words.`))\n }\n }\n for (const to of linksOf(block)) {\n if (input.destinations.has(to)) links.add(input.destinations.get(to) as string)\n else out.push(invented(`${at}: it links to \"${to.slice(0, 80)}\", which is not a page of this site, form, phone, email, a section as #n, or an address the source links.`))\n }\n })\n })\n // What the ledger holds: each thing that must land, once; no ref twice, and none it does not hold.\n const inGroup = new Map(input.ledger.items.flatMap((item) => (item.holds ?? []).map((held) => [held, item.ref] as const)))\n for (const ref of new Set(placed)) {\n if (!refs.has(ref)) out.push(dropped(`keep \"${ref.slice(0, 40)}\" names nothing on this page. Use only the refs the page lists.`))\n else if (placed.filter((entry) => entry === ref).length > 1) {\n const group = inGroup.get(ref)\n out.push(dropped(`${ref} is placed ${placed.filter((entry) => entry === ref).length} times${group && placed.includes(group) ? `: keeping ${group} whole places it already` : ''}. Place it once.`))\n }\n }\n for (const item of input.ledger.items) {\n if (item.must && !placed.includes(item.ref)) out.push(dropped(`${item.ref} is not on the page. Place it with a keep block, exactly once${item.folded ? ': this page is long, so its groups are kept whole' : ''}.`))\n }\n // The page's own opening picture outranks a new one: a picture asked for in words never takes its place.\n const opening = input.ledger.items.find((item) => item.kind === 'picture' && item.section === 0)\n const first = sections[0]?.blocks ?? []\n if (opening && first.some((block) => block.kind === 'image' && !block.picture) && !first.some((block) => block.kind === 'keep' && block.ref === opening.ref)) {\n out.push(dropped(`${opening.ref} is the page's own opening picture. Open with it, with a keep block, in place of a picture asked for in words.`))\n }\n const kept = new Set(placed)\n const keptLines = new Set(input.ledger.items.filter((item) => kept.has(item.ref)).flatMap((item) => item.lines))\n for (const link of input.ledger.links) {\n const to = input.destinations.get(link.ref)\n if (!to || links.has(to) || keptLines.has(link.line)) continue\n out.push(dropped(`${link.ref} (\"${link.text.slice(0, 60)}\") goes nowhere on the page. Link to it from a button or an item.`))\n }\n return out\n}\n"],"names":["aiLayoutGuardContacts","siteImportFactScope","siteImportFactTokens","detectOffVoiceCopy","aiPlaceholderTokens","AI_SITE_IMPORT_INVENTED_FACT_CODE","AI_SITE_IMPORT_DROPPED_ITEM_CODE","NO_NAMES","Set","CLAIMS","COUNTS","QUOTED","aiSiteImportHonestyFacts","scope","facts","tokens","flatMap","text","said","join","shown","token","replace","aiSiteImportInventedIn","held","invented","filter","has","startsWith","slice","length","map","claim","pattern","test","found","exec","RegExp","trim","includes","writtenLines","block","at","out","kind","push","items","forEach","item","index","title","linksOf","to","aiSiteImportImprovedPlaced","sections","ledger","holds","Map","ref","section","blocks","get","message","detail","rule","code","dropped","aiSiteImportHonesty","input","contacts","refs","placed","links","raw","position","line","reason","framing","destinations","add","inGroup","entry","group","must","folded","opening","find","first","some","picture","kept","keptLines","lines","link"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;2CAe2C,GAE3C,SAASA,qBAAqB,QAAQ,uCAAmC;AAEzE,SAASC,mBAAmB,EAAEC,oBAAoB,QAAkC,sCAAkC;AAEtH,SAASC,kBAAkB,QAAsD,uCAAmC;AACpH,SAASC,mBAAmB,QAAQ,sCAAkC;AAEtE,OAAO,MAAMC,oCAAoC,wBAAuB;AACxE,OAAO,MA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IAC9G,KAAK,MAAMC,QAAQzB,MAAMb,MAAM,CAACiB,KAAK,CAAE;QACrC,MAAMpB,KAAKgB,MAAMU,YAAY,CAACjB,GAAG,CAACgC,KAAKnC,GAAG;QAC1C,IAAI,CAACN,MAAMoB,MAAM7C,GAAG,CAACyB,OAAOuC,UAAUhE,GAAG,CAACkE,KAAKlB,IAAI,GAAG;QACtDhC,IAAIE,IAAI,CAACqB,QAAQ,GAAG2B,KAAKnC,GAAG,CAAC,GAAG,EAAEmC,KAAK5E,IAAI,CAACY,KAAK,CAAC,GAAG,IAAI,iEAAiE,CAAC;IAC7H;IACA,OAAOc;AACT"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-site-import-honesty.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\n/*==========================================\n * NEW COPY MAY SAY WHAT THE SOURCE SUPPORTS, AND NOTHING IT DOES NOT (AGL-4152).\n *\n * A redesign may describe what the source says and what this kind of business\n * generally does. It may not make up a name, number, price, date, testimonial,\n * client, award, credential, address or guarantee, and it may not lose what\n * the ledger holds. This is the gate, pure, one answer at a time:\n *\n * - `improve-invented-fact`: a word of its copy says a fact, a name, a\n * credential or a guarantee outside what the import read, or a link goes\n * somewhere the source does not.\n * - `improve-dropped-item`: something the ledger holds is not on the page, or\n * is on it twice.\n *\n * Each names the line, so the one re-ask can mend that line.\n *=========================================*/\n\nimport { aiLayoutGuardContacts } from '../layout-language/ai-layout-copy'\nimport type { AiLayoutBlock, AiLayoutItem } from '../layout-language/ai-layout-language'\nimport { siteImportFactScope, siteImportFactTokens, type SiteImportFactScope } from '../model/ai-site-import-fidelity'\nimport type { SiteImportLedger } from '../model/ai-site-import-ledger'\nimport { detectOffVoiceCopy, type AiCopyFraming, type AiDoctrineViolation } from '../runtime/ai-doctrine-validators'\nimport { aiPlaceholderTokens } from '../runtime/ai-placeholder-tokens'\n\nexport const AI_SITE_IMPORT_INVENTED_FACT_CODE = 'improve-invented-fact'\nexport const AI_SITE_IMPORT_DROPPED_ITEM_CODE = 'improve-dropped-item'\n\n/** A block a redesign answered: the layout language, or a `keep` of a ledger ref. */\nexport type AiSiteImportImprovedBlock = AiLayoutBlock | { kind: 'keep'; ref: string; col?: number }\n\n/** A section a redesign answered. */\nexport interface AiSiteImportImprovedSection {\n band?: 'plain' | 'soft' | 'brand' | 'dark'\n cols?: number[]\n align?: 'start' | 'center'\n blocks: AiSiteImportImprovedBlock[]\n}\n\n/** What a redesign's copy is held against. */\nexport interface AiSiteImportHonestyScope {\n ledger: SiteImportLedger\n /** Every line the import read: this page's, the wave's other pages', and what the home page says of the site. */\n scope: readonly string[]\n /** Where a link may go, as an answer writes it, and the ledger's links' own destinations. */\n destinations: ReadonlyMap<string, string>\n framing?: AiCopyFraming | null\n /** Words the platform's own request put to the answer, no one's name or fact (`siteImportFactScope`). */\n vocabulary?: readonly string[]\n /** This page's own `page:<id>`, where it has one: a link the source makes to the page it is on asks nothing of the answer. */\n own?: string | null\n}\n\n/** Words past a sentence's first that are no one's name, in any heading: the short form of a question list. */\nconst NO_NAMES = new Set(['FAQ', 'FAQs', 'I'])\n\n/**\n * Credentials and guarantees: outside what the source says, each is a claim\n * only its owner can make, however a sentence puts it.\n */\nconst CLAIMS: ReadonlyArray<readonly [string, RegExp]> = [\n ['licensed', /\\blicen[sc]ed\\b/i],\n ['certified', /\\b(?:board-)?certified\\b/i],\n ['accredited', /\\baccredited\\b/i],\n ['insured', /\\binsured\\b/i],\n ['bonded', /\\bbonded\\b/i],\n ['award', /\\baward(?:s|-winning)?\\b/i],\n ['guarantee', /\\bguarantee[ds]?\\b/i],\n ['warranty', /\\bwarrant(?:y|ies)\\b/i],\n ['money-back', /\\bmoney[- ]back\\b/i],\n ['top-rated', /\\btop[- ]rated\\b/i],\n ['five-star', /\\b(?:5|five)[- ]star\\b/i],\n ['voted', /\\bvoted\\b/i],\n ['featured in', /\\bfeatured in\\b/i],\n ['trusted by', /\\btrusted by\\b/i],\n]\n\n/** A count no digit says: \"hundreds of clients\", \"two decades\", \"ten years\". */\nconst COUNTS = [\n /\\b(?:hundreds|thousands|millions|dozens|decades?|centur(?:y|ies))\\b/i,\n /\\b(?:two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|fifteen|twenty|thirty|forty|fifty)\\s+(?:years?|clients?|customers?|families|projects?|homes?|offices?|locations?|reviews?|stars?)\\b/i,\n]\n\n/** A word that opens a line in quotation marks and runs on: a testimonial, whoever is made to say it. */\nconst QUOTED = /^[\"“”'‘][^\"“”]{15,}[\"“”]/\n\n/** Whether text is in the source's own words: its fact tokens, and whatever a scope says of it. */\nexport interface AiSiteImportHonestyFacts {\n facts: SiteImportFactScope\n tokens: ReadonlySet<string>\n /** The source's words, as one text, for what a claim is checked against. */\n said: string\n}\n\n/** What every line of an answer is checked against; `vocabulary` is said, and names and claims nothing. */\nexport function aiSiteImportHonestyFacts(scope: readonly string[], vocabulary: readonly string[] = []): AiSiteImportHonestyFacts {\n const facts = siteImportFactScope(scope, vocabulary)\n return { facts, tokens: new Set(scope.flatMap((text) => siteImportFactTokens(text, facts, false))), said: scope.join(' \\n ') }\n}\n\nconst shown = (token: string) => `\"${token.replace(/^[a-z]+:/, '')}\"`\n\n/** What one line of new copy says that the source does not: a reason in words, or `null`. */\nexport function aiSiteImportInventedIn(text: string, held: AiSiteImportHonestyFacts): string | null {\n const invented = siteImportFactTokens(text, held.facts, true).filter((token) => !held.tokens.has(token) && !(token.startsWith('name:') && NO_NAMES.has(token.slice(5))))\n if (invented.length) return `it says ${[...new Set(invented)].map(shown).join(', ')}, which nothing the site says supports. Say only names and figures the site gives; a heading is in sentence case, so a capital reads as a name.`\n for (const [claim, pattern] of CLAIMS) {\n if (pattern.test(text) && !pattern.test(held.said)) return `it claims ${shown(claim)}, which the site does not. Leave credentials, awards and guarantees to the owner.`\n }\n for (const pattern of COUNTS) {\n const found = pattern.exec(text)?.[0]\n if (found && !new RegExp(`\\\\b${found.replace(/\\s+/g, '\\\\s+')}\\\\b`, 'i').test(held.said)) return `it says ${shown(found)}, a count the site does not give.`\n }\n if (QUOTED.test(text.trim()) && !held.said.includes(text.trim().slice(1, 20))) return 'it reads as a testimonial the site does not have. Quote a customer only by keeping their quote.'\n return null\n}\n\n/** Each written line of a block, as its place on the page names it. */\nfunction writtenLines(block: AiLayoutBlock, at: string): Array<{ at: string; text: string }> {\n const out: Array<{ at: string; text: string }> = []\n if (block.text && block.kind !== 'image') out.push({ at, text: block.text })\n ;(block.items ?? []).forEach((item: AiLayoutItem, index) => {\n if (item.title.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.title })\n if (item.text.trim()) out.push({ at: `${at}, item ${index + 1}`, text: item.text })\n })\n return out\n}\n\n/** Where a block sends a visitor, its own and its items'. */\nconst linksOf = (block: AiLayoutBlock): string[] => [...(block.to ? [block.to] : []), ...(block.items ?? []).flatMap((item) => (item.to ? [item.to] : []))]\n\n/**\n * Every ledger ref an answer places, as often as it places it: each `keep`,\n * each picture on an item, and what a group kept whole holds (AGL-4152).\n */\nexport function aiSiteImportImprovedPlaced(sections: readonly AiSiteImportImprovedSection[], ledger: Pick<SiteImportLedger, 'items'>): string[] {\n const holds = new Map(ledger.items.map((item) => [item.ref, item.holds ?? []]))\n return sections.flatMap((section) =>\n section.blocks.flatMap((block) => (block.kind === 'keep' ? [block.ref, ...(holds.get(block.ref) ?? [])] : (block.items ?? []).flatMap((item) => (item.ref ? [item.ref] : [])))),\n )\n}\n\nconst invented = (message: string, detail?: string): AiDoctrineViolation => ({ rule: 14, code: AI_SITE_IMPORT_INVENTED_FACT_CODE, message, ...(detail ? { detail } : {}) })\nconst dropped = (message: string): AiDoctrineViolation => ({ rule: null, code: AI_SITE_IMPORT_DROPPED_ITEM_CODE, message })\n\n/**\n * An answer held to what the import read, and to its ledger (AGL-4152). No\n * violation is a redesign that may be built; each one names its line.\n */\nexport function aiSiteImportHonesty(sections: readonly AiSiteImportImprovedSection[], input: AiSiteImportHonestyScope): AiDoctrineViolation[] {\n const held = aiSiteImportHonestyFacts(input.scope, input.vocabulary ?? [])\n const contacts = input.scope.join(' \\n ')\n const out: AiDoctrineViolation[] = []\n const refs = new Map(input.ledger.items.map((item) => [item.ref, item]))\n const placed = aiSiteImportImprovedPlaced(sections, input.ledger)\n const links = new Set<string>()\n sections.forEach((section, index) => {\n section.blocks.forEach((raw, position) => {\n if (raw.kind === 'keep') return\n const block = raw\n const at = `section ${index + 1}, block ${position + 1}`\n for (const line of writtenLines(block, at)) {\n const reason = aiSiteImportInventedIn(line.text, held)\n if (reason) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": ${reason}`))\n else if (aiLayoutGuardContacts(line.text, contacts) !== line.text) out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it gives a phone number or email the site does not.`))\n else if (/\\[[^\\]]*\\]/.test(line.text) || aiPlaceholderTokens(line.text).length || detectOffVoiceCopy([{ at: 'line', text: line.text }], input.framing ?? null).length) {\n out.push(invented(`${line.at}, \"${line.text.slice(0, 80)}\": it holds filler, a placeholder or a word that calls the work simple or cheap. Write real words.`))\n }\n }\n for (const to of linksOf(block)) {\n if (input.destinations.has(to)) links.add(input.destinations.get(to) as string)\n else out.push(invented(`${at}: it links to \"${to.slice(0, 80)}\", which is not a page of this site, form, phone, email, a section as #n, or an address the source links.`))\n }\n })\n })\n // What the ledger holds: each thing that must land, once; no ref twice, and none it does not hold.\n const inGroup = new Map(input.ledger.items.flatMap((item) => (item.holds ?? []).map((held) => [held, item.ref] as const)))\n for (const ref of new Set(placed)) {\n if (!refs.has(ref)) out.push(dropped(`keep \"${ref.slice(0, 40)}\" names nothing on this page. Use only the refs the page lists.`))\n else if (placed.filter((entry) => entry === ref).length > 1) {\n const group = inGroup.get(ref)\n out.push(dropped(`${ref} is placed ${placed.filter((entry) => entry === ref).length} times${group && placed.includes(group) ? `: keeping ${group} whole places it already` : ''}. Place it once.`))\n }\n }\n for (const item of input.ledger.items) {\n if (item.must && !placed.includes(item.ref)) out.push(dropped(`${item.ref} is not on the page. Place it with a keep block, exactly once${item.folded ? ': this page is long, so its groups are kept whole' : ''}.`))\n }\n // The page's own opening picture outranks a new one: a picture asked for in words never takes its place.\n const opening = input.ledger.items.find((item) => item.kind === 'picture' && item.section === 0)\n const first = sections[0]?.blocks ?? []\n if (opening && first.some((block) => block.kind === 'image' && !block.picture) && !first.some((block) => block.kind === 'keep' && block.ref === opening.ref)) {\n out.push(dropped(`${opening.ref} is the page's own opening picture. Open with it, with a keep block, in place of a picture asked for in words.`))\n }\n const kept = new Set(placed)\n const keptLines = new Set(input.ledger.items.filter((item) => kept.has(item.ref)).flatMap((item) => item.lines))\n for (const link of input.ledger.links) {\n const to = input.destinations.get(link.ref)\n if (!to || to === input.own || links.has(to) || keptLines.has(link.line)) continue\n out.push(dropped(`${link.ref} (\"${link.text.slice(0, 60)}\") goes nowhere on the page. Link to it from a button or an item.`))\n }\n return out\n}\n"],"names":["aiLayoutGuardContacts","siteImportFactScope","siteImportFactTokens","detectOffVoiceCopy","aiPlaceholderTokens","AI_SITE_IMPORT_INVENTED_FACT_CODE","AI_SITE_IMPORT_DROPPED_ITEM_CODE","NO_NAMES","Set","CLAIMS","COUNTS","QUOTED","aiSiteImportHonestyFacts","scope","vocabulary","facts","tokens","flatMap","text","said","join","shown","token","replace","aiSiteImportInventedIn","held","invented","filter","has","startsWith","slice","length","map","claim","pattern","test","found","exec","RegExp","trim","includes","writtenLines","block","at","out","kind","push","items","forEach","item","index","title","linksOf","to","aiSiteImportImprovedPlaced","sections","ledger","holds","Map","ref","section","blocks","get","message","detail","rule","code","dropped","aiSiteImportHonesty","input","contacts","refs","placed","links","raw","position","line","reason","framing","destinations","add","inGroup","entry","group","must","folded","opening","find","first","some","picture","kept","keptLines","lines","link","own"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;2CAe2C,GAE3C,SAASA,qBAAqB,QAAQ,uCAAmC;AAEzE,SAASC,mBAAmB,EAAEC,oBAAoB,QAAkC,sCAAkC;AAEtH,SAASC,kBAAkB,QAAsD,uCAAmC;AACpH,SAASC,mBAAmB,QAAQ,sCAAkC;AAEtE,OAAO,MAAMC,oCAAoC,wBAAuB;AACxE,OAAO,MAAMC,mCAAmC,uBAAsB;AA2BtE,6GAA6G,GAC7G,MAAMC,WAAW,IAAIC,IAAI;IAAC;IAAO;IAAQ;CAAI;AAE7C;;;CAGC,GACD,MAAMC,SAAmD;IACvD;QAAC;QAAY;KAAmB;IAChC;QAAC;QAAa;KAA4B;IAC1C;QAAC;QAAc;KAAkB;IACjC;QAAC;QAAW;KAAe;IAC3B;QAAC;QAAU;KAAc;IACzB;QAAC;QAAS;KAA4B;IACtC;QAAC;QAAa;KAAsB;IACpC;QAAC;QAAY;KAAwB;IACrC;QAAC;QAAc;KAAqB;IACpC;QAAC;QAAa;KAAoB;IAClC;QAAC;QAAa;KAA0B;IACxC;QAAC;QAAS;KAAa;IACvB;QAAC;QAAe;KAAmB;IACnC;QAAC;QAAc;KAAkB;CAClC;AAED,8EAA8E,GAC9E,MAAMC,SAAS;IACb;IACA;CACD;AAED,uGAAuG,GACvG,MAAMC,SAAS;AAUf,yGAAyG,GACzG,OAAO,SAASC,yBAAyBC,KAAwB,EAAEC,aAAgC,EAAE;IACnG,MAAMC,QAAQd,oBAAoBY,OAAOC;IACzC,OAAO;QAAEC;QAAOC,QAAQ,IAAIR,IAAIK,MAAMI,OAAO,CAAC,CAACC,OAAShB,qBAAqBgB,MAAMH,OAAO;QAAUI,MAAMN,MAAMO,IAAI,CAAC;IAAQ;AAC/H;AAE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AC,CAAC/C,QAAUA,MAAMG,IAAI,KAAK,WAAW,CAACH,MAAMgD,OAAO,KAAK,CAACF,MAAMC,IAAI,CAAC,CAAC/C,QAAUA,MAAMG,IAAI,KAAK,UAAUH,MAAMiB,GAAG,KAAK2B,QAAQ3B,GAAG,GAAG;QAC5Jf,IAAIE,IAAI,CAACqB,QAAQ,GAAGmB,QAAQ3B,GAAG,CAAC,8GAA8G,CAAC;IACjJ;IACA,MAAMgC,OAAO,IAAInF,IAAIgE;IACrB,MAAMoB,YAAY,IAAIpF,IAAI6D,MAAMb,MAAM,CAACT,KAAK,CAACpB,MAAM,CAAC,CAACsB,OAAS0C,KAAK/D,GAAG,CAACqB,KAAKU,GAAG,GAAG1C,OAAO,CAAC,CAACgC,OAASA,KAAK4C,KAAK;IAC9G,KAAK,MAAMC,QAAQzB,MAAMb,MAAM,CAACiB,KAAK,CAAE;QACrC,MAAMpB,KAAKgB,MAAMU,YAAY,CAACjB,GAAG,CAACgC,KAAKnC,GAAG;QAC1C,IAAI,CAACN,MAAMA,OAAOgB,MAAM0B,GAAG,IAAItB,MAAM7C,GAAG,CAACyB,OAAOuC,UAAUhE,GAAG,CAACkE,KAAKlB,IAAI,GAAG;QAC1EhC,IAAIE,IAAI,CAACqB,QAAQ,GAAG2B,KAAKnC,GAAG,CAAC,GAAG,EAAEmC,KAAK5E,IAAI,CAACY,KAAK,CAAC,GAAG,IAAI,iEAAiE,CAAC;IAC7H;IACA,OAAOc;AACT"}
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import type { AiLayoutDesign } from '../layout-language/ai-layout-design';
18
- import { type AiLayoutImportHero, type AiLayoutItem, type AiLayoutSettlement } from '../layout-language/ai-layout-language';
18
+ import { type AiLayoutImportHero, type AiLayoutItem, type AiLayoutSection, type AiLayoutSettlement } from '../layout-language/ai-layout-language';
19
19
  import type { AiSiteImportAddedSection, AiSiteImportPagePictures, AiSiteImportPageRole, AiSiteImportPlan } from '../model/ai-site-import';
20
20
  import { type SiteImportFidelityTheme, type SiteImportPageFidelity } from '../model/ai-site-import-fidelity';
21
21
  import { type SiteImportLedger, type SiteImportLedgerLine } from '../model/ai-site-import-ledger';
@@ -70,6 +70,12 @@ export declare function aiSiteImportImproveDestinations(doc: AiSiteImportDocumen
70
70
  sections?: number;
71
71
  formSection?: number | null;
72
72
  }): Map<string, string>;
73
+ /**
74
+ * The page's own `page:<id>` on the new site (AGL-4152), by its address: a
75
+ * link to it from itself goes nowhere a visitor is not already. `null` where
76
+ * the import plans it under no id, as the home page.
77
+ */
78
+ export declare function aiSiteImportOwnPage(doc: Pick<AiSiteImportDocument, 'url' | 'links'>): string | null;
73
79
  /** A redesign's user turn: the page, its kind of site, how its opening is drawn, and its ledger, fenced as the owner's data. */
74
80
  export declare function aiSiteImportImprovePrompt(input: {
75
81
  screen: {
@@ -91,6 +97,16 @@ export declare function aiSiteImportImprovePrompt(input: {
91
97
  * to a page of photos only stands between a visitor and them.
92
98
  */
93
99
  export declare const AI_SITE_IMPORT_NEW_SECTIONS: Readonly<Record<AiSiteImportPageRole, number>>;
100
+ /**
101
+ * The share of the old page's words a redesign keeps, by role (AGL-4152),
102
+ * where it is not `SITE_IMPORT_IMPROVED_MEANING`. A contact page is asked for
103
+ * a short, welcoming opening over its form: what it must keep is its form,
104
+ * its contact lines and its facts, each held whole on their own lines, and its
105
+ * intent, so its prose is held only at the floor a rewritten line is.
106
+ */
107
+ export declare const AI_SITE_IMPORT_ROLE_MEANING: Readonly<Partial<Record<AiSiteImportPageRole, number>>>;
108
+ /** The share of its old words a page of a role keeps. */
109
+ export declare function aiSiteImportMeaningShare(role: AiSiteImportPageRole): number;
94
110
  /** The fewest content words an old section says for a new one to be its rework (AGL-4152): fewer is a label, which any section may echo. */
95
111
  export declare const AI_SITE_IMPORT_REWORK_LEAST_WORDS = 4;
96
112
  /** The most sections a redesigned page runs to: a page the source already fills has no room for more. */
@@ -152,6 +168,15 @@ export declare function aiSiteImportImproveHero(design: AiLayoutDesign, plan?: A
152
168
  } | null): AiLayoutImportHero;
153
169
  /** How many of a group's items sit across: planned for how much each says. */
154
170
  export declare function aiSiteImportImproveColumns(items: readonly AiLayoutItem[]): number;
171
+ /**
172
+ * The height a source's picture is cropped to where a redesign places it on
173
+ * its own, in px (AGL-4152): wide across the page, closer in a column. A
174
+ * height, not a shape: the Image takes it as its own height field, so a page
175
+ * of pictures kept one by one repeats one style key on each (its rounding),
176
+ * never two, which rule 16 refuses as a repeated inline style. Pictures side
177
+ * by side in a row are cropped alike, whatever shapes they came in.
178
+ */
179
+ export declare const AI_SITE_IMPORT_IMPROVE_FRAME_PX: Readonly<Record<'wide' | 'column', number>>;
155
180
  export interface AiSiteImportImproveCompileInput {
156
181
  doc: AiSiteImportDocument;
157
182
  ledger: SiteImportLedger;
@@ -180,8 +205,38 @@ export interface AiSiteImportImprovedPage {
180
205
  added: AiSiteImportAddedSection[];
181
206
  pictures: AiSiteImportPagePictures;
182
207
  }
208
+ /**
209
+ * The opening of a redesign without a brand's mark for its photo (AGL-4152):
210
+ * a picture the source names a logo, a badge or an icon (`aiSiteImportIsBrandMark`)
211
+ * that the answer keeps in its first section takes the page's widest photo no
212
+ * section placed instead, or, where it has none, is left out, and a row it
213
+ * leaves a column empty in is drawn as one column. A client's logo the source
214
+ * showed beside its words read, as a cover, as the page's own work.
215
+ */
216
+ export declare function aiSiteImportOpeningPhoto(answer: readonly AiSiteImportImprovedSection[], input: {
217
+ doc: Pick<AiSiteImportDocument, 'blocks' | 'photos'>;
218
+ ledger: Pick<SiteImportLedger, 'items'>;
219
+ }): AiSiteImportImprovedSection[];
220
+ /**
221
+ * A redesigned section's calls to action, each once and each where it belongs
222
+ * (AGL-4152), whatever the answer and the source's kept groups gave:
223
+ *
224
+ * - Buttons placed in a row's columns under a group that runs the row's width,
225
+ * with nothing else in those columns, sit in the cards they go to where each
226
+ * goes where exactly one card does, else together under the group: a row of
227
+ * two buttons under three cards read as a grid half filled.
228
+ * - A link with the same words to the same place on every item of a group
229
+ * (each review's "See more reviews") is shown once, as a button after the
230
+ * group, unless the section already has that button. Where only some items
231
+ * carry it, each is that item's own action and stays.
232
+ * - The same button twice in a section is shown once, the first.
233
+ * - Two buttons side by side to the same place are one: the one with the
234
+ * header's words where one has them, else the first. Of buttons side by
235
+ * side, only the first is filled; the rest are outlined.
236
+ */
237
+ export declare function aiSiteImportSectionActions(section: Pick<AiLayoutSection, 'cols' | 'blocks'>, cta?: string | null): Pick<AiLayoutSection, 'cols' | 'blocks'>;
183
238
  /** The sections a redesign holds, in the compiler's language: every `keep` expanded to the source's own blocks, every link resolved. */
184
- export declare function aiSiteImportImprovedPage(answer: readonly AiSiteImportImprovedSection[], input: AiSiteImportImproveCompileInput): AiSiteImportImprovedPage;
239
+ export declare function aiSiteImportImprovedPage(given: readonly AiSiteImportImprovedSection[], input: AiSiteImportImproveCompileInput): AiSiteImportImprovedPage;
185
240
  /** The most an answer may ask for, whatever the page and the model: a whole page's design and words, with its thinking. */
186
241
  export declare const AI_SITE_IMPORT_IMPROVE_MOST_TOKENS = 8000;
187
242
  /**
@@ -247,10 +302,42 @@ export interface AiSiteImportImproved<T> {
247
302
  * meaning, contrast, a phone's width) stays a fallback.
248
303
  */
249
304
  export declare const AI_SITE_IMPORT_IMPROVE_SOFT_CODES: ReadonlySet<string>;
305
+ /** The most reasons a page's record keeps of why its redesign missed (AGL-4152). */
306
+ export declare const AI_SITE_IMPORT_REDESIGN_WHY_MOST = 8;
307
+ /** The most characters one reason keeps: the line it names and what it says of it. */
308
+ export declare const AI_SITE_IMPORT_REDESIGN_WHY_CHARS = 300;
309
+ /**
310
+ * Why a redesign missed, line by line (AGL-4152): each violation's code, its
311
+ * message (which names the line it found, `section 1, block 2, "…"`) and its
312
+ * detail, cut short, at most `AI_SITE_IMPORT_REDESIGN_WHY_MOST`. What the
313
+ * page's log and its record say, so a miss can be read after the job, when
314
+ * the answer itself is gone. For the job's record, never the owner's row.
315
+ */
316
+ export declare function aiSiteImportRedesignWhy(violations: readonly AiDoctrineViolation[]): string[];
250
317
  /** Whether every miss of an answer is one it may be taken with past its last re-ask. */
251
318
  export declare function aiSiteImportImproveOnlySoft(violations: readonly AiDoctrineViolation[]): boolean;
252
- /** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its name. */
253
- export declare function aiSiteImportImproveScope(doc: Pick<AiSiteImportDocument, 'blocks' | 'siteLines' | 'scope' | 'title'>, siteName: string | null): string[];
319
+ /**
320
+ * The words of a site's plan (AGL-4152): what it says the site is and who it
321
+ * is for, its menu's and footer's labels, its call to action and its proposed
322
+ * page. A redesign is told the plan as its digest, and the plan's own words
323
+ * were held to what the site says when it was made, so a redesign that
324
+ * repeats them invents nothing.
325
+ */
326
+ export declare function aiSiteImportPlanLines(plan: AiSiteImportPlan | null | undefined): string[];
327
+ /**
328
+ * The ways a site's name is said (AGL-4152), where it is written as one run
329
+ * of letters: a web address ("RidgelineBuilders.com") or a name run together.
330
+ * Its address part dropped, its capitals and digits split ("Ridgeline
331
+ * Builders"), a run of capitals on its own ("ABC" of "ABCroofing"), and a run
332
+ * of small letters split into the words the site says elsewhere ("roofing
333
+ * site" of "roofingsite"). A redesign that names the business as a visitor
334
+ * would invents nothing.
335
+ */
336
+ export declare function aiSiteImportNameVariants(name: string, said: ReadonlySet<string>): string[];
337
+ /** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its plan, its name. */
338
+ export declare function aiSiteImportImproveScope(doc: Pick<AiSiteImportDocument, 'blocks' | 'siteLines' | 'scope' | 'title'> & {
339
+ plan?: AiSiteImportPlan | null;
340
+ }, siteName: string | null): string[];
254
341
  /** A scored redesign's misses, each as the re-ask names it: what is red on its ledger and its design lines. */
255
342
  export declare function aiSiteImportImprovedMisses(report: Pick<SiteImportPageFidelity, 'improved'>): AiDoctrineViolation[];
256
343
  /** A redesign's read for a page: its ledger, and everywhere a link may go. */
@@ -272,6 +359,8 @@ export declare function aiSiteImportImproveCheck<T>(input: {
272
359
  theme?: SiteImportFidelityTheme | null;
273
360
  /** What the page is for and the new sections it needs; absent, nothing is asked of its plan. */
274
361
  needs?: AiSiteImportImproveNeeds | null;
362
+ /** Words the platform's own request put to the answer (its role's lines), no one's name or fact. */
363
+ vocabulary?: readonly string[];
275
364
  build: (page: AiSiteImportImprovedPage) => {
276
365
  value: T | null;
277
366
  violations: AiDoctrineViolation[];