@aglyn/plugins-ai 1.13.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) 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 +3 -2
  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 +47 -2
  22. package/src/lib/jobs/ai-job-import-step.js +356 -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 +21 -2
  27. package/src/lib/jobs/ai-job-page-language.js +217 -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 +73 -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 +10 -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 +126 -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 +233 -0
  50. package/src/lib/jobs/ai-site-import-improve.js +1151 -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 +100 -14
  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 +16 -2
  76. package/src/lib/layout-language/ai-layout-language.js +11 -5
  77. package/src/lib/layout-language/ai-layout-language.js.map +1 -1
  78. package/src/lib/model/ai-site-import-fidelity.d.ts +71 -0
  79. package/src/lib/model/ai-site-import-fidelity.js +438 -6
  80. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  81. package/src/lib/model/ai-site-import-ledger.d.ts +82 -0
  82. package/src/lib/model/ai-site-import-ledger.js +254 -0
  83. package/src/lib/model/ai-site-import-ledger.js.map +1 -0
  84. package/src/lib/model/ai-site-import-view.d.ts +110 -6
  85. package/src/lib/model/ai-site-import-view.js +166 -13
  86. package/src/lib/model/ai-site-import-view.js.map +1 -1
  87. package/src/lib/model/ai-site-import.d.ts +234 -2
  88. package/src/lib/model/ai-site-import.js +312 -15
  89. package/src/lib/model/ai-site-import.js.map +1 -1
  90. package/src/lib/model/ai-site-job.js +4 -0
  91. package/src/lib/model/ai-site-job.js.map +1 -1
  92. package/src/lib/model/ai-site-kinds.d.ts +2 -0
  93. package/src/lib/model/ai-site-kinds.js +7 -0
  94. package/src/lib/model/ai-site-kinds.js.map +1 -1
  95. package/src/lib/model/ai-site-look.d.ts +14 -5
  96. package/src/lib/model/ai-site-look.js +22 -16
  97. package/src/lib/model/ai-site-look.js.map +1 -1
  98. package/src/lib/model/ai-site-start.d.ts +37 -7
  99. package/src/lib/model/ai-site-start.js +54 -10
  100. package/src/lib/model/ai-site-start.js.map +1 -1
  101. package/src/lib/model/ai-site-starter-look.d.ts +69 -0
  102. package/src/lib/model/ai-site-starter-look.js +90 -0
  103. package/src/lib/model/ai-site-starter-look.js.map +1 -0
  104. package/src/lib/runtime/ai-doctrine-validators.d.ts +7 -0
  105. package/src/lib/runtime/ai-doctrine-validators.js +3 -2
  106. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  107. package/src/lib/runtime/ai-doctrine.d.ts +10 -0
  108. package/src/lib/runtime/ai-doctrine.js +16 -2
  109. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  110. package/src/lib/runtime/site-inventory.js +2 -3
  111. package/src/lib/runtime/site-inventory.js.map +1 -1
  112. package/src/lib/server/ai-jobs-resume.js +12 -3
  113. package/src/lib/server/ai-jobs-resume.js.map +1 -1
  114. package/src/lib/server/ai-jobs-route.js +5 -1
  115. package/src/lib/server/ai-jobs-route.js.map +1 -1
  116. package/src/lib/server/ai-site-import-route.d.ts +6 -0
  117. package/src/lib/server/ai-site-import-route.js +8 -1
  118. package/src/lib/server/ai-site-import-route.js.map +1 -1
  119. package/src/lib/server/assist-view-context.js +3 -3
  120. package/src/lib/server/assist-view-context.js.map +1 -1
  121. package/src/lib/site-import/fixtures/site-import-fidelity-replay.d.ts +57 -7
  122. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js +277 -21
  123. package/src/lib/site-import/fixtures/site-import-fidelity-replay.js.map +1 -1
  124. package/src/lib/site-import/fixtures/site-import-improve-answers.d.ts +33 -0
  125. package/src/lib/site-import/fixtures/site-import-improve-answers.js +457 -0
  126. package/src/lib/site-import/fixtures/site-import-improve-answers.js.map +1 -0
  127. package/src/lib/site-import/fixtures/site-layout-recordings.d.ts +29 -0
  128. package/src/lib/site-import/fixtures/site-layout-recordings.js +26 -0
  129. package/src/lib/site-import/fixtures/site-layout-recordings.js.map +1 -1
  130. package/src/lib/site-import/site-import-concealed.d.ts +30 -0
  131. package/src/lib/site-import/site-import-concealed.js +231 -0
  132. package/src/lib/site-import/site-import-concealed.js.map +1 -0
  133. package/src/lib/site-import/site-import-crawl.d.ts +3 -1
  134. package/src/lib/site-import/site-import-crawl.js +8 -1
  135. package/src/lib/site-import/site-import-crawl.js.map +1 -1
  136. package/src/lib/site-import/site-import-css.js +13 -2
  137. package/src/lib/site-import/site-import-css.js.map +1 -1
  138. package/src/lib/site-import/site-import-flag.d.ts +17 -0
  139. package/src/lib/site-import/site-import-flag.js +15 -0
  140. package/src/lib/site-import/site-import-flag.js.map +1 -1
  141. package/src/lib/site-import/site-import-html.d.ts +28 -0
  142. package/src/lib/site-import/site-import-html.js +246 -49
  143. package/src/lib/site-import/site-import-html.js.map +1 -1
  144. package/src/lib/site-import/site-import-layout.js +211 -12
  145. package/src/lib/site-import/site-import-layout.js.map +1 -1
  146. package/src/lib/site-import/site-import-page.js +2 -0
  147. package/src/lib/site-import/site-import-page.js.map +1 -1
  148. package/src/lib/testing/stand-in-dataset-index.js +6 -2
  149. package/src/lib/testing/stand-in-dataset-index.js.map +1 -1
