@aglyn/plugins-ai 1.0.0-beta.296 → 1.1.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 (70) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-job-links.d.ts +2 -1
  3. package/src/lib/components/ai-job-links.js +8 -2
  4. package/src/lib/components/ai-job-links.js.map +1 -1
  5. package/src/lib/components/ai-site-start-card.component.d.ts +1 -1
  6. package/src/lib/components/ai-site-start-card.component.js +40 -13
  7. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  8. package/src/lib/components/ai-site-start-steps.component.d.ts +17 -1
  9. package/src/lib/components/ai-site-start-steps.component.js +30 -7
  10. package/src/lib/components/ai-site-start-steps.component.js.map +1 -1
  11. package/src/lib/components/assist-edit-canvas.d.ts +12 -6
  12. package/src/lib/components/assist-edit-canvas.js +86 -36
  13. package/src/lib/components/assist-edit-canvas.js.map +1 -1
  14. package/src/lib/components/assist-edit-card.component.js +9 -8
  15. package/src/lib/components/assist-edit-card.component.js.map +1 -1
  16. package/src/lib/components/assist-page-change-card.component.d.ts +1 -1
  17. package/src/lib/components/assist-page-change-card.component.js +2 -2
  18. package/src/lib/components/assist-page-change-card.component.js.map +1 -1
  19. package/src/lib/components/assist-panel.component.js +16 -9
  20. package/src/lib/components/assist-panel.component.js.map +1 -1
  21. package/src/lib/jobs/ai-job-drafts.d.ts +3 -0
  22. package/src/lib/jobs/ai-job-drafts.js +5 -0
  23. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  24. package/src/lib/jobs/ai-job-edit-step.d.ts +20 -0
  25. package/src/lib/jobs/ai-job-edit-step.js +39 -3
  26. package/src/lib/jobs/ai-job-edit-step.js.map +1 -1
  27. package/src/lib/jobs/ai-job-layout-language.d.ts +10 -0
  28. package/src/lib/jobs/ai-job-layout-language.js +38 -2
  29. package/src/lib/jobs/ai-job-layout-language.js.map +1 -1
  30. package/src/lib/jobs/ai-job-layout-step.js +3 -3
  31. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  32. package/src/lib/jobs/ai-site-import-compile.js +15 -7
  33. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  34. package/src/lib/layout-language/ai-layout-compiler.js +39 -1
  35. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
  36. package/src/lib/layout-language/ai-layout-frame.d.ts +6 -0
  37. package/src/lib/layout-language/ai-layout-frame.js +85 -30
  38. package/src/lib/layout-language/ai-layout-frame.js.map +1 -1
  39. package/src/lib/layout-language/ai-layout-language.d.ts +5 -0
  40. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  41. package/src/lib/model/ai-edit-job.js +1 -1
  42. package/src/lib/model/ai-edit-job.js.map +1 -1
  43. package/src/lib/model/ai-job-notice.js +3 -1
  44. package/src/lib/model/ai-job-notice.js.map +1 -1
  45. package/src/lib/model/ai-site-import-fidelity.d.ts +175 -0
  46. package/src/lib/model/ai-site-import-fidelity.js +941 -0
  47. package/src/lib/model/ai-site-import-fidelity.js.map +1 -0
  48. package/src/lib/model/ai-site-start.d.ts +27 -0
  49. package/src/lib/model/ai-site-start.js +41 -0
  50. package/src/lib/model/ai-site-start.js.map +1 -1
  51. package/src/lib/model/assist-edit.d.ts +8 -7
  52. package/src/lib/model/assist-edit.js +4 -4
  53. package/src/lib/model/assist-edit.js.map +1 -1
  54. package/src/lib/model/assist-page-change.d.ts +34 -0
  55. package/src/lib/model/assist-page-change.js +43 -0
  56. package/src/lib/model/assist-page-change.js.map +1 -1
  57. package/src/lib/runtime/ai-node-tree.js +18 -2
  58. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  59. package/src/lib/server/assist-chat.d.ts +5 -0
  60. package/src/lib/server/assist-chat.js +16 -3
  61. package/src/lib/server/assist-chat.js.map +1 -1
  62. package/src/lib/server/assist-edit.d.ts +12 -7
  63. package/src/lib/server/assist-edit.js +43 -22
  64. package/src/lib/server/assist-edit.js.map +1 -1
  65. package/src/lib/server/assist-page-change.d.ts +12 -0
  66. package/src/lib/server/assist-page-change.js +24 -2
  67. package/src/lib/server/assist-page-change.js.map +1 -1
  68. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +62 -0
  69. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +374 -0
  70. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -0
