@aglyn/plugins-ai 1.14.0 → 1.15.1

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 (131) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-build-page.component.js +5 -3
  3. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  4. package/src/lib/components/ai-site-import-finish.component.d.ts +3 -1
  5. package/src/lib/components/ai-site-import-finish.component.js +3 -3
  6. package/src/lib/components/ai-site-import-finish.component.js.map +1 -1
  7. package/src/lib/components/ai-site-import-job.component.d.ts +4 -3
  8. package/src/lib/components/ai-site-import-job.component.js +141 -43
  9. package/src/lib/components/ai-site-import-job.component.js.map +1 -1
  10. package/src/lib/components/ai-site-import-plan.component.d.ts +42 -0
  11. package/src/lib/components/ai-site-import-plan.component.js +246 -0
  12. package/src/lib/components/ai-site-import-plan.component.js.map +1 -0
  13. package/src/lib/components/ai-site-import-start.component.d.ts +3 -1
  14. package/src/lib/components/ai-site-import-start.component.js +6 -3
  15. package/src/lib/components/ai-site-import-start.component.js.map +1 -1
  16. package/src/lib/components/ai-site-start-card.component.js +6 -2
  17. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  18. package/src/lib/components/ai-site-start-steps.component.d.ts +3 -2
  19. package/src/lib/components/ai-site-start-steps.component.js +12 -5
  20. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  21. package/src/lib/jobs/ai-job-import-step.d.ts +63 -2
  22. package/src/lib/jobs/ai-job-import-step.js +372 -22
  23. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  24. package/src/lib/jobs/ai-job-layout-language.js +4 -1
  25. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  26. package/src/lib/jobs/ai-job-page-language.d.ts +23 -2
  27. package/src/lib/jobs/ai-job-page-language.js +252 -5
  28. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  29. package/src/lib/jobs/ai-job-page-step.d.ts +7 -0
  30. package/src/lib/jobs/ai-job-page-step.js +75 -12
  31. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  32. package/src/lib/jobs/ai-job-plan-step.js +4 -2
  33. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  34. package/src/lib/jobs/ai-job-site-look.js +14 -5
  35. package/src/lib/jobs/ai-job-site-look.js.map +1 -1
  36. package/src/lib/jobs/ai-job-text-step.d.ts +11 -2
  37. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  38. package/src/lib/jobs/ai-jobs.js +2 -1
  39. package/src/lib/jobs/ai-jobs.js.map +1 -1
  40. package/src/lib/jobs/ai-site-import-compile.d.ts +43 -2
  41. package/src/lib/jobs/ai-site-import-compile.js +131 -63
  42. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  43. package/src/lib/jobs/ai-site-import-document.d.ts +25 -1
  44. package/src/lib/jobs/ai-site-import-document.js +26 -7
  45. package/src/lib/jobs/ai-site-import-document.js.map +1 -1
  46. package/src/lib/jobs/ai-site-import-honesty.d.ts +65 -0
  47. package/src/lib/jobs/ai-site-import-honesty.js +271 -0
  48. package/src/lib/jobs/ai-site-import-honesty.js.map +1 -0
  49. package/src/lib/jobs/ai-site-import-improve.d.ts +286 -0
  50. package/src/lib/jobs/ai-site-import-improve.js +1281 -0
  51. package/src/lib/jobs/ai-site-import-improve.js.map +1 -0
  52. package/src/lib/jobs/ai-site-import-look.d.ts +4 -0
  53. package/src/lib/jobs/ai-site-import-look.js +16 -6
  54. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  55. package/src/lib/jobs/ai-site-import-pictures.d.ts +83 -0
  56. package/src/lib/jobs/ai-site-import-pictures.js +261 -0
  57. package/src/lib/jobs/ai-site-import-pictures.js.map +1 -0
  58. package/src/lib/jobs/ai-site-import-plan.d.ts +78 -0
  59. package/src/lib/jobs/ai-site-import-plan.js +627 -0
  60. package/src/lib/jobs/ai-site-import-plan.js.map +1 -0
  61. package/src/lib/jobs/ai-site-import-wording.js +2 -5
  62. package/src/lib/jobs/ai-site-import-wording.js.map +1 -1
  63. package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -0
  64. package/src/lib/layout-language/ai-layout-compiler.js +10 -6
  65. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  66. package/src/lib/layout-language/ai-layout-design.d.ts +9 -0
  67. package/src/lib/layout-language/ai-layout-design.js +29 -3
  68. package/src/lib/layout-language/ai-layout-design.js.map +1 -1
  69. package/src/lib/layout-language/ai-layout-frame-source.d.ts +5 -0
  70. package/src/lib/layout-language/ai-layout-frame-source.js +4 -2
  71. package/src/lib/layout-language/ai-layout-frame-source.js.map +1 -1
  72. package/src/lib/layout-language/ai-layout-frame.d.ts +2 -0
  73. package/src/lib/layout-language/ai-layout-frame.js +20 -12
  74. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  75. package/src/lib/layout-language/ai-layout-language.d.ts +8 -0
  76. package/src/lib/layout-language/ai-layout-language.js +7 -3
  77. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  78. package/src/lib/model/ai-credit-estimate.d.ts +16 -0
  79. package/src/lib/model/ai-credit-estimate.js +14 -0
  80. package/src/lib/model/ai-credit-estimate.js.map +1 -1
  81. package/src/lib/model/ai-site-import-fidelity.d.ts +64 -0
  82. package/src/lib/model/ai-site-import-fidelity.js +380 -0
  83. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  84. package/src/lib/model/ai-site-import-ledger.d.ts +82 -0
  85. package/src/lib/model/ai-site-import-ledger.js +254 -0
  86. package/src/lib/model/ai-site-import-ledger.js.map +1 -0
  87. package/src/lib/model/ai-site-import-view.d.ts +113 -7
  88. package/src/lib/model/ai-site-import-view.js +174 -16
  89. package/src/lib/model/ai-site-import-view.js.map +1 -1
  90. package/src/lib/model/ai-site-import.d.ts +253 -3
  91. package/src/lib/model/ai-site-import.js +371 -25
  92. package/src/lib/model/ai-site-import.js.map +1 -1
  93. package/src/lib/model/ai-site-job.js +4 -0
  94. package/src/lib/model/ai-site-job.js.map +1 -1
  95. package/src/lib/model/ai-site-kinds.d.ts +2 -0
  96. package/src/lib/model/ai-site-kinds.js +7 -0
  97. package/src/lib/model/ai-site-kinds.js.map +1 -1
  98. package/src/lib/model/ai-site-look.d.ts +14 -5
  99. package/src/lib/model/ai-site-look.js +22 -16
  100. package/src/lib/model/ai-site-look.js.map +1 -1
  101. package/src/lib/model/ai-site-start.d.ts +37 -7
  102. package/src/lib/model/ai-site-start.js +54 -10
  103. package/src/lib/model/ai-site-start.js.map +1 -1
  104. package/src/lib/model/ai-site-starter-look.d.ts +69 -0
  105. package/src/lib/model/ai-site-starter-look.js +90 -0
  106. package/src/lib/model/ai-site-starter-look.js.map +1 -0
  107. package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -0
  108. package/src/lib/runtime/ai-doctrine-validators.js +3 -2
  109. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  110. package/src/lib/runtime/ai-doctrine.d.ts +10 -0
  111. package/src/lib/runtime/ai-doctrine.js +16 -2
  112. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  113. package/src/lib/server/ai-jobs-resume.js +12 -3
  114. package/src/lib/server/ai-jobs-resume.js.map +1 -1
  115. package/src/lib/server/ai-jobs-route.js +5 -1
  116. package/src/lib/server/ai-jobs-route.js.map +1 -1
  117. package/src/lib/server/ai-site-import-route.d.ts +6 -0
  118. package/src/lib/server/ai-site-import-route.js +8 -1
  119. package/src/lib/server/ai-site-import-route.js.map +1 -1
  120. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +46 -7
  121. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +260 -14
  122. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  123. package/src/lib/site-import/fixtures/site-import-improve-answers.d.ts +33 -0
  124. package/src/lib/site-import/fixtures/site-import-improve-answers.js +457 -0
  125. package/src/lib/site-import/fixtures/site-import-improve-answers.js.map +1 -0
  126. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +29 -0
  127. package/src/lib/site-import/fixtures/site-layout-recordings.js +26 -0
  128. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
  129. package/src/lib/site-import/site-import-flag.d.ts +17 -0
  130. package/src/lib/site-import/site-import-flag.js +15 -0
  131. package/src/lib/site-import/site-import-flag.js.map +1 -1