@@ -14,12 +14,24 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ import { type AiSiteImportImprovedPage } from '../../jobs/ai-site-import-improve';
17
18
  import { type AiSiteImportDocument } from '../../jobs/ai-site-import-document';
18
- import { type AiSiteImportFinish, type AiSiteImportWords, type SiteImportFooter, type SiteImportNavTree } from '../../model/ai-site-import';
19
+ import { type AiSiteImportFinish, type AiSiteImportPlan, type AiSiteImportState, type AiSiteImportWords, type SiteImportFooter, type SiteImportNavTree } from '../../model/ai-site-import';
19
20
  import { type SiteImportFidelitySource, type SiteImportFidelityTheme, type SiteImportFidelityTree } from '../../model/ai-site-import-fidelity';
20
- import { type SiteLayoutPageName } from './site-layout-recordings';
21
+ import { type SiteBasicPageName, type SiteLayoutPageName } from './site-layout-recordings';
22
+ /** A page the replay reads: one of the recorded pages, or a basic site that does not exist (AGL-4152). */
23
+ export type SiteImportReplayName = SiteLayoutPageName | SiteBasicPageName;
24
+ /** A page's read as the import step hands it on, and what it says it left out for the fidelity (AGL-4152). */
25
+ export type SiteImportReplayRead = AiSiteImportDocument & {
26
+ concealed?: {
27
+ pictures: string[];
28
+ words: string[];
29
+ };
30
+ };
21
31
  /** A recorded page as a wave's read keeps it and the import step hands it on: its blocks, its layout, its photos in the library. */
22
- export declare function siteImportReplayDocument(name: SiteLayoutPageName): AiSiteImportDocument;
32
+ export declare function siteImportReplayDocument(name: SiteImportReplayName): SiteImportReplayRead;
33
+ /** Any page as a wave's read keeps it, read through its stylesheets (AGL-4152). */
34
+ export declare function siteImportReplayDocumentOf(html: string, url: string, sameSite: (url: URL) => boolean, stylesheets?: readonly string[]): SiteImportReplayRead;
23
35
  /** A recorded page built as the page step builds it: its source, its stored nodes, and what the page check said. */