@@ -0,0 +1,175 @@
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 { SiteImportBlock } from '../site-import/site-import-html';
18
+ import type { SiteImportBand, SiteImportFooter, SiteImportGroupKind, SiteImportLayout, SiteImportNavTree } from './ai-site-import';
19
+ /** The lowest score of structure a page brought in ships at (AGL-4109); words are held at exactly 1. */
20
+ export declare const SITE_IMPORT_FIDELITY_THRESHOLD = 0.9;
21
+ /** A node of a page or a layout, as the compiler draws it or Firestore stores it, decoded. */
22
+ export interface SiteImportFidelityNode {
23
+ componentId?: string;
24
+ props?: Record<string, unknown> | null;
25
+ sx?: Record<string, unknown> | null;
26
+ nodes?: readonly string[] | null;
27
+ parentId?: string | null;
28
+ interactions?: readonly unknown[] | null;
29
+ }
30
+ /** A built page or layout: its nodes and the one they hang from. */
31
+ export interface SiteImportFidelityTree {
32
+ rootId: string;
33
+ nodes: Readonly<Record<string, SiteImportFidelityNode>>;
34
+ }
35
+ /** What the source had, what the built page kept of it, and the share kept. */
36
+ export interface SiteImportFidelityCount {
37
+ source: number;
38
+ built: number;
39
+ ratio: number;
40
+ }
41
+ /** The words of a page: every one of the source's, as written, exactly once, and none of its own. */
42
+ export interface SiteImportFidelityWords {
43
+ /** Words the source's lines hold. */
44
+ source: number;
45
+ /** Words the built page shows. */
46
+ built: number;
47
+ /** The source's words the page does not show (counted as often as they are missing). */
48
+ missing: number;
49
+ /** Words the page shows that are not the source's, or are shown more often than the source says them. */
50
+ extra: number;
51
+ /** Words shown once each, over the larger of the two. */
52
+ ratio: number;
53
+ /** A few of the missing and extra words, for a report. */
54
+ examples: {
55
+ missing: string[];
56
+ extra: string[];
57
+ };
58
+ }
59
+ export interface SiteImportFidelityGroup {
60
+ /** Groups of the kind kept whole: every item of them its own element, with its parts. */
61
+ groups: SiteImportFidelityCount;
62
+ /** Items of the kind kept, each its own element with its parts. */
63
+ items: SiteImportFidelityCount;
64
+ }
65
+ /** A page brought in, scored against its source. */
66
+ export interface SiteImportPageFidelity {
67
+ /** The lowest ratio of the structure: what the page ships on, at `SITE_IMPORT_FIDELITY_THRESHOLD` or above. */
68
+ score: number;
69
+ /** The measure that set the score; `null` when every measure is whole. */
70
+ lowest: string | null;
71
+ words: SiteImportFidelityWords;
72
+ sections: SiteImportFidelityCount;
73
+ /** Sections drawn in the source's band, in order. */
74
+ bands: SiteImportFidelityCount & {
75
+ read: SiteImportBand[];
76
+ drawn: SiteImportBand[];
77
+ };
78
+ /** The source's rows of two or more columns, set side by side on the page. */
79
+ rows: SiteImportFidelityCount;
80
+ /** The source's groups by kind. A group of lines that only share a shape (`text`) is drawn as its lines, and is not scored. */
81
+ groups: Partial<Record<SiteImportGroupKind, SiteImportFidelityGroup>>;
82
+ tables: SiteImportFidelityCount;
83
+ tabs: SiteImportFidelityCount;
84
+ /** The source's pictures placed on the page. */
85
+ pictures: SiteImportFidelityCount;
86
+ /**
87
+ * The source's icons drawn: each group item's own, each bullet's mark. An
88
+ * icon standing alone in the source (a video's play mark) is no word and no
89
+ * picture of the page, and the build leaves it out (AGL-4107): it is
90
+ * counted in `lone` and not scored.
91
+ */
92
+ icons: SiteImportFidelityCount & {
93
+ lone: number;
94
+ };
95
+ /**
96
+ * The lines the source draws as buttons that go somewhere (a page, an
97
+ * address, an email, a phone), drawn as buttons of the same style with
98
+ * their destinations. A button that goes nowhere a page can send a visitor
99
+ * (a film's play button its script runs) is kept as its words: counted in
100
+ * `unlinked`, not scored.
101
+ */
102
+ buttons: SiteImportFidelityCount & {
103
+ unlinked: number;
104
+ };
105
+ /** The source's headings, drawn as headings. */
106
+ headings: SiteImportFidelityCount;
107
+ /** The source's forms, where the site has a form a page places. */
108
+ forms: SiteImportFidelityCount;
109
+ }
110
+ /** A page's source as the import read it: its layout over its main-region blocks, and its photos as the library holds them. */
111
+ export interface SiteImportFidelitySource {
112
+ layout: SiteImportLayout;
113
+ /** The page's main-region blocks, which the layout's lines are indexes of. */
114
+ blocks: readonly SiteImportBlock[];
115
+ /** The source's pictures as the site's library holds them (`from` → `src`); without them a picture is counted, not placed. */
116
+ photos?: ReadonlyArray<{
117
+ from?: string;
118
+ src: string;
119
+ }>;
120
+ }
121
+ /** A section's band as the compiler draws it: a dark scheme, the paper ground, the brand fill, else plain. */
122
+ export declare function siteImportFidelityBandOf(node: SiteImportFidelityNode | undefined): SiteImportBand;
123
+ /** The node a stored page or layout hangs from: the canvas root, else the one with no parent. */
124
+ export declare function siteImportFidelityTreeOf(nodes: Readonly<Record<string, SiteImportFidelityNode>>): SiteImportFidelityTree;
125
+ /**
126
+ * A built page scored against its source (AGL-4109): the words, each once;
127
+ * the sections and their bands; the rows of columns; the groups by kind, each
128
+ * item an element of its own with its parts; the tables, tabs, pictures,
129
+ * icons, buttons, headings and forms. The score is the lowest ratio of the
130
+ * structure.
131
+ */
132
+ export declare function siteImportFidelity(source: SiteImportFidelitySource, tree: SiteImportFidelityTree): SiteImportPageFidelity;
133
+ /** A built header and footer, scored against the source's. */
134
+ export interface SiteImportFrameFidelity {
135
+ /** The lowest ratio of the header's and footer's measures. */
136
+ score: number;
137
+ lowest: string | null;
138
+ /** The source's top-level items, in the header's row, over the larger of the two (a row of page titles scores low). */
139
+ items: SiteImportFidelityCount;
140
+ /** Whether the row's items are in the source's order. */
141
+ inOrder: boolean;
142
+ /** The source's menus drawn as menus under their names. */
143
+ menus: SiteImportFidelityCount;
144
+ /** The source's menu entries, each a link in its menu. */
145
+ entries: SiteImportFidelityCount;
146
+ /** The lines under entries and their icons, in their menus. */
147
+ details: SiteImportFidelityCount;
148
+ /** The header's buttons, drawn as the source draws them, each with its destination. */
149
+ ctas: SiteImportFidelityCount;
150
+ /** Everything of the row in the phone menu: each menu's name and entries, the links, the buttons. */
151
+ drawer: SiteImportFidelityCount;
152
+ /** A menu button shown where the row is not, opening the phone menu. */
153
+ phone: SiteImportFidelityCount;
154
+ /** The row's labels held to one line. */
155
+ nowrap: SiteImportFidelityCount;
156
+ /** The footer's columns under their headings. */
157
+ columns: SiteImportFidelityCount;
158
+ /** The footer's links, its columns' and its own. */
159
+ links: SiteImportFidelityCount;
160
+ /** Its profiles on other sites. */
161
+ social: SiteImportFidelityCount;
162
+ /** Its words, address, phone, email and © line, word for word. */
163
+ facts: SiteImportFidelityCount;
164
+ }
165
+ /**
166
+ * A built header and footer scored against the source's (AGL-4109): the
167
+ * header's top-level items in order, each menu's entries with the lines and
168
+ * icons under them, its buttons, the phone menu holding all of it, the row's
169
+ * labels on one line; the footer's columns, links, profiles and facts. The
170
+ * score is the lowest ratio.
171
+ */
172
+ export declare function siteImportFrameFidelity(source: {
173
+ nav: SiteImportNavTree | null | undefined;
174
+ footer: SiteImportFooter | null | undefined;
175
+ }, tree: SiteImportFidelityTree): SiteImportFrameFidelity;