@aglyn/plugins-ai 1.9.1 → 1.10.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 (82) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-job-requests.d.ts +5 -0
  3. package/src/lib/components/ai-job-requests.js +4 -0
  4. package/src/lib/components/ai-job-requests.js.map +1 -1
  5. package/src/lib/components/ai-site-build-page.component.js +10 -3
  6. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  7. package/src/lib/components/ai-site-import-finish.component.d.ts +40 -0
  8. package/src/lib/components/ai-site-import-finish.component.js +174 -0
  9. package/src/lib/components/ai-site-import-finish.component.js.map +1 -0
  10. package/src/lib/components/ai-site-import-job.component.d.ts +11 -3
  11. package/src/lib/components/ai-site-import-job.component.js +220 -135
  12. package/src/lib/components/ai-site-import-job.component.js.map +1 -1
  13. package/src/lib/components/ai-site-import-start.component.d.ts +11 -2
  14. package/src/lib/components/ai-site-import-start.component.js +27 -5
  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 +1 -1
  17. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  18. package/src/lib/jobs/ai-build-capabilities.js +2 -2
  19. package/src/lib/jobs/ai-build-capabilities.js.map +1 -1
  20. package/src/lib/jobs/ai-job-import-step.d.ts +2 -0
  21. package/src/lib/jobs/ai-job-import-step.js +31 -8
  22. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  23. package/src/lib/jobs/ai-job-page-language.d.ts +40 -2
  24. package/src/lib/jobs/ai-job-page-language.js +188 -9
  25. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  26. package/src/lib/jobs/ai-job-page-step.js +2 -0
  27. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  28. package/src/lib/jobs/ai-job-privacy-step.d.ts +5 -0
  29. package/src/lib/jobs/ai-job-privacy-step.js +9 -4
  30. package/src/lib/jobs/ai-job-privacy-step.js.map +1 -1
  31. package/src/lib/jobs/ai-job-text-step.d.ts +7 -1
  32. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  33. package/src/lib/jobs/ai-site-import-compile.d.ts +13 -2
  34. package/src/lib/jobs/ai-site-import-compile.js +115 -21
  35. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  36. package/src/lib/jobs/ai-site-import-document.d.ts +5 -1
  37. package/src/lib/jobs/ai-site-import-document.js +5 -1
  38. package/src/lib/jobs/ai-site-import-document.js.map +1 -1
  39. package/src/lib/jobs/ai-site-import-look.d.ts +16 -4
  40. package/src/lib/jobs/ai-site-import-look.js +54 -13
  41. package/src/lib/jobs/ai-site-import-look.js.map +1 -1
  42. package/src/lib/jobs/ai-site-import-wording.d.ts +187 -0
  43. package/src/lib/jobs/ai-site-import-wording.js +747 -0
  44. package/src/lib/jobs/ai-site-import-wording.js.map +1 -0
  45. package/src/lib/layout-language/ai-layout-compiler.d.ts +12 -1
  46. package/src/lib/layout-language/ai-layout-compiler.js +29 -30
  47. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  48. package/src/lib/layout-language/ai-layout-language.d.ts +12 -0
  49. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  50. package/src/lib/model/ai-site-import-fidelity.d.ts +211 -2
  51. package/src/lib/model/ai-site-import-fidelity.js +1011 -14
  52. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  53. package/src/lib/model/ai-site-import-report.d.ts +52 -1
  54. package/src/lib/model/ai-site-import-report.js +102 -5
  55. package/src/lib/model/ai-site-import-report.js.map +1 -1
  56. package/src/lib/model/ai-site-import-view.d.ts +62 -2
  57. package/src/lib/model/ai-site-import-view.js +83 -4
  58. package/src/lib/model/ai-site-import-view.js.map +1 -1
  59. package/src/lib/model/ai-site-import.d.ts +122 -6
  60. package/src/lib/model/ai-site-import.js +202 -9
  61. package/src/lib/model/ai-site-import.js.map +1 -1
  62. package/src/lib/model/ai-site-look.d.ts +51 -0
  63. package/src/lib/model/ai-site-look.js +205 -29
  64. package/src/lib/model/ai-site-look.js.map +1 -1
  65. package/src/lib/runtime/ai-doctrine-validators.d.ts +19 -0
  66. package/src/lib/runtime/ai-doctrine-validators.js +25 -0
  67. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  68. package/src/lib/runtime/ai-doctrine.js +4 -1
  69. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  70. package/src/lib/server/ai-allotments.js +4 -2
  71. package/src/lib/server/ai-allotments.js.map +1 -1
  72. package/src/lib/server/ai-jobs-resume.js +32 -5
  73. package/src/lib/server/ai-jobs-resume.js.map +1 -1
  74. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +36 -10
  75. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +48 -4
  76. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  77. package/src/lib/site-import/fixtures/site-look-slate.d.ts +27 -0
  78. package/src/lib/site-import/fixtures/site-look-slate.js +29 -0
  79. package/src/lib/site-import/fixtures/site-look-slate.js.map +1 -0
  80. package/src/lib/site-import/site-import-layout.d.ts +19 -5
  81. package/src/lib/site-import/site-import-layout.js +137 -16
  82. package/src/lib/site-import/site-import-layout.js.map +1 -1