24
36
  export interface SiteImportReplayPage {
25
37
  doc: AiSiteImportDocument;
@@ -46,6 +58,8 @@ export interface SiteImportReplayOptions {
46
58
  words?: AiSiteImportWords;
47
59
  /** Recorded rewrites of its lines (lane G): the page is built in them, and scored against the words as its source wrote them. */
48
60
  wording?: readonly SiteImportReplayRewrite[];
61
+ /** The site's design seed; absent, one kept the same in every report. */
62
+ seed?: number;
49
63
  }
50
64
  /**
51
65
  * A recorded page built and checked as the page step stores it (AGL-4109):
@@ -59,7 +73,9 @@ export interface SiteImportReplayOptions {
59
73
  * `wording` builds it in recorded rewrites of its lines, while its source
60
74
  * keeps the words as written.
61
75
  */
62
- export declare function siteImportReplayPage(name: SiteLayoutPageName, options?: SiteImportReplayOptions): SiteImportReplayPage;
76
+ export declare function siteImportReplayPage(name: SiteImportReplayName, options?: SiteImportReplayOptions): SiteImportReplayPage;
77
+ /** A page's read built and checked as the page step stores it: `siteImportReplayPage`, for any read (AGL-4152). */
78
+ export declare function siteImportReplayBuild(read: SiteImportReplayRead, slug: string, home: boolean, options?: SiteImportReplayOptions): SiteImportReplayPage;
63
79
  /**
64
80
  * The theme a recorded page is drawn in (AGL-4152): no site stores one, so
65
81
  * it is computed as the look pass draws it, from the page's own look facts
@@ -67,7 +83,32 @@ export declare function siteImportReplayPage(name: SiteLayoutPageName, options?:
67
83
  * default theme, and is marked as computed from the site style. `finish` is handed to the
68
84
  * look's style as the pass hands it, for the pass that reads it.
69
85
  */
70
- export declare function siteImportReplayTheme(name: SiteLayoutPageName, finish?: AiSiteImportFinish): SiteImportFidelityTheme | null;
86
+ export declare function siteImportReplayTheme(name: SiteImportReplayName, finish?: AiSiteImportFinish, options?: {
87
+ generative?: boolean;
88
+ }): SiteImportFidelityTheme | null;
89
+ /**
90
+ * A site's design seed whose bands run on one ground (AGL-4152), as the 11/5
91
+ * Improve it test drew its pages: what today's build leaves of a page's rhythm
92
+ * on such a site, whatever its answer asks.
93
+ */
94
+ export declare function siteImportReplayOneGroundSeed(): number;
95
+ /** A basic site's page as a recorded `submit_improved_page` answer draws it (AGL-4152), with what the code that keeps it reads. */
96
+ export interface SiteImportReplayImproved extends SiteImportReplayPage {
97
+ page: AiSiteImportImprovedPage;
98
+ /** Every line the facts may come from. */
99
+ scope: string[];
100
+ /** Every destination the source's links have here. */
101
+ destinations: string[];
102
+ }
103
+ /**
104
+ * A recorded redesign built as the page step builds it (AGL-4152): its answer
105
+ * read, its `keep`s expanded, compiled, stored and checked; no model. `design`
106
+ * is the site the page is drawn for; a basic site has one form.
107
+ */
108
+ export declare function siteImportReplayImproved(name: SiteImportReplayName, answer: unknown, options?: {
109
+ seed?: number;
110
+ theme?: SiteImportFidelityTheme | null;
111
+ }): SiteImportReplayImproved;
71
112
  /**
72
113
  * The design answer recorded for aglyn.com's Home, in the tool's shape: a
73
114
  * split hero, ruled cards, a dark band asked where the source drew its own
@@ -83,7 +124,13 @@ export declare const SITE_IMPORT_REPLAY_HOME_ANSWER: Readonly<Record<string, unk
83
124
  */
84
125
  export declare const SITE_IMPORT_REPLAY_HOME_ANSWER_1105: Readonly<Record<string, unknown>>;
85
126
  /** The recorded home pages a header and footer is drawn from. */
86
- export type SiteImportReplayHome = Extract<SiteLayoutPageName, 'home' | 'pottery'>;
127
+ export type SiteImportReplayHome = Extract<SiteLayoutPageName, 'home' | 'pottery'> | SiteBasicPageName;
128
+ /**
129
+ * A recorded site as a generative Improve it's plan reads it (AGL-4152): its
130
+ * first wave read, its home page with its blocks and layout, and each page its
131
+ * menu names, its title the menu's label: what the plan may organize.
132
+ */
133
+ export declare function siteImportReplayPlanState(name: SiteImportReplayHome): AiSiteImportState;
87
134
  /** A recorded home page's header and footer as the frame step draws them: the source's menu and footer, the stored nodes, the check's word. */
88
135
  export interface SiteImportReplayFrame {
89
136
  nav: SiteImportNavTree | null;
@@ -92,4 +139,7 @@ export interface SiteImportReplayFrame {
92
139
  violations: unknown[];
93
140
  }
94
141
  /** A recorded home page's header and footer, drawn with no model as the layout step stores them (AGL-4108). */
95
- export declare function siteImportReplayFrame(name: SiteImportReplayHome): SiteImportReplayFrame;
142
+ export declare function siteImportReplayFrame(name: SiteImportReplayHome, options?: {
143
+ generative?: boolean;
144
+ plan?: AiSiteImportPlan;
145
+ }): SiteImportReplayFrame;
@@ -26,12 +26,14 @@ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_wi
26
26
  * answers.
27
27
  */ import { DEFAULT_SITE_THEME } from "@aglyn/aglyn/app-utils/default-site";
28
28
  import { aiImportedPageCheck } from "../../jobs/ai-job-page-language.js";
29
+ import { aiReadImprovedPage, aiSiteImportImproveDestinations, aiSiteImportImproveLedger, aiSiteImportImproveScope, aiSiteImportImprovedPage } from "../../jobs/ai-site-import-improve.js";
29
30
  import { aiSiteImportFrameJob, aiSiteImportHomeOf } from "../../jobs/ai-job-import-step.js";
30
31
  import { aiLayoutSiteBrandOf, aiLayoutSiteFrameOf, aiLayoutSourceFrameBuild } from "../../jobs/ai-job-layout-language.js";
31
32
  import { aiLayoutChecks } from "../../jobs/ai-job-layout-step.js";
32
33
  import { aiSiteImportSectionNames } from "../../jobs/ai-site-import-compile.js";
33
34
  import { AI_LAYOUT_IMPORTED_SECTIONS_INPUT, aiSiteImportDocumentOf } from "../../jobs/ai-site-import-document.js";
34
35
  import { aiSiteImportStyle } from "../../jobs/ai-site-import-look.js";
36
+ import { aiLayoutDesignChoices } from "../../layout-language/ai-layout-design.js";
35
37
  import { aiSiteImportLedger } from "../../model/ai-site-import.js";
36
38
  import { siteImportFidelityThemeOf } from "../../model/ai-site-import-fidelity.js";
37
39
  import { aiSiteTheme } from "../../model/ai-site-look.js";
@@ -40,7 +42,27 @@ import { extractSiteImportPage } from "../site-import-html.js";
40
42
  import { siteImportLayout, siteImportLookOf } from "../site-import-layout.js";
41
43
  import { siteImportFooterColumns, siteImportNavTree } from "../site-import-nav.js";
42
44
  import { siteImportPageRead } from "../site-import-page.js";
43
- import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./site-layout-recordings.js";
45
+ import { SITE_BASIC_PAGES, SITE_LAYOUT_PAGES, siteBasicRecording, siteLayoutRecording, siteLayoutSameSite } from "./site-layout-recordings.js";
46
+ const isBasic = (name)=>name in SITE_BASIC_PAGES;
47
+ /** A page's address, its markup and its stylesheet, and whether an address is its own site's. */ function recordingOf(name) {
48
+ if (!isBasic(name)) return {
49
+ url: SITE_LAYOUT_PAGES[name].url,
50
+ html: siteLayoutRecording(name),
51
+ sheets: [],
52
+ same: siteLayoutSameSite(name)
53
+ };
54
+ const { url } = SITE_BASIC_PAGES[name];
55
+ const { html, css } = siteBasicRecording(name);
56
+ const origin = new URL(url).origin;
57
+ return {
58
+ url,
59
+ html,
60
+ sheets: [
61
+ css
62
+ ],
63
+ same: (address)=>address.origin === origin
64
+ };
65
+ }
44
66
  /** The page's same-site addresses, each a page the import plans: every page a link may go to. */ function plannedLinks(blocks, origin) {
45
67
  const paths = new Set();
46
68
  for (const block of blocks){
@@ -61,13 +83,17 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
61
83
  }));
62
84
  }