@@ -0,0 +1,286 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { AiLayoutDesign } from '../layout-language/ai-layout-design';
18
+ import { type AiLayoutImportHero, type AiLayoutItem, type AiLayoutSettlement } from '../layout-language/ai-layout-language';
19
+ import type { AiSiteImportAddedSection, AiSiteImportPagePictures, AiSiteImportPageRole, AiSiteImportPlan } from '../model/ai-site-import';
20
+ import { type SiteImportFidelityTheme, type SiteImportPageFidelity } from '../model/ai-site-import-fidelity';
21
+ import { type SiteImportLedger, type SiteImportLedgerLine } from '../model/ai-site-import-ledger';
22
+ import type { AiSystemBlock, AiTool, AiUsage } from '../providers/contract';
23
+ import type { AiGenerationCheck } from '../runtime/ai-doctrine';
24
+ import type { AiCopyFraming, AiDoctrineViolation } from '../runtime/ai-doctrine-validators';
25
+ import { type AiSiteImportImprovedBlock, type AiSiteImportImprovedSection } from './ai-site-import-honesty';
26
+ import { type AiSiteImportDesigned } from './ai-site-import-compile';
27
+ import { type AiSiteImportDocument } from './ai-site-import-document';
28
+ /** The answer's kind of generation: the name its re-ask and its doctrine scope go by. */
29
+ export declare const AI_SITE_IMPORT_IMPROVE_KIND = "page-improve";
30
+ /**
31
+ * The most items a redesign's group keeps (AGL-4152): every item its owner's
32
+ * page has, where the layout language's own pages stop at seven. A page
33
+ * brought in is compiled as its source lays it out, with no such limit.
34
+ */
35
+ export declare const AI_SITE_IMPORT_IMPROVE_MAX_ITEMS = 24;
36
+ /** What a block may be: the layout language's words and groups, and `keep`. A customer's quote and a figure only ever arrive by `keep`. */
37
+ export declare const AI_SITE_IMPORT_IMPROVE_BLOCK_KINDS: readonly ["eyebrow", "heading", "lede", "text", "note", "list", "button", "image", "cards", "steps", "faq", "keep"];
38
+ /** The redesign tool: the `submit_page` language, a `keep` block, and a picture on an item by its ref. */
39
+ export declare const AI_SITE_IMPORT_IMPROVE_TOOL: AiTool;
40
+ /** What a redesign is told, cached: every page of every site shares these bytes. */
41
+ export declare const AI_SITE_IMPORT_IMPROVE_TEXT: string;
42
+ /** The site's own digest, which every page of one import reads ahead of its ledger: cached once per site. */
43
+ export declare function aiSiteImportImproveDigest(input: {
44
+ siteName: string | null;
45
+ /** What the home page says of the site, and the pages of the import. */
46
+ scope: readonly string[];
47
+ plan?: AiSiteImportPlan | null;
48
+ }): string;
49
+ /** The most of a site's own words the digest holds. */
50
+ export declare const AI_SITE_IMPORT_IMPROVE_DIGEST_CHARS = 16000;
51
+ /** A redesign's system blocks: the platform's text cached across sites, then this site's digest, cached once per site. The ledger rides the user turn. */
52
+ export declare function aiSiteImportImproveInstructions(digest: string): readonly AiSystemBlock[];
53
+ /** The most characters a page's ledger shows. */
54
+ export declare const AI_SITE_IMPORT_LEDGER_MAX_CHARS = 16000;
55
+ /**
56
+ * The lines each picture of a page stands with (AGL-4152): the words after it
57
+ * in its section, up to the next picture, as a row of pictured services or a
58
+ * photo over its caption lays them out. What the ledger tells a redesign a
59
+ * picture goes with, and what a card written of those words is given it by.
60
+ */
61
+ export declare function aiSiteImportPictureCaptions(ledger: Pick<SiteImportLedger, 'items' | 'lines'>): Map<string, SiteImportLedgerLine[]>;
62
+ /**
63
+ * A page's ledger as its answer reads it (AGL-4152): what it may place, where
64
+ * each link goes, and every line it rewrites, numbered. Uncached, per page, and
65
+ * fenced by the prompt: every word of it is the owner's.
66
+ */
67
+ export declare function aiSiteImportLedgerText(ledger: SiteImportLedger, doc: Pick<AiSiteImportDocument, 'blocks' | 'photos'>, destinations: ReadonlyMap<string, string>): string;
68
+ /** Everywhere a link may go on this page, as an answer writes it, each with the destination it means. */
69
+ export declare function aiSiteImportImproveDestinations(doc: AiSiteImportDocument, ledger: SiteImportLedger, input?: {
70
+ sections?: number;
71
+ formSection?: number | null;
72
+ }): Map<string, string>;
73
+ /** 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
+ export declare function aiSiteImportImprovePrompt(input: {
75
+ screen: {
76
+ title: string;
77
+ slug: string;
78
+ };
79
+ doc: Pick<AiSiteImportDocument, 'url' | 'blocks' | 'photos' | 'proposed'>;
80
+ ledger: SiteImportLedger;
81
+ destinations: ReadonlyMap<string, string>;
82
+ kindLines: readonly string[];
83
+ seed: string;
84
+ /** What the page is for and what it needs (`aiSiteImportImproveRoleLines`). */
85
+ roleLines?: readonly string[];
86
+ }): string;
87
+ /**
88
+ * How many new sections a page of each role is asked for (AGL-4152): a home
89
+ * or a main service page two, a contact page none, its form framed instead,
90
+ * and a gallery none: its pictures are what it is for, and a section added
91
+ * to a page of photos only stands between a visitor and them.
92
+ */
93
+ export declare const AI_SITE_IMPORT_NEW_SECTIONS: Readonly<Record<AiSiteImportPageRole, number>>;
94
+ /** 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
+ export declare const AI_SITE_IMPORT_REWORK_LEAST_WORDS = 4;
96
+ /** The most sections a redesigned page runs to: a page the source already fills has no room for more. */
97
+ export declare const AI_SITE_IMPORT_IMPROVE_MOST_SECTIONS = 10;
98
+ /** What a page is for, as its plan says, else from its address and what it holds. */
99
+ export declare function aiSiteImportPageRoleOf(doc: Pick<AiSiteImportDocument, 'role' | 'proposed' | 'url' | 'title' | 'blocks' | 'forms' | 'layout'>, slug: string): AiSiteImportPageRole;
100
+ /** How many new sections a page is asked for: its role's, where the page has room, and none on a long page, whose groups fold. */
101
+ export declare function aiSiteImportNewSectionsWanted(role: AiSiteImportPageRole, ledger: Pick<SiteImportLedger, 'folded' | 'lines' | 'items'>, proposed?: boolean): number;
102
+ /** The lines a redesign's request says of its page's role and what it needs (AGL-4152). */
103
+ export declare function aiSiteImportImproveRoleLines(input: {
104
+ role: AiSiteImportPageRole;
105
+ wanted: number;
106
+ folded: boolean;
107
+ kind?: string | null;
108
+ seed: number;
109
+ }): string[];
110
+ /**
111
+ * The sections a redesign added (AGL-4152), by index: neither the opening nor
112
+ * a closing band, holding nothing kept but a picture, saying something of
113
+ * its own, and the rework of no section of the old page. Each section of the
114
+ * old page past its opening is reworked by the one section that says most
115
+ * of it; another section drawing on its words, such as a why-us of the
116
+ * opening's facts, is new. An old section of a few words, a heading over a
117
+ * band or a label over a kept group, reworks nothing: any new section that
118
+ * happens to say its two or three words would otherwise read as its rework.
119
+ */
120
+ export declare function aiSiteImportImproveNewSections(answer: readonly AiSiteImportImprovedSection[], ledger: Pick<SiteImportLedger, 'lines' | 'items'>): number[];
121
+ /** What a redesign is asked to be, by its role (AGL-4152). */
122
+ export interface AiSiteImportImproveNeeds {
123
+ role: AiSiteImportPageRole;
124
+ /** New sections it needs (`aiSiteImportNewSectionsWanted`). */
125
+ wanted: number;
126
+ }
127
+ /** The fewest shapes a page of four sections or more is drawn in. */
128
+ export declare const AI_SITE_IMPORT_IMPROVE_LEAST_SHAPES = 3;
129
+ /**
130
+ * Whether a redesign is planned as a designer's page (AGL-4152), answer by
131
+ * answer: the new sections its role asks for, a picture in its opening, and
132
+ * sections drawn in more than one or two shapes. Each miss is named for the
133
+ * one re-ask.
134
+ */
135
+ export declare function aiSiteImportImprovePlanMisses(answer: readonly AiSiteImportImprovedSection[], input: {
136
+ ledger: Pick<SiteImportLedger, 'lines' | 'items' | 'folded'>;
137
+ needs: AiSiteImportImproveNeeds;
138
+ }): AiDoctrineViolation[];
139
+ /** A redesign's answer, read by position: `null` where it gave no section it can draw. */
140
+ export declare function aiReadImprovedPage(raw: unknown, settled?: AiLayoutSettlement[]): AiSiteImportImprovedSection[] | null;
141
+ /** The least width over height of an opening photo a redesign lays its words over (AGL-4152): a landscape, not a square or a portrait. */
142
+ export declare const AI_SITE_IMPORT_COVER_LEAST_RATIO = 1.3;
143
+ /**
144
+ * The site's hero as a page brought in draws it: a collage or a portrait holds
145
+ * what a page brought in does not. A redesign whose opening holds the page's
146
+ * own landscape photo lays its words over it (AGL-4152): a hero that boxes a
147
+ * wide photo under centered words reads as a picture pasted below a heading,
148
+ * the way an old page looks, never as a brand's opening.
149
+ */
150
+ export declare function aiSiteImportImproveHero(design: AiLayoutDesign, plan?: AiSiteImportPlan | null, opening?: {
151
+ ratio?: number;
152
+ } | null): AiLayoutImportHero;
153
+ /** How many of a group's items sit across: planned for how much each says. */
154
+ export declare function aiSiteImportImproveColumns(items: readonly AiLayoutItem[]): number;
155
+ export interface AiSiteImportImproveCompileInput {
156
+ doc: AiSiteImportDocument;
157
+ ledger: SiteImportLedger;
158
+ design: AiLayoutDesign;
159
+ destinations: ReadonlyMap<string, string>;
160
+ formId: string | null;
161
+ plan?: AiSiteImportPlan | null;
162
+ /** The theme the page is drawn in, where it is known: a brand band only where the brand itself fills. */
163
+ theme?: SiteImportFidelityTheme | null;
164
+ }
165
+ /**
166
+ * The source's own pictures each set of written cards takes (AGL-4152), by
167
+ * block: where an answer wrote like services as cards and gave none of them a
168
+ * picture, while the page's photos of those same services sit unplaced, each
169
+ * card takes the photo whose words it says. Every card must find one, or the
170
+ * set takes none: a grid of cards half of which show a photo reads as broken.
171
+ * Where no card says a photo's words but the one section's unplaced photos
172
+ * number exactly the cards, they are taken in order, as the source laid them.
173
+ */
174
+ export declare function aiSiteImportCardPictures(answer: readonly AiSiteImportImprovedSection[], ledger: Pick<SiteImportLedger, 'items' | 'lines'>): Map<AiSiteImportImprovedBlock, string[]>;
175
+ /** What a redesign compiles into, and what its row and its check say of it. */
176
+ export interface AiSiteImportImprovedPage {
177
+ given: AiSiteImportDesigned;
178
+ names: string[];
179
+ written: string[];
180
+ added: AiSiteImportAddedSection[];
181
+ pictures: AiSiteImportPagePictures;
182
+ }
183
+ /** 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;
185
+ /** The most an answer may ask for, whatever the page and the model: a whole page's design and words, with its thinking. */
186
+ export declare const AI_SITE_IMPORT_IMPROVE_MOST_TOKENS = 8000;
187
+ /**
188
+ * Room a page's ceiling keeps for its listing pass (AGL-4152): its p90 is 1,
189
+ * and it runs a model only where the source left the listing empty.
190
+ */
191
+ export declare const AI_SITE_IMPORT_LISTING_ROOM_CREDITS = 10;
192
+ /**
193
+ * What a page's redesign may spend, its answer and its re-ask together
194
+ * (AGL-4152): the page's ceiling, less its listing pass's room. Held in code
195
+ * (`aiSiteImportImproveTokensWithin`): an answer asks no more than the
196
+ * ceiling buys, and a re-ask it cannot pay for is not asked.
197
+ */
198
+ export declare const AI_SITE_IMPORT_IMPROVE_CEILING_CREDITS: number;
199
+ /** What a request reads before it is sent, at worst: its system blocks written to the cache, its turn as input. */
200
+ export declare function aiSiteImportImproveInputUsage(input: {
201
+ systemChars: number;
202
+ promptChars: number;
203
+ }): AiUsage;
204
+ /** What a usage is billed in credits on a model. */
205
+ export declare function aiSiteImportImproveCredits(usage: AiUsage, model: string): number;
206
+ /**
207
+ * The most output tokens a request may write (AGL-4152) with `spent` already
208
+ * spent and `input` still to read, and stay inside `ceiling` credits; at
209
+ * most `most`, and 0 where its reading alone would pass the ceiling.
210
+ */
211
+ export declare function aiSiteImportImproveTokensWithin(input: {
212
+ model: string;
213
+ spent: AiUsage;
214
+ input: AiUsage;
215
+ ceiling?: number;
216
+ most: number;
217
+ }): number;
218
+ /** The least share of the last answer's length a re-ask must have room for: less, and it would be cut off. */
219
+ export declare const AI_SITE_IMPORT_REASK_ROOM = 0.9;
220
+ /**
221
+ * Whether a redesign's re-ask fits its page's ceiling (AGL-4152): the most
222
+ * tokens it may ask, given what the first answer spent, or 0 where the room
223
+ * left is under what the first answer wrote, and the page falls back with
224
+ * no re-ask rather than pass its ceiling.
225
+ */
226
+ export declare function aiSiteImportImproveReaskTokens(input: {
227
+ model: string;
228
+ spent: AiUsage;
229
+ lastOutput: number;
230
+ most: number;
231
+ ceiling?: number;
232
+ }): number;
233
+ /** What a redesign settled: the page built, what it added and what it shows. */
234
+ export interface AiSiteImportImproved<T> {
235
+ built: T;
236
+ page: AiSiteImportImprovedPage;
237
+ /** The design lines it was taken with still missed, by code (`AI_SITE_IMPORT_IMPROVE_SOFT_CODES`): only where no re-ask was left. */
238
+ missed?: string[];
239
+ }
240
+ /**
241
+ * What a redesign may still miss when no re-ask is left and be taken all the
242
+ * same (AGL-4152): how it is planned and drawn, never what it says or holds.
243
+ * Each is asked for in the one re-ask where it can be paid for; past it, the
244
+ * old layout redrawn is no better on any of them than the redesign, and worse
245
+ * on every other, so a miss here is noted on the page's row, not fallen back
246
+ * on. What it says, holds, links and reads as (facts, invented, held, links,
247
+ * meaning, contrast, a phone's width) stays a fallback.
248
+ */
249
+ export declare const AI_SITE_IMPORT_IMPROVE_SOFT_CODES: ReadonlySet<string>;
250
+ /** Whether every miss of an answer is one it may be taken with past its last re-ask. */
251
+ 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[];
254
+ /** A scored redesign's misses, each as the re-ask names it: what is red on its ledger and its design lines. */
255
+ export declare function aiSiteImportImprovedMisses(report: Pick<SiteImportPageFidelity, 'improved'>): AiDoctrineViolation[];
256
+ /** A redesign's read for a page: its ledger, and everywhere a link may go. */
257
+ export declare function aiSiteImportImproveLedger(doc: AiSiteImportDocument): SiteImportLedger;
258
+ /**
259
+ * A redesign's check (AGL-4152), answer by answer: its words and refs held to
260
+ * what the import read, its page compiled and held to the doctrine as a page
261
+ * written (`build`), and scored (`score`). Any miss is named for the one
262
+ * re-ask; a second miss is the caller's fallback.
263
+ */
264
+ export declare function aiSiteImportImproveCheck<T>(input: {
265
+ doc: AiSiteImportDocument;
266
+ ledger: SiteImportLedger;
267
+ design: AiLayoutDesign;
268
+ scope: readonly string[];
269
+ formId: string | null;
270
+ framing?: AiCopyFraming | null;
271
+ plan?: AiSiteImportPlan | null;
272
+ theme?: SiteImportFidelityTheme | null;
273
+ /** What the page is for and the new sections it needs; absent, nothing is asked of its plan. */
274
+ needs?: AiSiteImportImproveNeeds | null;
275
+ build: (page: AiSiteImportImprovedPage) => {
276
+ value: T | null;
277
+ violations: AiDoctrineViolation[];
278
+ };
279
+ score: (built: T, destinations: readonly string[]) => AiDoctrineViolation[];
280
+ /**
281
+ * The last answer read again once no re-ask is left (AGL-4152): its soft
282
+ * misses (`AI_SITE_IMPORT_IMPROVE_SOFT_CODES`) are noted, not refused.
283
+ * Every other line holds exactly as on the first read.
284
+ */
285
+ lenient?: boolean;
286
+ }): AiGenerationCheck<AiSiteImportImproved<T>>;