@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
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-view.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 * BRING MY SITE, AS THE CONSOLE SHOWS IT (AGL-3976).\n *\n * Pure: what the \"Create site\" choice card says before anyone clicks, and\n * what an import job's page shows in each of its states — the site read and\n * its waves planned, a wave running, a wave in for review, a wave held for a\n * proof or the day's limit, the import done. The components draw these; the\n * specs hold them.\n *=========================================*/\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { aiCreditRangeText } from './ai-credit-estimate'\nimport type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportChoiceOf,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveChoice,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveOwed,\n aiSiteImportWordingCredits,\n aiSiteImportWordingPages,\n type AiSiteImportChoice,\n type AiSiteImportFinish,\n type AiSiteImportLeftOutReason,\n type AiSiteImportPage,\n type AiSiteImportState,\n type AiSiteImportWave,\n} from './ai-site-import'\n\n/** A domain ownership claim, as the ownership door answers it. */\nexport interface AiSiteImportClaim {\n domain: string\n status: 'pending' | 'proven'\n current: boolean\n provenMethod: 'dns' | 'meta' | 'email' | null\n provenAt: number | null\n provenDetail: string | null\n lastChecks: Partial<Record<'dns' | 'meta' | 'email', 'proven' | 'not-yet' | 'unreachable'>>\n dns: { host: string; type: 'TXT'; value: string }\n meta: { name: string; content: string; tag: string }\n email: { domain: string; pendingAddress: string | null; expiresAt: number | null; attemptsLeft: number | null }\n}\n\n/** Whether \"Bring my site\" is offered here, and if not why. */\nexport type AiSiteImportAvailability =\n | { state: 'checking' }\n /** The release flag is off, or the doors cannot be reached: the card is not drawn. */\n | { state: 'hidden' }\n /** Something the workspace can change stands in the way: the card is drawn disabled, with the reason. */\n | { state: 'blocked'; reason: 'plan' | 'role'; message: string }\n | { state: 'ready'; claims: AiSiteImportClaim[] }\n\n/** What the card says to a plan that does not include it. */\nexport const AI_SITE_IMPORT_PLAN_COPY =\n 'Bring your current website in, every page and photo, on any paid plan. Upgrade to bring yours in.'\n\n/** What the card says to a member who cannot. */\nexport const AI_SITE_IMPORT_ROLE_COPY = 'Only the workspace owner or an admin can bring a site in.'\n\n/**\n * The jobs list's `siteImport` offer (AGL-3976), as the card's state: absent\n * is the flag off, and the card is not drawn; `plan` and `role` are drawn\n * disabled with the reason.\n */\nexport function aiSiteImportOfferOf(offer: unknown): AiSiteImportAvailability {\n if (offer === 'ready') return { state: 'ready', claims: [] }\n if (offer === 'plan') return { state: 'blocked', reason: 'plan', message: AI_SITE_IMPORT_PLAN_COPY }\n if (offer === 'role') return { state: 'blocked', reason: 'role', message: AI_SITE_IMPORT_ROLE_COPY }\n return { state: 'hidden' }\n}\n\n/** Where an import job's page is. */\nexport type AiSiteImportPhase =\n /** The site is being read. */\n | 'reading'\n /** Read and planned; the first wave waits to be started. */\n | 'ready'\n /** A wave was started and has not begun yet. */\n | 'starting'\n | 'running'\n /** A wave is in; the next waits to be started. */\n | 'review'\n /** Held for something the person does: verify again, wait for tomorrow, read again. */\n | 'held'\n /** Out of AI credits or at a cap: the meter's pause, carried on by Resume. */\n | 'paused'\n | 'done'\n | 'stopped'\n\nexport function aiSiteImportPhaseOf(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): AiSiteImportPhase {\n const state = job.siteImport ?? null\n // A read that stopped at its home page is held, and its Check again reads again (AGL-4083).\n const stopped = aiSiteImportReadStops(state?.verdict)\n if (job.status === 'done') return 'done'\n if (job.status === 'failed' || job.status === 'canceled') return 'stopped'\n if (job.status === 'needs_input') return 'paused'\n if (job.status === 'needs_review') {\n if (job.review?.reason !== 'wave' || !state || stopped) return 'held'\n return aiSiteImportReviewWave(state) ? 'review' : 'ready'\n }\n if (!state || stopped) return 'reading'\n return aiSiteImportRunningWave(state) ? 'running' : 'starting'\n}\n\n/**\n * How a hold that is the site's to fix reads (AGL-4083): its heading, its\n * sentence and its button. A home page bot protection turned away, or one\n * that could not be read, is checked again for free; `null` for any other\n * hold, which keeps its own words.\n */\nexport function aiSiteImportHeldCopy(\n job: Pick<AiJobSummary, 'review' | 'siteImport'>,\n): { heading: string; message: string; action: string } | null {\n const state = job.siteImport ?? null\n const fromState = aiSiteImportReadStops(state?.verdict) ? aiSiteImportReadVerdictReason(state?.verdict) : null\n const reason = job.review?.reason === 'blocked' || job.review?.reason === 'unreadable' ? job.review.reason : fromState\n if (!reason) return null\n const message =\n (fromState && state ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null) ?? job.review?.message ?? ''\n return {\n heading: reason === 'blocked' ? 'AglynBot was turned away' : 'Your home page could not be read',\n message,\n action: 'Check again',\n }\n}\n\n/**\n * Why an import that had started is waiting with no wave to review (AGL-4083):\n * the sentence its stop left, which says what is not in yet and what to start.\n * `null` for one that has not started, and one waiting for its review.\n */\nexport function aiSiteImportStoppedCopy(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): string | null {\n const state = job.siteImport ?? null\n if (aiSiteImportPhaseOf(job) !== 'ready' || !state?.waves.some((wave) => wave.startedAt)) return null\n return job.review?.message || null\n}\n\nexport type AiSiteImportRowState = 'waiting' | 'active' | 'done' | 'failed' | 'skipped'\n\nexport interface AiSiteImportRowView {\n slot: string\n title: string\n /** Where it is on the old site. */\n from: string\n /** Where it is on the new one. */\n to: string\n state: AiSiteImportRowState\n /** Why it failed or was left out, or what the person should know. */\n note: string | null\n /** \"3 photos added, 1 already in your library\". */\n photos: string | null\n /** The draft the row wrote, by its output id. */\n outputId: string | null\n /** The page on the old site, to open beside the draft (AGL-4083). */\n oldPage: string\n /** \"1,204 of 1,310 words\", once the page is in and the step has counted them. */\n words: string | null\n /**\n * \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen;\n * \"Arranged and reworded by Aglyn AI\" once its wave improved its words, and\n * \"Arranged by Aglyn AI · Words kept\" for a policy page on such a wave (AGL-4152).\n */\n build: string | null\n}\n\nfunction rowState(row: AiJobItemLedger | undefined, active: boolean): AiSiteImportRowState {\n if (!row) return 'waiting'\n if (row.status === 'succeeded' || row.status === 'degraded') return 'done'\n if (row.status === 'failed') return 'failed'\n if (row.status === 'skipped') return 'skipped'\n return active ? 'active' : 'waiting'\n}\n\n/**\n * \"3 photos added\", \"2 photos added, 1 already in your media library\"; with\n * photos that could not come in, against all it tried: \"3 of 5 photos: 2\n * added, 1 already in your media library, 2 could not be brought in\".\n */\nexport function aiSiteImportPhotosText(\n photos: { brought: number; reused: number; skipped?: number } | null | undefined,\n): string | null {\n if (!photos) return null\n const skipped = Math.max(0, photos.skipped ?? 0)\n const into = photos.brought + photos.reused\n if (into === 0 && skipped === 0) return null\n if (!skipped) {\n const added = photos.brought ? `${photos.brought} ${photos.brought === 1 ? 'photo' : 'photos'} added` : ''\n const reused = photos.reused ? `${photos.reused} already in your media library` : ''\n return [added, reused].filter(Boolean).join(', ')\n }\n const parts = [\n photos.brought ? `${photos.brought} added` : '',\n photos.reused ? `${photos.reused} already in your media library` : '',\n `${skipped} could not be brought in`,\n ].filter(Boolean)\n const tried = into + skipped\n return `${into} of ${tried} ${tried === 1 ? 'photo' : 'photos'}: ${parts.join(', ')}`\n}\n\nconst BUILD_COPY = {\n copied: 'Copied as it is',\n arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page whose wording was improved (AGL-4152). */\n reworded: `Arranged and reworded by ${PLATFORM_BRAND_NAME} AI`,\n /** A policy page on a wave that improved the wording of the rest: it keeps every word. */\n wordsKept: `Arranged by ${PLATFORM_BRAND_NAME} AI · Words kept`,\n} as const\n\n/** A page's build as its row says it, with whether its words were improved where its wave improved wording (AGL-4152). */\nfunction buildCopy(page: AiSiteImportPage, choice: AiSiteImportChoice): string | null {\n if (!page.build) return null\n if (page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.reworded\n if (page.build === 'arranged' && page.wording === 'kept' && choice.wording) return BUILD_COPY.wordsKept\n return BUILD_COPY[page.build]\n}\n\n/** What the row of a page whose words were improved says in place of its word count (AGL-4152). */\nexport const AI_SITE_IMPORT_REWORDED_WORDS = 'Every fact kept'\n\n/** One wave's rows, the header and footer first where the wave builds them. */\nexport function aiSiteImportWaveRows(\n job: Pick<AiJobSummary, 'items' | 'siteImport' | 'status'>,\n wave: AiSiteImportWave,\n): AiSiteImportRowView[] {\n const state = job.siteImport as AiSiteImportState\n const items = new Map((job.items ?? []).map((row) => [row.slot, row]))\n const running = wave.status === 'running' && (job.status === 'running' || job.status === 'queued')\n let activeTaken = false\n const active = (row: AiJobItemLedger | undefined) => {\n if (!running || activeTaken || !row || (row.status !== 'pending' && row.status !== 'running')) return false\n activeTaken = true\n return true\n }\n const rows: AiSiteImportRowView[] = []\n const choice = aiSiteImportWaveChoice(state, wave)\n if (wave.frame && state.frame) {\n const row = items.get(AI_SITE_IMPORT_FRAME_SLOT)\n rows.push({\n slot: AI_SITE_IMPORT_FRAME_SLOT,\n title: 'Header and footer',\n from: `Your menu on ${state.domain}`,\n to: 'Every page',\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? null,\n photos: null,\n outputId: row?.outputs[0] ?? null,\n oldPage: `https://${state.domain}/`,\n words: null,\n build: null,\n })\n }\n for (const slot of wave.slots) {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page) continue\n const row = items.get(slot)\n rows.push({\n slot,\n title: page.title,\n from: page.path,\n to: page.slug === '/' ? '/' : `/${page.slug}`,\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? (page.refused ? AI_SITE_IMPORT_LEFT_OUT_COPY[page.refused] : null),\n photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n // Beside the old page's own words, its main region's as the wave read them: its menu and footer are the site's (AGL-4084).\n // A page whose words were improved keeps its facts, not its count (AGL-4152).\n words: page.brought\n ? page.wording === 'improved'\n ? AI_SITE_IMPORT_REWORDED_WORDS\n : `${page.brought.words.toLocaleString('en-US')} of ${(page.read?.words ?? page.words).toLocaleString('en-US')} words`\n : null,\n build: buildCopy(page, choice),\n })\n }\n return rows\n}\n\n/**\n * \"About 189 credits (up to 650)\" for the wave, as it stands; once the step\n * has chosen how its pages are built, it names them: \"…: 7 pages arranged by\n * Aglyn AI, 3 copied as they are\" (AGL-4083).\n */\nexport function aiSiteImportWaveQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, wave: AiSiteImportWave): string {\n const state = job.siteImport as AiSiteImportState\n const range = aiSiteImportWaveCreditRange(state, wave, job.items ?? null)\n return aiSiteImportQuoteText(range, aiSiteImportWaveOwed(state, wave, job.items ?? null))\n}\n\n/** What a wave cost, its pages' credits less what was given back. */\nexport function aiSiteImportWaveSpent(job: Pick<AiJobSummary, 'items'>, wave: AiSiteImportWave): number {\n const slots = new Set([...wave.slots, ...(wave.frame ? [AI_SITE_IMPORT_FRAME_SLOT] : [])])\n return (job.items ?? [])\n .filter((row) => slots.has(row.slot))\n .reduce((total, row) => total + Math.max(0, (row.creditsSpent ?? 0) - (row.creditsRefunded ?? 0)), 0)\n}\n\n/** Pages the site has that AglynBot could not read: turned away, unanswered, too large or never reached. */\nexport function aiSiteImportUnreadCount(state: AiSiteImportState): number {\n return AI_SITE_IMPORT_UNREAD_REASONS.reduce((total, reason) => total + (state.leftOutCount[reason] ?? 0), 0)\n}\n\n/**\n * The read site in one sentence: \"Found 21 pages on harbor-dental.com: Main\n * pages (6) and Blog (14).\" — and how many more could not be read (AGL-4083).\n */\nexport function aiSiteImportFoundText(state: AiSiteImportState): string {\n const groups = state.groups.map((group) => `${group.label} (${group.pages})`)\n const listed =\n groups.length <= 1 ? groups.join('') : `${groups.slice(0, -1).join(', ')} and ${groups[groups.length - 1]}`\n const found = `Found ${aiSiteImportPagesText(state.found)} on ${state.domain}`\n const lead = listed ? `${found}: ${listed}.` : `${found}.`\n const unread = aiSiteImportUnreadCount(state)\n return unread ? `${lead} ${unread.toLocaleString('en-US')} more could not be read; see Not brought in.` : lead\n}\n\n/** Why the read stopped short, when it did and left pages unread (AGL-4083). */\nexport function aiSiteImportStopText(state: AiSiteImportState): string | null {\n const unreached = state.leftOutCount['not-reached'] ?? 0\n if (!unreached) return null\n const first = `Only the first ${aiSiteImportPagesText(state.found)}`\n const rest = 'the rest are listed under Not brought in as not reached.'\n switch (state.stoppedBy) {\n case 'time':\n return `${first} could be read in the time allowed; ${rest}`\n case 'total-bytes':\n return `${first} could be read before the read reached its size limit; ${rest}`\n default:\n return `${first} could be read this time; ${rest}`\n }\n}\n\n/** The read's warning when most of the site was turned away though its home page came in (AGL-4083). */\nexport function aiSiteImportVerdictNote(state: AiSiteImportState): string | null {\n return state.verdict?.kind === 'mostly-blocked' ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null\n}\n\n/** The plan's page count against the site: \"Your plan includes 25 pages and this site has 0, so 20 are brought in.\" */\nexport function aiSiteImportPlanText(state: AiSiteImportState): string {\n const kept = state.pages.length\n const waves = state.waves.length\n const plan =\n state.pageLimit === null\n ? 'Your plan has no page limit'\n : `Your plan includes ${aiSiteImportPagesText(state.pageLimit)} and this site has ${state.existingPages}`\n const lead = `${plan}, so ${aiSiteImportPagesText(kept)} ${kept === 1 ? 'is' : 'are'} brought in, in ${waves === 1 ? 'one wave' : `${waves} waves`}.`\n const stop = aiSiteImportStopText(state)\n return stop ? `${lead} ${stop}` : lead\n}\n\n/** What was left out, by reason, most first. */\nexport function aiSiteImportLeftOutLines(state: AiSiteImportState): Array<{ reason: AiSiteImportLeftOutReason; count: number; text: string; paths: string[] }> {\n return AI_SITE_IMPORT_LEFT_OUT_REASONS.map((reason) => ({\n reason,\n count: state.leftOutCount[reason] ?? 0,\n text: AI_SITE_IMPORT_LEFT_OUT_COPY[reason],\n paths: state.leftOut.filter((entry) => entry.reason === reason).map((entry) => entry.path),\n }))\n .filter((line) => line.count > 0)\n .sort((a, b) => b.count - a.count)\n}\n\n/** The wave a page offers to start next, and its button's words. */\nexport function aiSiteImportStartAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'> & Partial<Pick<AiJobSummary, 'status'>>,\n): { wave: AiSiteImportWave; label: string; quote: string } | null {\n const state = job.siteImport ?? null\n // An import that stopped inside a wave waits on that wave, which starts again where it stopped (AGL-4083).\n const wave = (job.status === 'needs_review' ? aiSiteImportRunningWave(state) : null) ?? aiSiteImportNextWave(state)\n if (!state || !wave) return null\n return { wave, label: `Start ${wave.label}`, quote: aiSiteImportWaveQuote(job, wave) }\n}\n\n/**\n * \"Start every remaining wave\" (AGL-4083), off by default: offered beside the\n * next wave's button when more than one wave waits, quoted as all of them.\n */\nexport function aiSiteImportStartAllAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'>,\n): { label: string; quote: string; waves: number } | null {\n const state = job.siteImport ?? null\n if (!state || !aiSiteImportNextWave(state)) return null\n const waves = state.waves.filter((wave) => wave.status === 'waiting').length\n if (waves < 2) return null\n return {\n label: 'Start every remaining wave',\n quote: aiCreditRangeText(aiSiteImportRemainingCreditRange(state, job.items ?? null)),\n waves,\n }\n}\n\n/*------------------------------------------\n * Keep my site, or Improve it (AGL-4152)\n *-----------------------------------------*/\n\n/** What Bring my site asks, and what each answer means, as the console draws it. */\nexport const AI_SITE_IMPORT_FINISH_COPY = {\n heading: 'How should your new site look?',\n keep: {\n label: 'Keep my site',\n description: `Your pages stay laid out as they are, in your site’s colors, buttons and fonts. ${PLATFORM_BRAND_NAME} tidies spacing, type and color so every page reads well. Every word stays as you wrote it.`,\n },\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI redesigns each page with your pictures, menus and forms, in a theme built around your brand.`,\n },\n wording: {\n label: 'Also improve my wording',\n description: `${PLATFORM_BRAND_NAME} AI rewrites the headings, paragraphs and buttons of your main pages so they read better. Every name, price, number, date, address, phone number and email stays exactly as you wrote it. Quotes, policies, tables and forms keep every word.`,\n },\n helper: 'You can change this before each wave.',\n /** The job page's line before it opens the choice: \"How your new site looks: Keep my site\". */\n current: 'How your new site looks',\n change: 'Change',\n} as const\n\n/** The choice in a few words: \"Keep my site\", \"Improve it\", or \"Improve it, and my wording\". */\nexport function aiSiteImportChoiceText(choice: AiSiteImportChoice): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n return choice.wording ? `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, and my wording` : AI_SITE_IMPORT_FINISH_COPY.improve.label\n}\n\n/** How a wave was built, as its heading says it: \"Keep my site\", \"Improved\", or \"Improved, wording too\". */\nexport function aiSiteImportBuiltText(choice: AiSiteImportChoice): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n return choice.wording ? 'Improved, wording too' : 'Improved'\n}\n\n/**\n * A wave's heading (AGL-4152): once it has started, its name and how it was\n * built, \"Main pages · Keep my site\"; before, its name alone, since how it is\n * built is still the owner's to change.\n */\nexport function aiSiteImportWaveHeading(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined, wave: AiSiteImportWave): string {\n if (!wave.startedAt) return wave.label\n return `${wave.label} · ${aiSiteImportBuiltText(aiSiteImportWaveChoice(state, wave))}`\n}\n\n/** What a running wave's page says it does with each page, the way the wave is built (AGL-4152). */\nexport function aiSiteImportRunningLede(choice: AiSiteImportChoice): string {\n const review = 'You review the wave when it is in.'\n if (choice.finish === 'keep') return `Each page keeps its layout and every word as you wrote it, in your site’s own look. ${review}`\n return choice.wording\n ? `${PLATFORM_BRAND_NAME} AI redesigns each page and improves its wording, keeping every name, price, number, date, address, phone number and email as you wrote it. ${review}`\n : `${PLATFORM_BRAND_NAME} AI redesigns each page with its own words, pictures, menus and forms. ${review}`\n}\n\n/**\n * What Also improve my wording adds (AGL-4152): for a wave, its pages'\n * rewrites, \"Adds about 162 AI credits to this wave.\"; before the site is\n * read, a main page's.\n */\nexport function aiSiteImportWordingCreditsText(\n scope: { job: Pick<AiJobSummary, 'items' | 'siteImport'>; wave: AiSiteImportWave } | null,\n): string {\n if (!scope?.job.siteImport) return `About ${aiSiteImportWordingCredits(1).likely.toLocaleString('en-US')} more AI credits for each main page.`\n const pages = aiSiteImportWordingPages(scope.job.siteImport, scope.wave, { finish: 'improve', wording: true }, scope.job.items ?? null)\n if (!pages) return 'This wave’s pages keep every word, so it adds no AI credits.'\n return `Adds about ${aiSiteImportWordingCredits(pages).likely.toLocaleString('en-US')} AI credits to this wave.`\n}\n\n/**\n * The choice as Bring my site draws it (AGL-4152): the finish, and where the\n * Also improve my wording switch sits, which counts only under Improve it, so\n * a person who picks Keep my site and then Improve it finds it on.\n */\nexport interface AiSiteImportFinishField {\n finish: AiSiteImportFinish\n wording: boolean\n}\n\n/** The field an import's page opens with: the import's choice, the switch on where it was never turned off under Improve it. */\nexport function aiSiteImportFinishFieldOf(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined): AiSiteImportFinishField {\n const choice = aiSiteImportChoiceOf(state)\n return choice.finish === 'improve' ? choice : { finish: 'keep', wording: AI_SITE_IMPORT_DEFAULT_CHOICE.wording }\n}\n\n/** The choice a field asks for: its wording only under Improve it. */\nexport function aiSiteImportFieldChoice(field: AiSiteImportFinishField): AiSiteImportChoice {\n return { finish: field.finish, wording: field.finish === 'improve' && field.wording }\n}\n"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportChoiceOf","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveChoice","aiSiteImportWaveCreditRange","aiSiteImportWaveOwed","aiSiteImportWordingCredits","aiSiteImportWordingPages","AI_SITE_IMPORT_PLAN_COPY","AI_SITE_IMPORT_ROLE_COPY","aiSiteImportOfferOf","offer","state","claims","reason","message","aiSiteImportPhaseOf","job","siteImport","stopped","verdict","status","review","aiSiteImportHeldCopy","fromState","domain","heading","action","aiSiteImportStoppedCopy","waves","some","wave","startedAt","rowState","row","active","aiSiteImportPhotosText","photos","skipped","Math","max","into","brought","reused","added","filter","Boolean","join","parts","tried","BUILD_COPY","copied","arranged","reworded","wordsKept","buildCopy","page","choice","build","wording","AI_SITE_IMPORT_REWORDED_WORDS","aiSiteImportWaveRows","items","Map","map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","slots","pages","find","entry","path","slug","refused","url","toLocaleString","read","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","length","slice","found","lead","unread","aiSiteImportStopText","unreached","first","rest","stoppedBy","aiSiteImportVerdictNote","kind","aiSiteImportPlanText","kept","plan","pageLimit","existingPages","stop","aiSiteImportLeftOutLines","count","text","paths","leftOut","line","sort","a","b","aiSiteImportStartAction","quote","aiSiteImportStartAllAction","AI_SITE_IMPORT_FINISH_COPY","keep","description","improve","helper","current","change","aiSiteImportChoiceText","finish","aiSiteImportBuiltText","aiSiteImportWaveHeading","aiSiteImportRunningLede","aiSiteImportWordingCreditsText","scope","likely","aiSiteImportFinishFieldOf","aiSiteImportFieldChoice","field"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,0BAAsB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A;;;;CAIC,GACD,OAAO,SAAS+H,+BACdC,KAAyF;QAGsBA;IAD/G,IAAI,EAACA,yBAAAA,MAAOrI,GAAG,CAACC,UAAU,GAAE,OAAO,CAAC,MAAM,EAAEZ,2BAA2B,GAAGiJ,MAAM,CAAC9D,cAAc,CAAC,SAAS,oCAAoC,CAAC;IAC9I,MAAMP,QAAQ3E,yBAAyB+I,MAAMrI,GAAG,CAACC,UAAU,EAAEoI,MAAMvH,IAAI,EAAE;QAAEkH,QAAQ;QAAWtF,SAAS;IAAK,IAAG2F,mBAAAA,MAAMrI,GAAG,CAAC6C,KAAK,YAAfwF,mBAAmB;IAClI,IAAI,CAACpE,OAAO,OAAO;IACnB,OAAO,CAAC,WAAW,EAAE5E,2BAA2B4E,OAAOqE,MAAM,CAAC9D,cAAc,CAAC,SAAS,yBAAyB,CAAC;AAClH;AAYA,8HAA8H,GAC9H,OAAO,SAAS+D,0BAA0B5I,KAAuE;IAC/G,MAAM6C,SAAShE,qBAAqBmB;IACpC,OAAO6C,OAAOwF,MAAM,KAAK,YAAYxF,SAAS;QAAEwF,QAAQ;QAAQtF,SAASpE,8BAA8BoE,OAAO;IAAC;AACjH;AAEA,oEAAoE,GACpE,OAAO,SAAS8F,wBAAwBC,KAA8B;IACpE,OAAO;QAAET,QAAQS,MAAMT,MAAM;QAAEtF,SAAS+F,MAAMT,MAAM,KAAK,aAAaS,MAAM/F,OAAO;IAAC;AACtF"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-site-import-view.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 * BRING MY SITE, AS THE CONSOLE SHOWS IT (AGL-3976).\n *\n * Pure: what the \"Create site\" choice card says before anyone clicks, and\n * what an import job's page shows in each of its states — the site read and\n * its waves planned, a wave running, a wave in for review, a wave held for a\n * proof or the day's limit, the import done. The components draw these; the\n * specs hold them.\n *=========================================*/\n\nimport { PLATFORM_BRAND_NAME } from '@aglyn/aglyn/app-utils/platform-brand'\nimport { aiCreditRangeText } from './ai-credit-estimate'\nimport { aiMediaCreditsPerPicture } from './ai-media-credits'\nimport type { AiJobItemLedger, AiJobSummary } from './ai-jobs.types'\nimport {\n AI_SITE_IMPORT_FRAME_SLOT,\n AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE,\n AI_SITE_IMPORT_LAYOUT_KEPT,\n AI_SITE_IMPORT_PLAN_FELL_BACK,\n AI_SITE_IMPORT_LEFT_OUT_COPY,\n AI_SITE_IMPORT_LEFT_OUT_REASONS,\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_UNREAD_REASONS,\n aiSiteImportChoiceOf,\n aiSiteImportGeneratedPicturesOn,\n aiSiteImportNextWave,\n aiSiteImportPagesText,\n aiSiteImportPlanAccepted,\n aiSiteImportPlanAwaits,\n aiSiteImportQuoteText,\n aiSiteImportReadStops,\n aiSiteImportReadVerdictMessage,\n aiSiteImportReadVerdictReason,\n aiSiteImportRemainingCreditRange,\n aiSiteImportReviewWave,\n aiSiteImportRunningWave,\n aiSiteImportWaveChoice,\n aiSiteImportWaveCreditRange,\n aiSiteImportWaveIsGenerative,\n aiSiteImportWaveOwed,\n aiSiteImportWordingCredits,\n aiSiteImportWordingPages,\n type AiSiteImportChoice,\n type AiSiteImportFinish,\n type AiSiteImportLeftOutReason,\n type AiSiteImportPage,\n type AiSiteImportState,\n type AiSiteImportWave,\n} from './ai-site-import'\n\n/** A domain ownership claim, as the ownership door answers it. */\nexport interface AiSiteImportClaim {\n domain: string\n status: 'pending' | 'proven'\n current: boolean\n provenMethod: 'dns' | 'meta' | 'email' | null\n provenAt: number | null\n provenDetail: string | null\n lastChecks: Partial<Record<'dns' | 'meta' | 'email', 'proven' | 'not-yet' | 'unreachable'>>\n dns: { host: string; type: 'TXT'; value: string }\n meta: { name: string; content: string; tag: string }\n email: { domain: string; pendingAddress: string | null; expiresAt: number | null; attemptsLeft: number | null }\n}\n\n/** Whether \"Bring my site\" is offered here, and if not why. */\nexport type AiSiteImportAvailability =\n | { state: 'checking' }\n /** The release flag is off, or the doors cannot be reached: the card is not drawn. */\n | { state: 'hidden' }\n /** Something the workspace can change stands in the way: the card is drawn disabled, with the reason. */\n | { state: 'blocked'; reason: 'plan' | 'role'; message: string }\n | { state: 'ready'; claims: AiSiteImportClaim[] }\n\n/** What the card says to a plan that does not include it. */\nexport const AI_SITE_IMPORT_PLAN_COPY =\n 'Bring your current website in, every page and photo, on any paid plan. Upgrade to bring yours in.'\n\n/** What the card says to a member who cannot. */\nexport const AI_SITE_IMPORT_ROLE_COPY = 'Only the workspace owner or an admin can bring a site in.'\n\n/**\n * The jobs list's `siteImport` offer (AGL-3976), as the card's state: absent\n * is the flag off, and the card is not drawn; `plan` and `role` are drawn\n * disabled with the reason.\n */\nexport function aiSiteImportOfferOf(offer: unknown): AiSiteImportAvailability {\n if (offer === 'ready') return { state: 'ready', claims: [] }\n if (offer === 'plan') return { state: 'blocked', reason: 'plan', message: AI_SITE_IMPORT_PLAN_COPY }\n if (offer === 'role') return { state: 'blocked', reason: 'role', message: AI_SITE_IMPORT_ROLE_COPY }\n return { state: 'hidden' }\n}\n\n/** Where an import job's page is. */\nexport type AiSiteImportPhase =\n /** The site is being read. */\n | 'reading'\n /** Read and planned; the first wave waits to be started. */\n | 'ready'\n /** A wave was started and has not begun yet. */\n | 'starting'\n | 'running'\n /** A wave is in; the next waits to be started. */\n | 'review'\n /** Held for something the person does: verify again, wait for tomorrow, read again. */\n | 'held'\n /** Out of AI credits or at a cap: the meter's pause, carried on by Resume. */\n | 'paused'\n | 'done'\n | 'stopped'\n\nexport function aiSiteImportPhaseOf(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): AiSiteImportPhase {\n const state = job.siteImport ?? null\n // A read that stopped at its home page is held, and its Check again reads again (AGL-4083).\n const stopped = aiSiteImportReadStops(state?.verdict)\n if (job.status === 'done') return 'done'\n if (job.status === 'failed' || job.status === 'canceled') return 'stopped'\n if (job.status === 'needs_input') return 'paused'\n if (job.status === 'needs_review') {\n if (job.review?.reason !== 'wave' || !state || stopped) return 'held'\n return aiSiteImportReviewWave(state) ? 'review' : 'ready'\n }\n if (!state || stopped) return 'reading'\n return aiSiteImportRunningWave(state) ? 'running' : 'starting'\n}\n\n/**\n * How a hold that is the site's to fix reads (AGL-4083): its heading, its\n * sentence and its button. A home page bot protection turned away, or one\n * that could not be read, is checked again for free; `null` for any other\n * hold, which keeps its own words.\n */\nexport function aiSiteImportHeldCopy(\n job: Pick<AiJobSummary, 'review' | 'siteImport'>,\n): { heading: string; message: string; action: string } | null {\n const state = job.siteImport ?? null\n const fromState = aiSiteImportReadStops(state?.verdict) ? aiSiteImportReadVerdictReason(state?.verdict) : null\n const reason = job.review?.reason === 'blocked' || job.review?.reason === 'unreadable' ? job.review.reason : fromState\n if (!reason) return null\n const message =\n (fromState && state ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null) ?? job.review?.message ?? ''\n return {\n heading: reason === 'blocked' ? 'AglynBot was turned away' : 'Your home page could not be read',\n message,\n action: 'Check again',\n }\n}\n\n/**\n * Why an import that had started is waiting with no wave to review (AGL-4083):\n * the sentence its stop left, which says what is not in yet and what to start.\n * `null` for one that has not started, and one waiting for its review.\n */\nexport function aiSiteImportStoppedCopy(job: Pick<AiJobSummary, 'status' | 'review' | 'siteImport'>): string | null {\n const state = job.siteImport ?? null\n if (aiSiteImportPhaseOf(job) !== 'ready' || !state?.waves.some((wave) => wave.startedAt)) return null\n return job.review?.message || null\n}\n\nexport type AiSiteImportRowState = 'waiting' | 'active' | 'done' | 'failed' | 'skipped'\n\nexport interface AiSiteImportRowView {\n slot: string\n title: string\n /** Where it is on the old site. */\n from: string\n /** Where it is on the new one. */\n to: string\n state: AiSiteImportRowState\n /** Why it failed or was left out, or what the person should know. */\n note: string | null\n /** \"3 photos added, 1 already in your library\". */\n photos: string | null\n /** The draft the row wrote, by its output id. */\n outputId: string | null\n /** The page on the old site, to open beside the draft (AGL-4083). */\n oldPage: string\n /** \"1,204 of 1,310 words\", once the page is in and the step has counted them. */\n words: string | null\n /**\n * \"Copied as it is\" or \"Arranged by Aglyn AI\", once the step has chosen;\n * \"Arranged and reworded by Aglyn AI\" once its wave improved its words, and\n * \"Arranged by Aglyn AI · Words kept\" for a policy page on such a wave (AGL-4152).\n * Under a generative Improve it: \"Redesigned by Aglyn AI · 2 new sections\",\n * or \"Layout kept: the redesign did not pass\".\n */\n build: string | null\n /** \"New: Why us, FAQ (4)\": the sections a redesign added (AGL-4152). */\n added?: string | null\n /** \"1 stock photo, 1 generated picture\": the pictures a redesign took beside its own (AGL-4152). */\n pictures?: string | null\n /** A page the site's plan proposed (AGL-4152): it has no old page to open. */\n isNew?: boolean\n}\n\nfunction rowState(row: AiJobItemLedger | undefined, active: boolean): AiSiteImportRowState {\n if (!row) return 'waiting'\n if (row.status === 'succeeded' || row.status === 'degraded') return 'done'\n if (row.status === 'failed') return 'failed'\n if (row.status === 'skipped') return 'skipped'\n return active ? 'active' : 'waiting'\n}\n\n/**\n * \"3 photos added\", \"2 photos added, 1 already in your media library\"; with\n * photos that could not come in, against all it tried: \"3 of 5 photos: 2\n * added, 1 already in your media library, 2 could not be brought in\".\n */\nexport function aiSiteImportPhotosText(\n photos: { brought: number; reused: number; skipped?: number } | null | undefined,\n): string | null {\n if (!photos) return null\n const skipped = Math.max(0, photos.skipped ?? 0)\n const into = photos.brought + photos.reused\n if (into === 0 && skipped === 0) return null\n if (!skipped) {\n const added = photos.brought ? `${photos.brought} ${photos.brought === 1 ? 'photo' : 'photos'} added` : ''\n const reused = photos.reused ? `${photos.reused} already in your media library` : ''\n return [added, reused].filter(Boolean).join(', ')\n }\n const parts = [\n photos.brought ? `${photos.brought} added` : '',\n photos.reused ? `${photos.reused} already in your media library` : '',\n `${skipped} could not be brought in`,\n ].filter(Boolean)\n const tried = into + skipped\n return `${into} of ${tried} ${tried === 1 ? 'photo' : 'photos'}: ${parts.join(', ')}`\n}\n\nconst BUILD_COPY = {\n copied: 'Copied as it is',\n arranged: `Arranged by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page redesigned from its ledger (AGL-4152). */\n redesigned: `Redesigned by ${PLATFORM_BRAND_NAME} AI`,\n /** A main page whose wording was improved (AGL-4152). */\n reworded: `Arranged and reworded by ${PLATFORM_BRAND_NAME} AI`,\n /** A policy page on a wave that improved the wording of the rest: it keeps every word. */\n wordsKept: `Arranged by ${PLATFORM_BRAND_NAME} AI · Words kept`,\n} as const\n\n/** A page's build as its row says it, with whether its words were improved where its wave improved wording (AGL-4152). */\nfunction buildCopy(page: AiSiteImportPage, choice: AiSiteImportChoice, generative = false): string | null {\n if (!page.build) return null\n // A redesign that did not pass (AGL-4152): today's compile drew the page.\n if (page.redesign === 'layout-kept') return AI_SITE_IMPORT_LAYOUT_KEPT\n if (page.redesign === 'redesigned') {\n const added = page.added?.length ?? 0\n return added ? `${BUILD_COPY.redesigned} · ${added} new ${added === 1 ? 'section' : 'sections'}` : BUILD_COPY.redesigned\n }\n if (generative && page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.redesigned\n if (page.build === 'arranged' && page.wording === 'improved') return BUILD_COPY.reworded\n if (page.build === 'arranged' && page.wording === 'kept' && choice.wording) return BUILD_COPY.wordsKept\n return BUILD_COPY[page.build]\n}\n\n/** \"New: Why us, FAQ (4)\": the sections a redesign added, as its row says (AGL-4152). */\nexport function aiSiteImportAddedText(page: Pick<AiSiteImportPage, 'added'>): string | null {\n const added = page.added ?? []\n return added.length ? `New: ${added.map((section) => (section.items ? `${section.heading} (${section.items})` : section.heading)).join(', ')}` : null\n}\n\n/** \"1 stock photo, 1 generated picture\": what a redesign's pictures came from beside the page's own (AGL-4152). */\nexport function aiSiteImportPicturesText(page: Pick<AiSiteImportPage, 'pictures'>): string | null {\n const pictures = page.pictures\n if (!pictures) return null\n const parts = [\n pictures.stock ? `${pictures.stock} stock ${pictures.stock === 1 ? 'photo' : 'photos'}` : '',\n pictures.generated ? `${pictures.generated} generated ${pictures.generated === 1 ? 'picture' : 'pictures'}` : '',\n pictures.unplaced.length ? `${pictures.unplaced.length} of your photos not placed` : '',\n ].filter(Boolean)\n return parts.length ? parts.join(', ') : null\n}\n\n/** What the row of a page whose words were improved says in place of its word count (AGL-4152). */\nexport const AI_SITE_IMPORT_REWORDED_WORDS = 'Every fact kept'\n\n/** One wave's rows, the header and footer first where the wave builds them. */\nexport function aiSiteImportWaveRows(\n job: Pick<AiJobSummary, 'items' | 'siteImport' | 'status'>,\n wave: AiSiteImportWave,\n): AiSiteImportRowView[] {\n const state = job.siteImport as AiSiteImportState\n const items = new Map((job.items ?? []).map((row) => [row.slot, row]))\n const running = wave.status === 'running' && (job.status === 'running' || job.status === 'queued')\n let activeTaken = false\n const active = (row: AiJobItemLedger | undefined) => {\n if (!running || activeTaken || !row || (row.status !== 'pending' && row.status !== 'running')) return false\n activeTaken = true\n return true\n }\n const rows: AiSiteImportRowView[] = []\n const choice = aiSiteImportWaveChoice(state, wave)\n const generative = aiSiteImportWaveIsGenerative(state, wave)\n if (wave.frame && state.frame) {\n const row = items.get(AI_SITE_IMPORT_FRAME_SLOT)\n rows.push({\n slot: AI_SITE_IMPORT_FRAME_SLOT,\n title: 'Header and footer',\n from: `Your menu on ${state.domain}`,\n to: 'Every page',\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? null,\n photos: null,\n outputId: row?.outputs[0] ?? null,\n oldPage: `https://${state.domain}/`,\n words: null,\n build: null,\n })\n }\n for (const slot of wave.slots) {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page) continue\n const row = items.get(slot)\n rows.push({\n slot,\n title: page.title,\n from: page.path,\n to: page.slug === '/' ? '/' : `/${page.slug}`,\n state: rowState(row, active(row)),\n note: row?.failure?.message ?? row?.note ?? (page.refused ? AI_SITE_IMPORT_LEFT_OUT_COPY[page.refused] : null),\n // What a generative Improve it says of a page beside its build (AGL-4152).\n ...(aiSiteImportAddedText(page) ? { added: aiSiteImportAddedText(page) } : {}),\n ...(aiSiteImportPicturesText(page) ? { pictures: aiSiteImportPicturesText(page) } : {}),\n ...(page.origin === 'proposed' ? { isNew: true } : {}),\n photos: aiSiteImportPhotosText(page.photos),\n outputId: row?.outputs[0] ?? null,\n oldPage: page.url,\n // Beside the old page's own words, its main region's as the wave read them: its menu and footer are the site's (AGL-4084).\n // A page whose words were improved keeps its facts, not its count (AGL-4152).\n words: page.brought && page.origin !== 'proposed'\n ? page.wording === 'improved'\n ? AI_SITE_IMPORT_REWORDED_WORDS\n : `${page.brought.words.toLocaleString('en-US')} of ${(page.read?.words ?? page.words).toLocaleString('en-US')} words`\n : null,\n build: buildCopy(page, choice, generative),\n })\n }\n return rows\n}\n\n/**\n * \"About 189 credits (up to 650)\" for the wave, as it stands; once the step\n * has chosen how its pages are built, it names them: \"…: 7 pages arranged by\n * Aglyn AI, 3 copied as they are\" (AGL-4083).\n */\nexport function aiSiteImportWaveQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, wave: AiSiteImportWave): string {\n const state = job.siteImport as AiSiteImportState\n const range = aiSiteImportWaveCreditRange(state, wave, job.items ?? null)\n return aiSiteImportQuoteText(range, aiSiteImportWaveOwed(state, wave, job.items ?? null), aiSiteImportWaveIsGenerative(state, wave) ? { generative: true } : {})\n}\n\n/** What a wave cost, its pages' credits less what was given back. */\nexport function aiSiteImportWaveSpent(job: Pick<AiJobSummary, 'items'>, wave: AiSiteImportWave): number {\n const slots = new Set([...wave.slots, ...(wave.frame ? [AI_SITE_IMPORT_FRAME_SLOT] : [])])\n return (job.items ?? [])\n .filter((row) => slots.has(row.slot))\n .reduce((total, row) => total + Math.max(0, (row.creditsSpent ?? 0) - (row.creditsRefunded ?? 0)), 0)\n}\n\n/** Pages the site has that AglynBot could not read: turned away, unanswered, too large or never reached. */\nexport function aiSiteImportUnreadCount(state: AiSiteImportState): number {\n return AI_SITE_IMPORT_UNREAD_REASONS.reduce((total, reason) => total + (state.leftOutCount[reason] ?? 0), 0)\n}\n\n/**\n * The read site in one sentence: \"Found 21 pages on harbor-dental.com: Main\n * pages (6) and Blog (14).\" — and how many more could not be read (AGL-4083).\n */\nexport function aiSiteImportFoundText(state: AiSiteImportState): string {\n const groups = state.groups.map((group) => `${group.label} (${group.pages})`)\n const listed =\n groups.length <= 1 ? groups.join('') : `${groups.slice(0, -1).join(', ')} and ${groups[groups.length - 1]}`\n const found = `Found ${aiSiteImportPagesText(state.found)} on ${state.domain}`\n const lead = listed ? `${found}: ${listed}.` : `${found}.`\n const unread = aiSiteImportUnreadCount(state)\n return unread ? `${lead} ${unread.toLocaleString('en-US')} more could not be read; see Not brought in.` : lead\n}\n\n/** Why the read stopped short, when it did and left pages unread (AGL-4083). */\nexport function aiSiteImportStopText(state: AiSiteImportState): string | null {\n const unreached = state.leftOutCount['not-reached'] ?? 0\n if (!unreached) return null\n const first = `Only the first ${aiSiteImportPagesText(state.found)}`\n const rest = 'the rest are listed under Not brought in as not reached.'\n switch (state.stoppedBy) {\n case 'time':\n return `${first} could be read in the time allowed; ${rest}`\n case 'total-bytes':\n return `${first} could be read before the read reached its size limit; ${rest}`\n default:\n return `${first} could be read this time; ${rest}`\n }\n}\n\n/** The read's warning when most of the site was turned away though its home page came in (AGL-4083). */\nexport function aiSiteImportVerdictNote(state: AiSiteImportState): string | null {\n return state.verdict?.kind === 'mostly-blocked' ? aiSiteImportReadVerdictMessage(state.verdict, state.domain) : null\n}\n\n/** The plan's page count against the site: \"Your plan includes 25 pages and this site has 0, so 20 are brought in.\" */\nexport function aiSiteImportPlanText(state: AiSiteImportState): string {\n const kept = state.pages.length\n const waves = state.waves.length\n const plan =\n state.pageLimit === null\n ? 'Your plan has no page limit'\n : `Your plan includes ${aiSiteImportPagesText(state.pageLimit)} and this site has ${state.existingPages}`\n const lead = `${plan}, so ${aiSiteImportPagesText(kept)} ${kept === 1 ? 'is' : 'are'} brought in, in ${waves === 1 ? 'one wave' : `${waves} waves`}.`\n const stop = aiSiteImportStopText(state)\n return stop ? `${lead} ${stop}` : lead\n}\n\n/** What was left out, by reason, most first. */\nexport function aiSiteImportLeftOutLines(state: AiSiteImportState): Array<{ reason: AiSiteImportLeftOutReason; count: number; text: string; paths: string[] }> {\n return AI_SITE_IMPORT_LEFT_OUT_REASONS.map((reason) => ({\n reason,\n count: state.leftOutCount[reason] ?? 0,\n text: AI_SITE_IMPORT_LEFT_OUT_COPY[reason],\n paths: state.leftOut.filter((entry) => entry.reason === reason).map((entry) => entry.path),\n }))\n .filter((line) => line.count > 0)\n .sort((a, b) => b.count - a.count)\n}\n\n/** The wave a page offers to start next, and its button's words. */\nexport function aiSiteImportStartAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'> & Partial<Pick<AiJobSummary, 'status'>>,\n): { wave: AiSiteImportWave; label: string; quote: string } | null {\n const state = job.siteImport ?? null\n // An import that stopped inside a wave waits on that wave, which starts again where it stopped (AGL-4083).\n const wave = (job.status === 'needs_review' ? aiSiteImportRunningWave(state) : null) ?? aiSiteImportNextWave(state)\n if (!state || !wave) return null\n return { wave, label: `Start ${wave.label}`, quote: aiSiteImportWaveQuote(job, wave) }\n}\n\n/**\n * \"Start every remaining wave\" (AGL-4083), off by default: offered beside the\n * next wave's button when more than one wave waits, quoted as all of them.\n */\nexport function aiSiteImportStartAllAction(\n job: Pick<AiJobSummary, 'siteImport' | 'items'>,\n): { label: string; quote: string; waves: number } | null {\n const state = job.siteImport ?? null\n if (!state || !aiSiteImportNextWave(state)) return null\n const waves = state.waves.filter((wave) => wave.status === 'waiting').length\n if (waves < 2) return null\n return {\n label: 'Start every remaining wave',\n quote: aiCreditRangeText(aiSiteImportRemainingCreditRange(state, job.items ?? null)),\n waves,\n }\n}\n\n/*------------------------------------------\n * Keep my site, or Improve it (AGL-4152)\n *-----------------------------------------*/\n\n/** What Bring my site asks, and what each answer means, as the console draws it. */\nexport const AI_SITE_IMPORT_FINISH_COPY = {\n heading: 'How should your new site look?',\n keep: {\n label: 'Keep my site',\n description: `Your pages stay laid out as they are, in your site’s colors, buttons and fonts. ${PLATFORM_BRAND_NAME} tidies spacing, type and color so every page reads well. Every word stays as you wrote it.`,\n },\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI redesigns each page with your pictures, menus and forms, in a theme built around your brand.`,\n },\n wording: {\n label: 'Also improve my wording',\n description: `${PLATFORM_BRAND_NAME} AI rewrites the headings, paragraphs and buttons of your main pages so they read better. Every name, price, number, date, address, phone number and email stays exactly as you wrote it. Quotes, policies, tables and forms keep every word.`,\n },\n helper: 'You can change this before each wave.',\n /** The job page's line before it opens the choice: \"How your new site looks: Keep my site\". */\n current: 'How your new site looks',\n change: 'Change',\n} as const\n\n/**\n * The same choice under a generative Improve it (AGL-4152): the improve option's\n * and the switch's words; everything else stands. Only drawn under the flag.\n */\nexport const AI_SITE_IMPORT_FINISH_COPY_GENERATIVE = {\n ...AI_SITE_IMPORT_FINISH_COPY,\n improve: {\n label: 'Improve it',\n description: `${PLATFORM_BRAND_NAME} AI plans your menu and footer, and redesigns each page with your pictures and forms, in a theme built around your brand. It shows you the plan before anything is built.`,\n },\n wording: {\n label: 'Also write new copy',\n description: `${PLATFORM_BRAND_NAME} AI writes new headings, paragraphs and sections for your main pages from what your site says. It never makes up a name, number, price, date, testimonial, client, award, credential, address or guarantee. Off, every word stays as you wrote it, and your layout and menu are still redesigned.`,\n },\n} as const\n\n/** The choice in a few words: \"Keep my site\", \"Improve it\", or \"Improve it, and my wording\"; under a generative Improve it, \"Improve it, with new copy\". */\nexport function aiSiteImportChoiceText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (!choice.wording) return AI_SITE_IMPORT_FINISH_COPY.improve.label\n return options.generative ? `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, with new copy` : `${AI_SITE_IMPORT_FINISH_COPY.improve.label}, and my wording`\n}\n\n/** How a wave was built, as its heading says it: \"Keep my site\", \"Improved\", or \"Improved, wording too\"; under a generative Improve it, \"Redesigned\" or \"Redesigned, new copy\". */\nexport function aiSiteImportBuiltText(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n if (choice.finish === 'keep') return AI_SITE_IMPORT_FINISH_COPY.keep.label\n if (options.generative) return choice.wording ? 'Redesigned, new copy' : 'Redesigned'\n return choice.wording ? 'Improved, wording too' : 'Improved'\n}\n\n/**\n * A wave's heading (AGL-4152): once it has started, its name and how it was\n * built, \"Main pages · Keep my site\"; before, its name alone, since how it is\n * built is still the owner's to change.\n */\nexport function aiSiteImportWaveHeading(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined, wave: AiSiteImportWave): string {\n if (!wave.startedAt) return wave.label\n return `${wave.label} · ${aiSiteImportBuiltText(aiSiteImportWaveChoice(state, wave), wave.generative ? { generative: true } : {})}`\n}\n\n/** What a running wave's page says it does with each page, the way the wave is built (AGL-4152). */\nexport function aiSiteImportRunningLede(choice: AiSiteImportChoice, options: { generative?: boolean } = {}): string {\n const review = 'You review the wave when it is in.'\n if (choice.finish === 'keep') return `Each page keeps its layout and every word as you wrote it, in your site’s own look. ${review}`\n if (options.generative && choice.wording) return `${PLATFORM_BRAND_NAME} AI redesigns each page and writes new copy from what your site says, making up no name, number, price or date. ${review}`\n return choice.wording\n ? `${PLATFORM_BRAND_NAME} AI redesigns each page and improves its wording, keeping every name, price, number, date, address, phone number and email as you wrote it. ${review}`\n : `${PLATFORM_BRAND_NAME} AI redesigns each page with its own words, pictures, menus and forms. ${review}`\n}\n\n/**\n * What Also improve my wording adds (AGL-4152): for a wave, its pages'\n * rewrites, \"Adds about 162 AI credits to this wave.\"; before the site is\n * read, a main page's.\n */\nexport function aiSiteImportWordingCreditsText(\n scope: { job: Pick<AiJobSummary, 'items' | 'siteImport'>; wave: AiSiteImportWave } | null,\n): string {\n if (!scope?.job.siteImport) return `About ${aiSiteImportWordingCredits(1).likely.toLocaleString('en-US')} more AI credits for each main page.`\n const pages = aiSiteImportWordingPages(scope.job.siteImport, scope.wave, { finish: 'improve', wording: true }, scope.job.items ?? null)\n if (!pages) return 'This wave’s pages keep every word, so it adds no AI credits.'\n return `Adds about ${aiSiteImportWordingCredits(pages).likely.toLocaleString('en-US')} AI credits to this wave.`\n}\n\n/**\n * The choice as Bring my site draws it (AGL-4152): the finish, and where the\n * Also improve my wording switch sits, which counts only under Improve it, so\n * a person who picks Keep my site and then Improve it finds it on.\n */\nexport interface AiSiteImportFinishField {\n finish: AiSiteImportFinish\n wording: boolean\n}\n\n/** The field an import's page opens with: the import's choice, the switch on where it was never turned off under Improve it. */\nexport function aiSiteImportFinishFieldOf(state: Pick<AiSiteImportState, 'finish' | 'wording'> | null | undefined): AiSiteImportFinishField {\n const choice = aiSiteImportChoiceOf(state)\n return choice.finish === 'improve' ? choice : { finish: 'keep', wording: AI_SITE_IMPORT_DEFAULT_CHOICE.wording }\n}\n\n/** The choice a field asks for: its wording only under Improve it. */\nexport function aiSiteImportFieldChoice(field: AiSiteImportFinishField): AiSiteImportChoice {\n return { finish: field.finish, wording: field.finish === 'improve' && field.wording }\n}\n\n/*------------------------------------------\n * Your new site (AGL-4152)\n *-----------------------------------------*/\n\n/** The \"Your new site\" panel's words: what the site is, its menu, its main button, its footer, and what its owner may switch. */\nexport interface AiSiteImportPlanView {\n what: string\n audience: string\n /** Each menu entry: its label and the pages under it; one page is a plain link. */\n menu: Array<{ label: string; pages: string[] }>\n /** \"Book a visit → Contact\". */\n cta: string | null\n footer: Array<{ label: string; pages: string[] }>\n /** The page it proposes, whether it was kept or switched off. */\n proposed: { title: string; purpose: string; address: string } | null\n /** Whether the owner still decides: the plan waits on them. */\n editable: boolean\n}\n\n/** The panel's fixed words, one place for its specs and its screen. */\nexport const AI_SITE_IMPORT_PLAN_COPY_TEXT = {\n heading: 'Your new site',\n menu: 'Menu',\n cta: 'Main button',\n footer: 'Footer',\n addPage: 'Add this new page',\n addPageHelp: 'One new page, written from what your site says. It counts toward your plan’s page limit.',\n pictures: 'Create pictures with AI where needed',\n build: 'Build my new site',\n whatsNew: 'What’s new',\n} as const\n\n/** The panel as a plan reads, or `null` with none: every import the flag is off for, and every plan that did not pass. */\nexport function aiSiteImportPlanViewOf(state: AiSiteImportState | null | undefined): AiSiteImportPlanView | null {\n const plan = state?.plan\n if (!state || !plan) return null\n const name = (id: string) => (plan.proposed?.draftId === id ? plan.proposed.title : (state.pages.find((page) => page.draftId === id)?.title ?? ''))\n const named = (groups: ReadonlyArray<{ label: string; pages: string[] }>) => groups.map((group) => ({ label: group.label, pages: group.pages.map(name).filter(Boolean) })).filter((group) => group.pages.length)\n const cta = plan.nav.primaryCta\n const where = !cta ? '' : cta.target === 'phone' ? 'your phone number' : name(cta.target === 'form' ? (cta.page ?? '') : cta.target)\n return {\n what: plan.site.what,\n audience: plan.site.audience,\n menu: named(plan.nav.groups),\n cta: cta && where ? `${cta.label} → ${where}` : null,\n footer: named(plan.nav.footer),\n proposed: plan.proposed && (aiSiteImportPlanAwaits(state) || plan.proposed.on) ? { title: plan.proposed.title, purpose: plan.proposed.purpose, address: `/${plan.proposed.slug}` } : null,\n editable: aiSiteImportPlanAwaits(state),\n }\n}\n\n/** What the plan that did not pass says, or `null`: a plan that passed, and every import with none asked. */\nexport function aiSiteImportPlanFellBackText(state: Pick<AiSiteImportState, 'plan'> | null | undefined): string | null {\n return state?.plan === null ? AI_SITE_IMPORT_PLAN_FELL_BACK : null\n}\n\n/** The credits a generated picture is quoted at, on a paid plan: an import is one. */\nexport const aiSiteImportPictureCredits = (): number => aiMediaCreditsPerPicture('photo', undefined, '1K')\n\n/** What the generated pictures switch says it adds: how many at most, and what each costs, before it is on. */\nexport function aiSiteImportPicturesSwitchText(state: AiSiteImportState): string {\n const pages = state.pages.filter((page) => page.wording === 'improved' && !page.refused).length\n const each = aiSiteImportPictureCredits()\n const most = pages * AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE\n return `Only where your own photos and the stock library have nothing that fits: a page’s opening picture or a section’s lead, up to ${AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE} a page. About ${each.toLocaleString('en-US')} AI credits each${most ? `, so at most ${(most * each).toLocaleString('en-US')} for this wave` : ''}. A picture that is not made costs nothing.`\n}\n\n/** Whether generated pictures are switched on now, for the panel's first draw. */\nexport function aiSiteImportPlanFieldOf(state: AiSiteImportState | null | undefined): { addPage: boolean; pictures: boolean } {\n return { addPage: state?.plan?.proposed?.on !== false, pictures: aiSiteImportGeneratedPicturesOn(state) }\n}\n\n/** Whether a plan's generated pictures switch means anything: only pages with new copy ask for a picture. */\nexport function aiSiteImportPlanTakesPictures(state: Pick<AiSiteImportState, 'pages'>): boolean {\n return state.pages.some((page) => page.wording === 'improved' && !page.refused)\n}\n\n/** The wave's quote as the plan's switches stand now (AGL-4152), before they are saved: with or without its new page, and its pictures. */\nexport function aiSiteImportPlanQuote(job: Pick<AiJobSummary, 'items' | 'siteImport'>, field: { addPage: boolean; pictures: boolean }): string | null {\n const state = job.siteImport ?? null\n const plan = state?.plan\n if (!state || !plan) return null\n const asked: AiSiteImportState = { ...state, generatedPictures: field.pictures, plan: { ...plan, proposed: plan.proposed ? { ...plan.proposed, on: field.addPage } : null } }\n const next = aiSiteImportPlanAccepted(asked, job.items ?? [])\n const wave = aiSiteImportRunningWave(next.state)\n return wave ? aiSiteImportWaveQuote({ items: next.items, siteImport: next.state }, wave) : null\n}\n\n/** One page's lines of a wave's \"What's new\" (AGL-4152): its new sections, and its pictures. */\nexport interface AiSiteImportWhatsNewLine {\n page: string\n lines: string[]\n}\n\n/** A wave's \"What's new\" (AGL-4152): what its redesigns added, page by page. Empty on every other wave. */\nexport function aiSiteImportWhatsNew(state: AiSiteImportState, wave: AiSiteImportWave): AiSiteImportWhatsNewLine[] {\n return wave.slots.flatMap((slot) => {\n const page = state.pages.find((entry) => entry.slot === slot)\n if (!page || page.redesign !== 'redesigned') return []\n const lines = [page.origin === 'proposed' ? 'A new page, written from what your site says' : '', aiSiteImportAddedText(page) ?? '', aiSiteImportPicturesText(page) ?? ''].filter(Boolean)\n return lines.length ? [{ page: page.title, lines }] : []\n })\n}\n"],"names":["PLATFORM_BRAND_NAME","aiCreditRangeText","aiMediaCreditsPerPicture","AI_SITE_IMPORT_FRAME_SLOT","AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE","AI_SITE_IMPORT_LAYOUT_KEPT","AI_SITE_IMPORT_PLAN_FELL_BACK","AI_SITE_IMPORT_LEFT_OUT_COPY","AI_SITE_IMPORT_LEFT_OUT_REASONS","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_UNREAD_REASONS","aiSiteImportChoiceOf","aiSiteImportGeneratedPicturesOn","aiSiteImportNextWave","aiSiteImportPagesText","aiSiteImportPlanAccepted","aiSiteImportPlanAwaits","aiSiteImportQuoteText","aiSiteImportReadStops","aiSiteImportReadVerdictMessage","aiSiteImportReadVerdictReason","aiSiteImportRemainingCreditRange","aiSiteImportReviewWave","aiSiteImportRunningWave","aiSiteImportWaveChoice","aiSiteImportWaveCreditRange","aiSiteImportWaveIsGenerative","aiSiteImportWaveOwed","aiSiteImportWordingCredits","aiSiteImportWordingPages","AI_SITE_IMPORT_PLAN_COPY","AI_SITE_IMPORT_ROLE_COPY","aiSiteImportOfferOf","offer","state","claims","reason","message","aiSiteImportPhaseOf","job","siteImport","stopped","verdict","status","review","aiSiteImportHeldCopy","fromState","domain","heading","action","aiSiteImportStoppedCopy","waves","some","wave","startedAt","rowState","row","active","aiSiteImportPhotosText","photos","skipped","Math","max","into","brought","reused","added","filter","Boolean","join","parts","tried","BUILD_COPY","copied","arranged","redesigned","reworded","wordsKept","buildCopy","page","choice","generative","build","redesign","length","wording","aiSiteImportAddedText","map","section","items","aiSiteImportPicturesText","pictures","stock","generated","unplaced","AI_SITE_IMPORT_REWORDED_WORDS","aiSiteImportWaveRows","Map","slot","running","activeTaken","rows","frame","get","push","title","from","to","note","failure","outputId","outputs","oldPage","words","slots","pages","find","entry","path","slug","refused","origin","isNew","url","toLocaleString","read","aiSiteImportWaveQuote","range","aiSiteImportWaveSpent","Set","has","reduce","total","creditsSpent","creditsRefunded","aiSiteImportUnreadCount","leftOutCount","aiSiteImportFoundText","groups","group","label","listed","slice","found","lead","unread","aiSiteImportStopText","unreached","first","rest","stoppedBy","aiSiteImportVerdictNote","kind","aiSiteImportPlanText","kept","plan","pageLimit","existingPages","stop","aiSiteImportLeftOutLines","count","text","paths","leftOut","line","sort","a","b","aiSiteImportStartAction","quote","aiSiteImportStartAllAction","AI_SITE_IMPORT_FINISH_COPY","keep","description","improve","helper","current","change","AI_SITE_IMPORT_FINISH_COPY_GENERATIVE","aiSiteImportChoiceText","options","finish","aiSiteImportBuiltText","aiSiteImportWaveHeading","aiSiteImportRunningLede","aiSiteImportWordingCreditsText","scope","likely","aiSiteImportFinishFieldOf","aiSiteImportFieldChoice","field","AI_SITE_IMPORT_PLAN_COPY_TEXT","menu","cta","footer","addPage","addPageHelp","whatsNew","aiSiteImportPlanViewOf","name","id","proposed","draftId","named","nav","primaryCta","where","target","what","site","audience","on","purpose","address","editable","aiSiteImportPlanFellBackText","aiSiteImportPictureCredits","undefined","aiSiteImportPicturesSwitchText","each","most","aiSiteImportPlanFieldOf","aiSiteImportPlanTakesPictures","aiSiteImportPlanQuote","asked","generatedPictures","next","aiSiteImportWhatsNew","flatMap","lines"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;2CAQ2C,GAE3C,SAASA,mBAAmB,QAAQ,wCAAuC;AAC3E,SAASC,iBAAiB,QAAQ,0BAAsB;AACxD,SAASC,wBAAwB,QAAQ,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ACF"}
@@ -325,6 +325,8 @@ export interface SiteImportLayoutGroup {
325
325
  * a plan's name, words and button, or a label and its value (AGL-4083).
326
326
  */
327
327
  inline?: true;
328
+ /** Its items are photos, not marks (AGL-4152): a gallery, drawn as its pictures in its columns. Only on a `logos` group. */
329
+ gallery?: true;
328
330
  items: SiteImportLayoutItem[];
329
331
  }
330
332
  /** A table: rows of cells, each cell its lines (objects, not nested arrays, for Firestore). */
@@ -657,6 +659,11 @@ export declare function aiSiteImportVideoNote(videos: readonly SiteImportVideo[]
657
659
  export declare function siteImportLayoutWithoutDrawings(layout: SiteImportLayout): SiteImportLayout;
658
660
  /** What a wave's read found on one page, for its model answer. Never on the wire. */
659
661
  export interface AiSiteImportPageRead {
662
+ /** What the page holds that a visitor cannot see (AGL-4152): the addresses of its pictures, and its words. A build is held to not drawing them. */
663
+ concealed?: {
664
+ pictures: string[];
665
+ words: string[];
666
+ };
660
667
  at: string;
661
668
  title: string;
662
669
  /** The page's text in order, cut to `AI_SITE_IMPORT_PAGE_TEXT_MAX_CHARS`; fenced only when a prompt reads it. */
@@ -773,7 +780,25 @@ export interface AiSiteImportPage {
773
780
  }> | null;
774
781
  /** What the page's row says of its forms. */
775
782
  formNote?: string | null;
783
+ /** Where the page came from under a generative Improve it (AGL-4152): the source's, or the plan's proposed page. Absent is the source's. */
784
+ origin?: 'source' | 'proposed' | null;
785
+ /** The sections its redesign added (AGL-4152). */
786
+ added?: AiSiteImportAddedSection[] | null;
787
+ /** Its pictures by where each came from (AGL-4152). */
788
+ pictures?: AiSiteImportPagePictures | null;
789
+ /**
790
+ * How its generative Improve it came out (AGL-4152): `redesigned` from its
791
+ * answer, or `layout-kept` where the redesign did not pass and today's
792
+ * compile drew it. Absent on every other page.
793
+ */
794
+ redesign?: AiSiteImportRedesign | null;
776
795
  }
796
+ /** How a page's generative Improve it came out (AGL-4152). */
797
+ export type AiSiteImportRedesign = 'redesigned' | 'layout-kept';
798
+ /** What a page's row says where its redesign did not pass (AGL-4152). */
799
+ export declare const AI_SITE_IMPORT_LAYOUT_KEPT = "Layout kept: the redesign did not pass";
800
+ /** What a proposed page's row says where it could not be written: it has no old page to keep, so it is left out. */
801
+ export declare const AI_SITE_IMPORT_PROPOSED_NOT_WRITTEN = "This new page was left out: it could not be written without inventing facts. Its credits are given back.";
777
802
  /**
778
803
  * A wave's place in its import: waiting to start, running, in and waiting for
779
804
  * the person's review, in, or `stopped` — the import was canceled before the
@@ -795,6 +820,19 @@ export interface AiSiteImportWave {
795
820
  finish?: AiSiteImportFinish | null;
796
821
  /** Whether its improved pages' wording was improved too, stamped at its start (AGL-4152). */
797
822
  wording?: boolean | null;
823
+ /**
824
+ * Whether it is a generative Improve it (AGL-4152):
825
+ * `SITE_IMPORT_GENERATIVE_RELEASE_FLAG` was on for the organization when the
826
+ * wave started, under Improve it. Its site is planned, and with new copy on
827
+ * its improved pages are redesigned from a ledger. Absent, today's Improve it.
828
+ */
829
+ generative?: true;
830
+ /**
831
+ * `SITE_IMPORT_VIDEO_POSTERS_RELEASE_FLAG` was on for the organization when
832
+ * the wave started (AGL-4140): its pages place a YouTube film with no
833
+ * poster the library holds, for the page to draw YouTube's own still in.
834
+ */
835
+ videoPosters?: true;
798
836
  }
799
837
  export interface AiSiteImportState {
800
838
  domain: string;
@@ -847,6 +885,127 @@ export interface AiSiteImportState {
847
885
  finish?: AiSiteImportFinish | null;
848
886
  /** Under `improve`, whether the main pages' wording is improved too (AGL-4152): on unless the owner turns it off. */
849
887
  wording?: boolean | null;
888
+ /**
889
+ * The one site plan a generative Improve it draws from (AGL-4152), written
890
+ * once after the first wave's read. Absent until that step exists, and on
891
+ * every import that is not generative; a page's design then comes from the
892
+ * import's own inputs (`aiSiteImportDesignInputs`). `null` is a plan asked
893
+ * for that did not pass: the import's frame and design inputs stand, and its
894
+ * page says so.
895
+ */
896
+ plan?: AiSiteImportPlan | null;
897
+ /** The owner saw the plan and started the build (AGL-4152): its proposed page is settled, in or out. */
898
+ planAccepted?: true;
899
+ /** Whether a slot nothing else fills may take a generated picture (AGL-4152); absent is `AI_SITE_IMPORT_GENERATED_PICTURES_DEFAULT`. */
900
+ generatedPictures?: boolean | null;
901
+ /**
902
+ * `SITE_IMPORT_GENERATIVE_RELEASE_FLAG` was on for the organization when the
903
+ * site was read (AGL-4152): what its page says and quotes before a wave
904
+ * starts. A wave's own stamp decides how it is built.
905
+ */
906
+ generative?: true;
907
+ /** The source's photos a redesigned page left off (AGL-4152), which a later page's slot takes before a stock photo. */
908
+ sitePhotos?: AiSiteImportPhoto[] | null;
909
+ }
910
+ /**
911
+ * The site plan (AGL-4152): what the site is, its menu, its design, and at
912
+ * most one proposed page. Page references are draft ids. Its words are the
913
+ * site's own data, fenced wherever a prompt reads them.
914
+ */
915
+ export interface AiSiteImportPlan {
916
+ site: {
917
+ what: string;
918
+ audience: string;
919
+ kind: string;
920
+ voice: string;
921
+ };
922
+ nav: {
923
+ groups: Array<{
924
+ label: string;
925
+ pages: string[];
926
+ }>;
927
+ /**
928
+ * The header's filled call to action: `target` is a page's draft id, `form`
929
+ * or `phone`; `page` is the page a `form` target sends a visitor to, read
930
+ * when the plan was checked, since a settled page keeps no form.
931
+ */
932
+ primaryCta: {
933
+ label: string;
934
+ target: string;
935
+ page?: string;
936
+ } | null;
937
+ footer: Array<{
938
+ label: string;
939
+ pages: string[];
940
+ }>;
941
+ };
942
+ /** One for the site, so every page of every wave is drawn alike. */
943
+ design: AiSiteImportPlanDesign;
944
+ /** At most one new page, on by default, with a switch (`AiSiteImportPage.origin`). `draftId` names its page once the plan is in. */
945
+ proposed: {
946
+ title: string;
947
+ slug: string;
948
+ purpose: string;
949
+ on: boolean;
950
+ draftId?: string;
951
+ } | null;
952
+ /**
953
+ * What each page is for in the new site, by its draft id (AGL-4152): what
954
+ * its redesign plans it as, and how many new sections it has room for. A
955
+ * plan made before roles reads each page's from its address and what it holds.
956
+ */
957
+ roles?: Record<string, AiSiteImportPageRole>;
958
+ }
959
+ /** What a page is for in a planned site (AGL-4152): what its redesign plans it as. */
960
+ export type AiSiteImportPageRole = 'home' | 'service' | 'about' | 'contact' | 'gallery' | 'pricing' | 'faq' | 'other';
961
+ export declare const AI_SITE_IMPORT_PAGE_ROLES: readonly AiSiteImportPageRole[];
962
+ /** How a plan draws the site: the hero, each group, the bands' rhythm and the closing call to action. */
963
+ export interface AiSiteImportPlanDesign {
964
+ hero: 'cover' | 'poster' | 'split' | 'bleed' | 'editorial' | 'column' | 'panel';
965
+ group: 'cards' | 'ruled' | 'icons';
966
+ rhythm: 'alternate' | 'plain';
967
+ /** A closing call to action on a strong band, or over a photo. */
968
+ cta: 'band' | 'photo';
969
+ }
970
+ /** The owner's answer to the plan's review (AGL-4152): the proposed page, and generated pictures. */
971
+ export interface AiSiteImportPlanChoice {
972
+ addPage?: boolean;
973
+ pictures?: boolean;
974
+ }
975
+ /**
976
+ * Whether generated pictures are on where the owner has not said (AGL-4152):
977
+ * on, with a switch. A picture costs credits, so a wave that may take them
978
+ * quotes them in its ceiling before it starts, and the switch turns them off.
979
+ */
980
+ export declare const AI_SITE_IMPORT_GENERATED_PICTURES_DEFAULT = true;
981
+ /** What a plan's row and panel say where it did not pass (AGL-4152). */
982
+ export declare const AI_SITE_IMPORT_PLAN_FELL_BACK = "Your menu and footer stay as your site has them: the plan for your new site did not pass.";
983
+ /** The ledger slot of the plan's proposed page. */
984
+ export declare const AI_SITE_IMPORT_PROPOSED_SLOT = "proposed";
985
+ /** What a plan's answer calls its proposed page before it has an id. */
986
+ export declare const AI_SITE_IMPORT_PROPOSED_PAGE = "new";
987
+ /** The most generated pictures one page takes (AGL-4152), a hero or a section's lead only. */
988
+ export declare const AI_SITE_IMPORT_GENERATED_PICTURES_PER_PAGE = 2;
989
+ /** What the plan's own pass may spend at most: its answer and its one re-ask at the measured p90. */
990
+ export declare const AI_SITE_IMPORT_PLAN_CEILING_CREDITS = 180;
991
+ /** A section a redesign added to a page (AGL-4152): what its row and What's new say. */
992
+ export interface AiSiteImportAddedSection {
993
+ heading: string;
994
+ /** The items it holds, where it holds a group of them. */
995
+ items?: number;
996
+ }
997
+ /** What a redesigned page shows of its pictures (AGL-4152), by where each came from. */
998
+ export interface AiSiteImportPagePictures {
999
+ /** The page's own and the site's source photos placed. */
1000
+ source: number;
1001
+ /** Slots filled from the stock library. */
1002
+ stock: number;
1003
+ /** Slots filled by a generated picture. */
1004
+ generated: number;
1005
+ /** Slots with no picture yet, which a later pass fills or drops. */
1006
+ slots: number;
1007
+ /** The source's photos left off the page, by address, listed for the owner. */
1008
+ unplaced: string[];
850
1009
  }
851
1010
  /**
852
1011
  * What the home page says of the site as a whole (AGL-4084), kept from the
@@ -941,6 +1100,12 @@ export interface AiSiteImportLook {
941
1100
  rhythm?: string;
942
1101
  motion?: string;
943
1102
  } | null;
1103
+ /**
1104
+ * Under a generative Improve it (AGL-4152), the colors the theme drew, which
1105
+ * a redesign is held to as it is asked (`SiteImportFidelityTheme`). Absent
1106
+ * on every other import, and where the owner's own theme was kept.
1107
+ */
1108
+ drawn?: Record<string, unknown> | null;
944
1109
  }
945
1110
  /**
946
1111
  * - `home-blocked`: bot protection or a firewall turned AglynBot away from
@@ -1073,6 +1238,16 @@ export type AiSiteImportWork = {
1073
1238
  kind: 'read';
1074
1239
  wave: AiSiteImportWave;
1075
1240
  pages: AiSiteImportPage[];
1241
+ }
1242
+ /** The site's plan (AGL-4152), once, after the first wave's read and before its look. */
1243
+ | {
1244
+ kind: 'plan';
1245
+ wave: AiSiteImportWave;
1246
+ }
1247
+ /** The owner started the build under a plan they saw: its proposed page settled, no model. */
1248
+ | {
1249
+ kind: 'plan-accepted';
1250
+ wave: AiSiteImportWave;
1076
1251
  } | {
1077
1252
  kind: 'frame';
1078
1253
  wave: AiSiteImportWave;
@@ -1171,7 +1346,10 @@ export declare function aiSiteImportWaveChoice(state: Pick<AiSiteImportState, 'f
1171
1346
  * wave once, when it starts, so a change made before a later wave reaches only
1172
1347
  * the waves that have not started.
1173
1348
  */
1174
- export declare function aiSiteImportWaveStamped(state: AiSiteImportState, index: number): AiSiteImportState;
1349
+ export declare function aiSiteImportWaveStamped(state: AiSiteImportState, index: number, options?: {
1350
+ generative?: boolean;
1351
+ videoPosters?: boolean;
1352
+ }): AiSiteImportState;
1175
1353
  /**
1176
1354
  * The owner's change between waves (AGL-4152), as the resume door writes it
1177
1355
  * onto an import waiting for a wave: the finish, and the wording switch,
@@ -1185,6 +1363,43 @@ export declare function aiSiteImportFinishUpdate(job: Pick<AiJob, 'kind' | 'stat
1185
1363
  'siteImport.finish': AiSiteImportFinish;
1186
1364
  'siteImport.wording': boolean;
1187
1365
  } | null;
1366
+ /**
1367
+ * How a page's generative Improve it came out (AGL-4152), what it added and what
1368
+ * it shows, for its row; and the source's photos it left off, which a later
1369
+ * page's slot takes before a stock photo.
1370
+ */
1371
+ export declare function aiSiteImportRedesignOf(state: AiSiteImportState, slot: string, redesign: AiSiteImportRedesign, added?: readonly AiSiteImportAddedSection[], pictures?: AiSiteImportPagePictures | null): AiSiteImportState;
1372
+ /** Whether generated pictures are on for an import: as its owner said, else the default. */
1373
+ export declare function aiSiteImportGeneratedPicturesOn(state: Pick<AiSiteImportState, 'generatedPictures'> | null | undefined): boolean;
1374
+ /** Whether the job waits on its owner's say-so over a plan (AGL-4152): shown, and nothing of the site built. */
1375
+ export declare function aiSiteImportPlanAwaits(state: Pick<AiSiteImportState, 'plan' | 'planAccepted'> | null | undefined): boolean;
1376
+ /** Whether the site has room for a page more than the import brings in (AGL-4152): the plan's count, against what is there and what is coming. */
1377
+ export declare function aiSiteImportHasRoomForPage(state: Pick<AiSiteImportState, 'pages'>, room: {
1378
+ limit: number | null;
1379
+ used: number;
1380
+ }): boolean;
1381
+ /**
1382
+ * The plan in, or the plan that did not pass (`null`). A proposed page takes
1383
+ * its place in the wave's rows as a page of its own, new, with no source: its
1384
+ * words are written from what the site says, so its one line is its purpose.
1385
+ */
1386
+ export declare function aiSiteImportPlanIn(state: AiSiteImportState, wave: Pick<AiSiteImportWave, 'index'>, plan: AiSiteImportPlan | null, at: string, draftId: string): AiSiteImportState;
1387
+ /** A plan with its proposed page's row: pending, unless it is the one row a plan has already added. */
1388
+ export declare function aiSiteImportPlanRow(state: Pick<AiSiteImportState, 'plan'>, items: readonly AiJobItemLedger[]): AiJobItemLedger[];
1389
+ /**
1390
+ * The owner started the build (AGL-4152). A proposed page they switched off is
1391
+ * gone: its row, its place in the wave, and every menu entry that named it.
1392
+ */
1393
+ export declare function aiSiteImportPlanAccepted(state: AiSiteImportState, items: readonly AiJobItemLedger[]): {
1394
+ state: AiSiteImportState;
1395
+ items: AiJobItemLedger[];
1396
+ };
1397
+ /**
1398
+ * The owner's answer to a plan (AGL-4152), as the resume door writes it onto
1399
+ * an import waiting on one. What is not given stands. `null` when the job is
1400
+ * not an import waiting on a plan, or nothing is asked.
1401
+ */
1402
+ export declare function aiSiteImportPlanUpdate(job: Pick<AiJob, 'kind' | 'status' | 'review' | 'siteImport'>, change: AiSiteImportPlanChoice): Record<string, boolean> | null;
1188
1403
  /**
1189
1404
  * A page whose rewrite was refused (AGL-4152): it keeps every word as
1190
1405
  * written, and its row reads as kept. Only a page stamped `improved` changes.
@@ -1224,6 +1439,12 @@ export declare function aiSiteImportCreditRange(pages: number, options?: {
1224
1439
  arranged?: number;
1225
1440
  copied?: number;
1226
1441
  reworded?: number;
1442
+ /** The site's plan, still owed under a generative Improve it (AGL-4152), priced as a paid site's plan until it is measured. */
1443
+ plan?: boolean;
1444
+ /** A proposed page not yet among the wave's own, quoted as a redesigned page (AGL-4152). */
1445
+ proposed?: number;
1446
+ /** Generated pictures it may take at most (AGL-4152): in its ceiling only, since each takes what nothing else fills. */
1447
+ pictures?: number;
1227
1448
  }): AiCreditRange;
1228
1449
  /**
1229
1450
  * What a wave still owes, by how its pages are built, and whether its header
@@ -1237,7 +1458,16 @@ export declare function aiSiteImportWaveOwed(state: AiSiteImportState, wave: AiS
1237
1458
  reworded: number;
1238
1459
  copied: number;
1239
1460
  frame: boolean;
1461
+ plan?: boolean;
1462
+ proposed?: number;
1463
+ pictures?: number;
1240
1464
  };
1465
+ /**
1466
+ * Whether a wave is a generative Improve it (AGL-4152): as stamped once it has
1467
+ * started; before, whether the import was read under the flag and asks to be
1468
+ * improved now.
1469
+ */
1470
+ export declare function aiSiteImportWaveIsGenerative(state: Pick<AiSiteImportState, 'generative' | 'finish' | 'wording'>, wave: AiSiteImportWave): boolean;
1241
1471
  /** A wave's quote: the pages it has still to bring in, and its header and footer while they are owed. */
1242
1472
  export declare function aiSiteImportWaveCreditRange(state: AiSiteImportState, wave: AiSiteImportWave, items?: readonly AiJobItemLedger[] | null): AiCreditRange;
1243
1473
  /** Every wave still waiting, quoted at once: "Start every remaining wave" (AGL-4083). */
@@ -1247,7 +1477,9 @@ export declare function aiSiteImportRemainingCreditRange(state: AiSiteImportStat
1247
1477
  * they are"; the build is named once the step has chosen, and pages whose
1248
1478
  * words are improved too (AGL-4152) as "arranged and reworded by Aglyn AI".
1249
1479
  */
1250
- export declare function aiSiteImportQuoteText(range: AiCreditRange, owed: Pick<ReturnType<typeof aiSiteImportWaveOwed>, 'arranged' | 'copied'> & Partial<Pick<ReturnType<typeof aiSiteImportWaveOwed>, 'reworded'>>): string;
1480
+ export declare function aiSiteImportQuoteText(range: AiCreditRange, owed: Pick<ReturnType<typeof aiSiteImportWaveOwed>, 'arranged' | 'copied'> & Partial<Pick<ReturnType<typeof aiSiteImportWaveOwed>, 'reworded' | 'plan' | 'proposed' | 'pictures'>>, options?: {
1481
+ generative?: boolean;
1482
+ }): string;
1251
1483
  /** Why a page is not brought in, as a person reads it. */
1252
1484
  export declare const AI_SITE_IMPORT_LEFT_OUT_COPY: Readonly<Record<AiSiteImportLeftOutReason, string>>;
1253
1485
  /** "3 pages" / "1 page". */