@@ -0,0 +1,187 @@
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 { SiteImportLineRef } from '../model/ai-site-import';
18
+ import type { AiSystemBlock, AiTool } from '../providers/contract';
19
+ import type { AiGenerationCheck } from '../runtime/ai-doctrine';
20
+ import { type AiCopyFraming, type AiDoctrineViolation } from '../runtime/ai-doctrine-validators';
21
+ import { type AiSiteImportDocument } from './ai-site-import-document';
22
+ /** The wording answer's kind of generation: the name its re-ask and its doctrine scope go by. */
23
+ export declare const AI_SITE_IMPORT_WORDING_KIND = "page-wording";
24
+ /** The wording tool: the lines reworded, each by its number, with its new words, and nothing else. */
25
+ export declare const AI_SITE_IMPORT_WORDING_TOOL: AiTool;
26
+ /** The most a rewrite may run to, against its line's words. */
27
+ export declare const AI_SITE_IMPORT_WORDING_LENGTH: {
28
+ readonly least: 0.5;
29
+ readonly most: 1.6;
30
+ };
31
+ /**
32
+ * What a wording answer is told, cached: one static block every page shares,
33
+ * and the rule that fenced text is data. The page itself rides the user turn.
34
+ */
35
+ export declare const AI_SITE_IMPORT_WORDING_TEXT: string;
36
+ /** The wording answer's cached instructions, and the rule that fenced text is data. */
37
+ export declare const AI_SITE_IMPORT_WORDING_INSTRUCTIONS: readonly AiSystemBlock[];
38
+ /** What a line is, as the prompt names it and its place holds it. */
39
+ export type AiSiteImportWordingKind = 'heading' | 'paragraph' | 'list item' | 'button';
40
+ /** A line a rewrite may reword. */
41
+ export interface AiSiteImportWordingLine {
42
+ /** Its index in the page's blocks: the number the tool answers by. */
43
+ line: SiteImportLineRef;
44
+ kind: AiSiteImportWordingKind;
45
+ /** Its words as written. */
46
+ text: string;
47
+ /** The most characters a rewrite of it holds. */
48
+ limit: number;
49
+ /** Its section, by index. */
50
+ section: number;
51
+ }
52
+ /** One entry of the page as the prompt shows it: a line to reword, one kept as written, or a part with no lines of the tool. */
53
+ export interface AiSiteImportWordingEntry {
54
+ section: number;
55
+ /** The line's number, absent for a part shown whole (a table). */
56
+ line?: SiteImportLineRef;
57
+ /** What it is: "heading", "quote", "a table of 4 rows". */
58
+ what: string;
59
+ text: string;
60
+ /** Set where a rewrite may reword it. */
61
+ reword?: AiSiteImportWordingLine;
62
+ }
63
+ /** A page as the wording answer is shown it. */
64
+ export interface AiSiteImportWordingPage {
65
+ /** The page's sections' names, in order. */
66
+ sections: string[];
67
+ /** Every entry, in order, as far as the prompt's room goes. */
68
+ entries: AiSiteImportWordingEntry[];
69
+ /** The lines a rewrite may reword: those shown. */
70
+ lines: AiSiteImportWordingLine[];
71
+ /** Whether the page runs past what the prompt shows: the rest keeps its words. */
72
+ cut: boolean;
73
+ }
74
+ /** The most characters of a page the wording prompt shows, inside the fence's cap with room for its section heads. */
75
+ export declare const AI_SITE_IMPORT_WORDING_MAX_CHARS = 12000;
76
+ /** Room for the thinking a wording answer does before it writes, inside its ceiling. */
77
+ export declare const AI_SITE_IMPORT_WORDING_THINKING_TOKENS = 1000;
78
+ /** How much of a page the wording answer is shown. */
79
+ export interface AiSiteImportWordingRoom {
80
+ /** The most characters of the page the prompt shows. */
81
+ maxChars?: number;
82
+ /** The ceiling the answer is asked at: the lines offered are those a rewrite of every one fits in (`aiSiteImportWordingTokens`). */
83
+ maxTokens?: number;
84
+ }
85
+ /**
86
+ * The page as the wording answer is shown it (G1, G2): its sections and,
87
+ * in each, its lines in order, each marked as a line a rewrite may reword
88
+ * or one kept as written. A line is reworded only where every place the
89
+ * layout puts it allows it. The lines shown stop where the prompt's room,
90
+ * or the answer's ceiling, does; those past it keep their words.
91
+ */
92
+ export declare function aiSiteImportWordingPage(doc: Pick<AiSiteImportDocument, 'blocks' | 'title' | 'layout'>, room?: AiSiteImportWordingRoom): AiSiteImportWordingPage;
93
+ /** The page's lines as the fence holds them: each section's name, then its lines, numbered. */
94
+ export declare function aiSiteImportWordingText(page: AiSiteImportWordingPage): string;
95
+ /** A wording answer's user turn: the page, the site's own name, and its lines, fenced as the owner's data. */
96
+ export declare function aiSiteImportWordingPrompt(input: {
97
+ screen: {
98
+ title: string;
99
+ slug: string;
100
+ };
101
+ doc: Pick<AiSiteImportDocument, 'url'>;
102
+ page: AiSiteImportWordingPage;
103
+ siteName?: string | null;
104
+ }): string;
105
+ /**
106
+ * The ceiling a page's wording answer wants (G1): twice its lines' own
107
+ * tokens, so a rewrite of every line fits with room, and its thinking.
108
+ * The page step holds it to the time the design answer leaves.
109
+ */
110
+ export declare function aiSiteImportWordingTokens(page: AiSiteImportWordingPage): number;
111
+ /** One line as an answer rewords it. */
112
+ export interface AiSiteImportRewrite {
113
+ line: number;
114
+ text: string;
115
+ }
116
+ /** An answer's lines, read defensively: each with a whole number and words; `null` where it has no list of lines. */
117
+ export declare function aiReadWordingAnswer(answer: Record<string, unknown> | null | undefined): AiSiteImportRewrite[] | null;
118
+ /** Why a rewrite was refused (G3). */
119
+ export type AiSiteImportWordingCode = 'wording-no-line' | 'wording-fixed-line' | 'wording-repeated-line' | 'wording-empty' | 'wording-script' | 'wording-length' | 'wording-dropped-fact' | 'wording-dropped-name' | 'wording-invented-fact' | 'wording-gap' | 'wording-meaning' | 'wording-copy';
120
+ /** A rewrite refused, and why. */
121
+ export interface AiSiteImportWordingRefusal {
122
+ line: number;
123
+ code: AiSiteImportWordingCode;
124
+ /** What the model is told: what the line broke and what to do. */
125
+ message: string;
126
+ /** What it broke, beyond the message: the facts it dropped or added. */
127
+ detail?: string;
128
+ }
129
+ /** What a page's rewrites are held to beyond their own lines. */
130
+ export interface AiSiteImportWordingScope {
131
+ doc: Pick<AiSiteImportDocument, 'blocks'>;
132
+ page: Pick<AiSiteImportWordingPage, 'lines'>;
133
+ /** The site's own name, which every rewrite says as often as its line does. */
134
+ siteName?: string | null;
135
+ /** Who the copy is framed for: agency and enterprise copy holds to the judgment-word rule. */
136
+ framing?: AiCopyFraming;
137
+ }
138
+ /** The rewrites that hold, by line, and those refused. */
139
+ export interface AiSiteImportWordingHeld {
140
+ held: Map<number, string>;
141
+ refused: AiSiteImportWordingRefusal[];
142
+ }
143
+ /** The script most of a line's letters are written in; `null` for a line with none. */
144
+ export declare function aiSiteImportScriptOf(text: string): string | null;
145
+ /**
146
+ * Every rule a rewrite is held to (G2, G3), pure, one line at a time: a
147
+ * rewrite that breaks one is refused, and its line keeps its words. A
148
+ * rewrite the same as its line is no rewrite, and is neither.
149
+ */
150
+ export declare function aiSiteImportWordingHolds(scope: AiSiteImportWordingScope, rewrites: readonly AiSiteImportRewrite[]): AiSiteImportWordingHeld;
151
+ /** A refusal as the re-ask names it. */
152
+ export declare function aiSiteImportWordingViolation(refusal: AiSiteImportWordingRefusal): AiDoctrineViolation;
153
+ /**
154
+ * The page with its rewrites (G3): the source's document, each rewritten
155
+ * line's words in place of its own and every block at its index, its layout
156
+ * pinned to the source's so no section moves or is renamed. An image, or a
157
+ * line no rewrite names, is the source's.
158
+ */
159
+ export declare function aiSiteImportRewordedDocument(doc: AiSiteImportDocument, rewrites: ReadonlyMap<number, string>): AiSiteImportDocument;
160
+ /** A page's wording, settled: the page built in its rewrites, and the lines kept as written after their re-ask. */
161
+ export interface AiSiteImportWorded<T> {
162
+ built: T;
163
+ /** The lines reworded, by number. */
164
+ rewrites: Map<number, string>;
165
+ /** The lines refused twice, which keep their words. */
166
+ kept: AiSiteImportWordingRefusal[];
167
+ }
168
+ /**
169
+ * The wording answer's check (G3): every rewrite held line by line, a
170
+ * refused one asked again once — the lines that held are kept between the
171
+ * answers — and the page built whole in what held (`build`, the page step's
172
+ * check of a page brought in, with rule 14 on for the rewritten lines). On
173
+ * the last answer a line refused again keeps its words; a page that cannot
174
+ * be built in its rewrites is refused whole, and the page step keeps the
175
+ * page's words.
176
+ *
177
+ * Stateful across one generation's answers: make one for each.
178
+ */
179
+ export declare function aiSiteImportWordingCheck<T>(input: AiSiteImportWordingScope & {
180
+ doc: AiSiteImportDocument;
181
+ build: (reworded: AiSiteImportDocument, rewritten: readonly string[]) => {
182
+ value: T | null;
183
+ violations: AiDoctrineViolation[];
184
+ };
185
+ /** The answers one generation makes; the last keeps a line refused again as written. */
186
+ attempts?: number;
187
+ }): AiGenerationCheck<AiSiteImportWorded<T>>;