63
85
  /** A recorded page as a wave's read keeps it and the import step hands it on: its blocks, its layout, its photos in the library. */ export function siteImportReplayDocument(name) {
86
+ const { url, html, sheets, same } = recordingOf(name);
87
+ return siteImportReplayDocumentOf(html, url, same, sheets);
88
+ }
89
+ /** Any page as a wave's read keeps it, read through its stylesheets (AGL-4152). */ export function siteImportReplayDocumentOf(html, url, sameSite, stylesheets = []) {
64
90
  var _read_blocks;
65
91
  var _read_videos;
66
- const { url } = SITE_LAYOUT_PAGES[name];
67
- const page = extractSiteImportPage(siteLayoutRecording(name), url, siteLayoutSameSite(name), {
68
- structure: true
92
+ const page = extractSiteImportPage(html, url, sameSite, {
93
+ structure: true,
94
+ stylesheets
69
95
  });
70
- const layout = siteImportLayout(page);
96
+ const layout = siteImportLayout(page, stylesheets);
71
97
  const path = new URL(url).pathname;
72
98
  const read = siteImportPageRead(_extends({}, page, {
73
99
  layout,
@@ -104,6 +130,8 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
104
130
  layout: read.layout
105
131
  } : {}, ((_read_videos = read.videos) == null ? void 0 : _read_videos.length) ? {
106
132
  videos: read.videos
133
+ } : {}, read.concealed ? {
134
+ concealed: read.concealed
107
135
  } : {});
108
136
  }
109
137
  /**
@@ -118,9 +146,11 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
118
146
  * `wording` builds it in recorded rewrites of its lines, while its source
119
147
  * keeps the words as written.
120
148
  */ export function siteImportReplayPage(name, options = {}) {
121
- var _options_wording, _options_forms, _options_answer, _ref;
149
+ return siteImportReplayBuild(siteImportReplayDocument(name), name === 'home' ? '/' : `/${name}`, name === 'home', options);
150
+ }
151
+ /** A page's read built and checked as the page step stores it: `siteImportReplayPage`, for any read (AGL-4152). */ export function siteImportReplayBuild(read, slug, home, options = {}) {
152
+ var _options_wording, _options_forms, _options_seed, _options_answer, _ref;
122
153
  var _result_value;
123
- const read = siteImportReplayDocument(name);
124
154
  const { layout } = read, rest = _object_without_properties_loose(read, [
125
155
  "layout"
126
156
  ]);
@@ -147,7 +177,7 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
147
177
  const sectionIds = names.map((_, index)=>`sec-${index}`);
148
178
  const screen = {
149
179
  title: doc.title,
150
- slug: name === 'home' ? '/' : `/${name}`,
180
+ slug,
151
181
  sections: names.map((section)=>({
152
182
  name: section,
153
183
  uses: [],
@@ -176,8 +206,8 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
176
206
  },
177
207
  design: {
178
208
  kind: 'business',
179
- seed: 7,
180
- home: name === 'home'
209
+ seed: (_options_seed = options.seed) != null ? _options_seed : 7,
210
+ home
181
211
  },
182
212
  doc
183
213
  });
@@ -185,11 +215,13 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
185
215
  const nodes = (_ref = (_result_value = result.value) == null ? void 0 : _result_value.nodes) != null ? _ref : {};
186
216
  return {
187
217
  doc,
188
- source: {
218
+ source: _extends({
189
219
  layout: layout,
190
220
  blocks: read.blocks,
191
221
  photos: read.photos
192
- },
222
+ }, read.concealed ? {
223
+ concealed: read.concealed
224
+ } : {}),
193
225
  tree: {
194
226
  rootId: '_@_',
195
227
  nodes
@@ -203,7 +235,7 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
203
235
  * with the import's seed and no inspiration site, over the platform's
204
236
  * default theme, and is marked as computed from the site style. `finish` is handed to the
205
237
  * look's style as the pass hands it, for the pass that reads it.
206
- */ export function siteImportReplayTheme(name, finish) {
238
+ */ export function siteImportReplayTheme(name, finish, options = {}) {
207
239
  var _ref;
208
240
  var _read_layout;
209
241
  const read = siteImportReplayDocument(name);
@@ -213,10 +245,126 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
213
245
  facts: (_ref = (_read_layout = read.layout) == null ? void 0 : _read_layout.look) != null ? _ref : null
214
246
  }, finish ? {
215
247
  finish
248
+ } : {}, options.generative ? {
249
+ generative: true
216
250
  } : {});
217
251
  const style = aiSiteImportStyle(null, input);
218
252
  return style ? siteImportFidelityThemeOf(aiSiteTheme(style, DEFAULT_SITE_THEME), 'style') : null;
219
253
  }
254
+ /**
255
+ * A site's design seed whose bands run on one ground (AGL-4152), as the 11/5
256
+ * Improve it test drew its pages: what today's build leaves of a page's rhythm
257
+ * on such a site, whatever its answer asks.
258
+ */ export function siteImportReplayOneGroundSeed() {
259
+ for(let seed = 1; seed < 1000; seed += 1){
260
+ if (aiLayoutDesignChoices({
261
+ kind: 'business',
262
+ seed,
263
+ home: true
264
+ }).bandRhythm === 'plain') return seed;
265
+ }
266
+ throw new Error('no seed draws one ground');
267
+ }
268
+ /** The forms the basic sites hold a saved form for. */ const BASIC_FORMS = [
269
+ {
270
+ id: 'form-basic',
271
+ name: 'Contact'
272
+ }
273
+ ];
274
+ /**
275
+ * A recorded redesign built as the page step builds it (AGL-4152): its answer
276
+ * read, its `keep`s expanded, compiled, stored and checked; no model. `design`
277
+ * is the site the page is drawn for; a basic site has one form.
278
+ */ export function siteImportReplayImproved(name, answer, options = {}) {
279
+ var _options_seed, _ref, _options_theme, _ref1;
280
+ var _forms_, _result_value;
281
+ const read = siteImportReplayDocument(name);
282
+ const forms = BASIC_FORMS;
283
+ const doc = _extends({}, read, {
284
+ finish: 'improve',
285
+ wording: 'improved',
286
+ generative: true
287
+ });
288
+ const ledger = aiSiteImportImproveLedger(doc);
289
+ const given = aiReadImprovedPage(answer);
290
+ if (!given) throw new Error(`the recorded answer for ${name} has no section`);
291
+ const formAt = given.findIndex((section)=>section.blocks.some((block)=>block.kind === 'keep' && block.ref.startsWith('form:')));
292
+ const destinations = aiSiteImportImproveDestinations(doc, ledger, {
293
+ sections: given.length,
294
+ formSection: formAt === -1 ? null : formAt
295
+ });
296
+ const design = {
297
+ kind: 'business',
298
+ seed: (_options_seed = options.seed) != null ? _options_seed : 7,
299
+ home: true
300
+ };
301
+ const page = aiSiteImportImprovedPage(given, {
302
+ doc,
303
+ ledger,
304
+ design,
305
+ destinations,
306
+ formId: (_ref = (_forms_ = forms[0]) == null ? void 0 : _forms_.id) != null ? _ref : null,
307
+ theme: (_options_theme = options.theme) != null ? _options_theme : null
308
+ });
309
+ const sectionIds = page.names.map((_, index)=>`sec-${index}`);
310
+ const screen = {
311
+ title: doc.title,
312
+ slug: '/',
313
+ sections: page.names.map((section)=>({
314
+ name: section,
315
+ uses: [],
316
+ items: 0
317
+ }))
318
+ };
319
+ const targets = {
320
+ pageId: 'p0',
321
+ pages: [],
322
+ homeIds: [],
323
+ forms,
324
+ formPageId: null,
325
+ components: [],
326
+ facts: ''
327
+ };
328
+ const result = aiImportedPageCheck({
329
+ screen: screen,
330
+ sectionIds,
331
+ targets: targets,
332
+ context: {
333
+ screenIds: doc.links.map((link)=>link.id),
334
+ formIds: forms.map((form)=>form.id),
335
+ componentIds: [],
336
+ codeBuilt: true
337
+ },
338
+ design,
339
+ doc,
340
+ given: page.given,
341
+ rewritten: page.written
342
+ })(null);
343
+ const nodes = (_ref1 = (_result_value = result.value) == null ? void 0 : _result_value.nodes) != null ? _ref1 : {};
344
+ return {
345
+ doc,
346
+ source: {
347
+ layout: read.layout,
348
+ blocks: read.blocks,
349
+ photos: read.photos
350
+ },
351
+ tree: {
352
+ rootId: '_@_',
353
+ nodes
354
+ },
355
+ violations: result.violations,
356
+ page,
357
+ scope: aiSiteImportImproveScope(doc, null),
358
+ destinations: [
359
+ ...new Set(ledger.links.flatMap((link)=>{
360
+ const to = destinations.get(link.ref);
361
+ return to ? [
362
+ to
363
+ ] : [];
364
+ }))
365
+ ]
366
+ };
367
+ }
220
368
  /**
221
369
  * The design answer recorded for aglyn.com's Home, in the tool's shape: a
222
370
  * split hero, ruled cards, a dark band asked where the source drew its own
@@ -277,8 +425,8 @@ import { SITE_LAYOUT_PAGES, siteLayoutRecording, siteLayoutSameSite } from "./si
277
425
  };
278
426
  const NOW = new Date('2026-10-29T18:00:00.000Z');
279
427
  /** A recorded home page as the crawl keeps it: its menu, footer and look read as the source builds them. */ function crawledHome(name) {
280
- const { url } = SITE_LAYOUT_PAGES[name];
281
- const extract = extractSiteImportPage(siteLayoutRecording(name), url, siteLayoutSameSite(name), {
428
+ const { url, html, sheets, same } = recordingOf(name);
429
+ const extract = extractSiteImportPage(html, url, same, {
282
430
  structure: true
283
431
  });
284
432
  const source = extract;
@@ -291,17 +439,19 @@ const NOW = new Date('2026-10-29T18:00:00.000Z');
291
439
  path: '/',
292
440
  foundBy: 'home',
293
441
  bytes: 0,
294
- nav: siteImportNavTree(source),
295
- footer: siteImportFooterColumns(source),
296
- look: siteImportLookOf(source)
442
+ nav: siteImportNavTree(source, sheets),
443
+ footer: siteImportFooterColumns(source, sheets),
444
+ look: siteImportLookOf(source, sheets)
297
445
  });
298
446
  }
299
447
  /** A site planned for its first wave: Home, and two pages of its own. */ function replayState(name) {
300
- const origin = new URL(SITE_LAYOUT_PAGES[name].url).origin;
448
+ const origin = new URL(recordingOf(name).url).origin;
301
449
  const paths = name === 'home' ? [
302
450
  '/',
303
451
  '/product',
304
452
  '/pricing'
453
+ ] : isBasic(name) ? [
454
+ '/'
305
455
  ] : [
306
456
  '/',
307
457
  '/classes',
@@ -383,6 +533,104 @@ const NOW = new Date('2026-10-29T18:00:00.000Z');
383
533
  }
384
534
  };
385
535
  }
536
+ /**
537
+ * A recorded site as a generative Improve it's plan reads it (AGL-4152): its
538
+ * first wave read, its home page with its blocks and layout, and each page its
539
+ * menu names, its title the menu's label: what the plan may organize.
540
+ */ export function siteImportReplayPlanState(name) {
541
+ var _ref, _doc_layout;
542
+ var _base_home_nav, _base_home;
543
+ const base = replayState(name);
544
+ const doc = siteImportReplayDocument(name);
545
+ const origin = new URL(doc.url).origin;
546
+ const home = base.pages[0];
547
+ const paths = new Set(base.pages.map((page)=>page.path));
548
+ const listed = ((_ref = (_base_home = base.home) == null ? void 0 : (_base_home_nav = _base_home.nav) == null ? void 0 : _base_home_nav.items) != null ? _ref : []).flatMap((group)=>[
549
+ {
550
+ label: group.label,
551
+ href: group.href
552
+ },
553
+ ...group.items.map((entry)=>({
554
+ label: entry.label,
555
+ href: entry.href
556
+ }))
557
+ ]);
558
+ const pages = [
559
+ _extends({}, home, {
560
+ title: doc.title,
561
+ build: 'arranged',
562
+ wording: 'improved',
563
+ read: {
564
+ at: NOW.toISOString(),
565
+ title: doc.title,
566
+ text: '',
567
+ sections: [],
568
+ images: [],
569
+ blocks: doc.blocks,
570
+ words: 300,
571
+ forms: [],
572
+ layout: (_doc_layout = doc.layout) != null ? _doc_layout : null
573
+ }
574
+ })
575
+ ];
576
+ for (const entry of listed){
577
+ let path = '';
578
+ try {
579
+ var _entry_href;
580
+ const url = new URL((_entry_href = entry.href) != null ? _entry_href : '');
581
+ path = url.origin === origin ? url.pathname.replace(/\/+$/, '') || '/' : '';
582
+ } catch (unused) {
583
+ continue;
584
+ }
585
+ if (!path || path === '/' || paths.has(path) && pages.some((page)=>page.path === path)) continue;
586
+ paths.add(path);
587
+ const at = pages.length;
588
+ pages.push({
589
+ slot: `p${at}`,
590
+ url: `${origin}${path}`,
591
+ path,
592
+ title: entry.label,
593
+ group: 'main',
594
+ wave: 1,
595
+ draftId: `draft${at}`,
596
+ slug: path.split('/').filter(Boolean).join('-'),
597
+ words: 300,
598
+ images: 0,
599
+ build: 'arranged',
600
+ wording: 'improved',
601
+ read: {
602
+ at: NOW.toISOString(),
603
+ title: entry.label,
604
+ text: '',
605
+ sections: [],
606
+ images: [],
607
+ blocks: [
608
+ {
609
+ kind: 'heading',
610
+ level: 1,
611
+ text: entry.label,
612
+ region: 'main'
613
+ }
614
+ ],
615
+ words: 300,
616
+ forms: [],
617
+ layout: null
618
+ }
619
+ });
620
+ }
621
+ return _extends({}, base, {
622
+ pages,
623
+ finish: 'improve',
624
+ wording: true,
625
+ generative: true,
626
+ waves: base.waves.map((wave)=>_extends({}, wave, {
627
+ slots: pages.map((page)=>page.slot),
628
+ finish: 'improve',
629
+ wording: true,
630
+ generative: true
631
+ }))
632
+ });
633
+ }
386
634
  /** The pictures a home page's menus show, each once: what the look pass brings in. */ function siteImportMenuPictures(home) {
387
635
  var _ref;
388
636
  var _home_nav;
@@ -396,10 +644,18 @@ const NOW = new Date('2026-10-29T18:00:00.000Z');
396
644
  ...new Set(urls)
397
645
  ];
398
646
  }
399
- /** A recorded home page's header and footer, drawn with no model as the layout step stores them (AGL-4108). */ export function siteImportReplayFrame(name) {
647
+ /** A recorded home page's header and footer, drawn with no model as the layout step stores them (AGL-4108). */ export function siteImportReplayFrame(name, options = {}) {
400
648
  var _frameJob_plan, _ref, _ref1, _ref2, _ref3;
401
649
  var _frameJob_inputs, _state_home, _built_value, _state_home1, _state_home2;
402
- const state = replayState(name);
650
+ const base = options.plan ? _extends({}, siteImportReplayPlanState(name), {
651
+ plan: options.plan,
652
+ planAccepted: true
653
+ }) : replayState(name);
654
+ const state = options.generative ? _extends({}, base, {
655
+ waves: base.waves.map((wave)=>_extends({}, wave, {
656
+ generative: true
657
+ }))
658
+ }) : base;
403
659
  const job = {
404
660
  $id: 'importJob',
405
661
  orgId: 'org-replay',