@aglyn/plugins-ai 1.15.0 → 1.15.2

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 (32) hide show
  1. package/package.json +17 -17
  2. package/src/lib/components/ai-site-import-start.component.js +3 -1
  3. package/src/lib/components/ai-site-import-start.component.js.map +1 -1
  4. package/src/lib/jobs/ai-job-import-step.d.ts +18 -2
  5. package/src/lib/jobs/ai-job-import-step.js +24 -8
  6. package/src/lib/jobs/ai-job-import-step.js.map +1 -1
  7. package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
  8. package/src/lib/jobs/ai-job-page-language.js +72 -37
  9. package/src/lib/jobs/ai-job-page-language.js.map +1 -1
  10. package/src/lib/jobs/ai-job-page-step.js +5 -3
  11. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  12. package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
  13. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  14. package/src/lib/jobs/ai-site-import-compile.js +26 -1
  15. package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
  16. package/src/lib/jobs/ai-site-import-improve.d.ts +59 -6
  17. package/src/lib/jobs/ai-site-import-improve.js +149 -19
  18. package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
  19. package/src/lib/jobs/ai-site-import-plan.js +1 -1
  20. package/src/lib/jobs/ai-site-import-plan.js.map +1 -1
  21. package/src/lib/model/ai-credit-estimate.d.ts +16 -0
  22. package/src/lib/model/ai-credit-estimate.js +14 -0
  23. package/src/lib/model/ai-credit-estimate.js.map +1 -1
  24. package/src/lib/model/ai-site-import-fidelity.d.ts +2 -0
  25. package/src/lib/model/ai-site-import-fidelity.js +7 -1
  26. package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
  27. package/src/lib/model/ai-site-import-view.d.ts +3 -1
  28. package/src/lib/model/ai-site-import-view.js +8 -3
  29. package/src/lib/model/ai-site-import-view.js.map +1 -1
  30. package/src/lib/model/ai-site-import.d.ts +27 -2
  31. package/src/lib/model/ai-site-import.js +63 -14
  32. package/src/lib/model/ai-site-import.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-ai",
3
- "version": "1.15.0",
3
+ "version": "1.15.2",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,22 +25,22 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.15.0",
29
- "@aglyn/shared-data-enums": "1.15.0",
30
- "@aglyn/shared-data-mdi": "1.15.0",
31
- "@aglyn/shared-data-types": "1.15.0",
32
- "@aglyn/shared-ui-email-campaigns": "1.15.0",
33
- "@aglyn/shared-ui-jsx": "1.15.0",
34
- "@aglyn/shared-ui-snackstack": "1.15.0",
35
- "@aglyn/shared-ui-theme": "1.15.0",
36
- "@aglyn/shared-util-email": "1.15.0",
37
- "@aglyn/shared-util-errors": "1.15.0",
38
- "@aglyn/shared-util-http": "1.15.0",
39
- "@aglyn/shared-util-timestamp": "1.15.0",
40
- "@aglyn/shared-util-tools": "1.15.0",
41
- "@aglyn/tenant-data-admin": "1.15.0",
42
- "@aglyn/tenant-feature-instance": "1.15.0",
43
- "@aglyn/tenant-runtime": "1.15.0",
28
+ "@aglyn/aglyn": "1.15.2",
29
+ "@aglyn/shared-data-enums": "1.15.2",
30
+ "@aglyn/shared-data-mdi": "1.15.2",
31
+ "@aglyn/shared-data-types": "1.15.2",
32
+ "@aglyn/shared-ui-email-campaigns": "1.15.2",
33
+ "@aglyn/shared-ui-jsx": "1.15.2",
34
+ "@aglyn/shared-ui-snackstack": "1.15.2",
35
+ "@aglyn/shared-ui-theme": "1.15.2",
36
+ "@aglyn/shared-util-email": "1.15.2",
37
+ "@aglyn/shared-util-errors": "1.15.2",
38
+ "@aglyn/shared-util-http": "1.15.2",
39
+ "@aglyn/shared-util-timestamp": "1.15.2",
40
+ "@aglyn/shared-util-tools": "1.15.2",
41
+ "@aglyn/tenant-data-admin": "1.15.2",
42
+ "@aglyn/tenant-feature-instance": "1.15.2",
43
+ "@aglyn/tenant-runtime": "1.15.2",
44
44
  "@swc/helpers": "0.5.23"
45
45
  },
46
46
  "peerDependencies": {
@@ -320,7 +320,9 @@ import { AiSiteOwnershipProof, postAiSiteOwnership } from "./ai-site-ownership-p
320
320
  /*#__PURE__*/ _jsx(AiSiteImportFinish, {
321
321
  value: finish,
322
322
  onChange: setFinish,
323
- wordingCredits: aiSiteImportWordingCreditsText(null),
323
+ wordingCredits: aiSiteImportWordingCreditsText(null, generative === true ? {
324
+ generative: true
325
+ } : {}),
324
326
  help: AI_SITE_IMPORT_HELP.finish,
325
327
  disabled: busy,
326
328
  generative: generative === true
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-site-import-start.component.tsx"],"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'use client'\n\nimport { lockdownRefusalText, parseLockdownRefusal, PLATFORM_BRAND_NAME } from '@aglyn/aglyn'\nimport type { ConsolePendingSite } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport { mdiWebSync } from '@aglyn/shared-data-mdi'\nimport { HelpTip, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport { authorizedFetch, type MaybeTokenSource } from '@aglyn/shared-util-http/authorized-token'\nimport { Alert, Box, Button, Stack, TextField, Typography } from '@mui/material'\nimport { useRouter } from 'next/navigation'\nimport { useCallback, useRef, useState } from 'react'\nimport type { AiJobSummary } from '../model/ai-jobs.types'\nimport {\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_DOMAIN_INPUT,\n AI_SITE_IMPORT_FINISH_INPUT,\n AI_SITE_IMPORT_KIND,\n AI_SITE_IMPORT_WAVE_PAGES,\n AI_SITE_IMPORT_WORDING_INPUT,\n} from '../model/ai-site-import'\nimport {\n aiSiteImportFieldChoice,\n aiSiteImportWordingCreditsText,\n type AiSiteImportClaim,\n type AiSiteImportFinishField,\n} from '../model/ai-site-import-view'\nimport { aiSiteBuildHref } from './ai-job-links'\nimport { publishAiJob } from './ai-jobs-store'\nimport { AiSiteImportFinish } from './ai-site-import-finish.component'\nimport { AiSiteOwnershipProof, postAiSiteOwnership } from './ai-site-ownership-proof.component'\n\n/** Each part of the flow links its own section of the Bring my site guide. */\nexport const AI_SITE_IMPORT_HELP = {\n address: pluginDocsHelp('aiImport', {\n anchor: '#your-current-website',\n excerpt: 'The address people type to reach your site today. You prove it is yours next, so only a site you own can be brought in.',\n }),\n prove: pluginDocsHelp('aiImport', {\n anchor: '#prove-it-is-yours',\n excerpt: 'Add a DNS record, add a tag to your home page, or get a code at an address at your domain. Any one is enough.',\n }),\n finish: pluginDocsHelp('aiImport', {\n anchor: '#keep-or-improve',\n excerpt: 'Keep my site keeps your pages laid out as they are, every word as you wrote it. Improve it redesigns each page around your brand, and can improve the wording of your main pages too. You can change it before each wave.',\n }),\n waves: pluginDocsHelp('aiImport', {\n anchor: '#waves',\n excerpt: 'Your main pages come in first, then each collection, such as blog posts, ten pages at a time. You review each wave and start the next yourself.',\n }),\n turnedAway: pluginDocsHelp('aiImport', {\n anchor: '#turned-away',\n excerpt: 'Allow AglynBot in your site’s bot protection or firewall settings, then choose Check again. Reading your site again uses no AI credits.',\n }),\n}\n\ntype Step = 'address' | 'prove' | 'read'\n\nexport interface AiSiteImportStartProps {\n orgId: string\n orgSlug: string | null\n hostId: string | null\n host: string | null\n user: MaybeTokenSource\n /** The site being created by \"Create site\", when it does not exist yet (AGL-3761). */\n pendingSite?: ConsolePendingSite\n /** Back to how the site starts. */\n onBack: () => void\n /** The dialog closes before the job's page opens. */\n leave?: () => void\n /** A generative Improve it is on for this workspace (AGL-4152): its words for the choice. */\n generative?: boolean\n}\n\n/**\n * \"Bring my site\" (AGL-3976): the address of the site the person has now,\n * the proof that it is theirs, what happens next, and how the new site should\n * look: Keep my site or Improve it (AGL-4152), Improve it preselected with its\n * wording switch on — then the site is read and its waves planned, nothing\n * built, on the import job's own page, where the choice can change before\n * each wave.\n *\n * Nothing is created until \"Read my site\": the site in Create site is made\n * then, empty, and the import job is started on it. The job reads the site\n * and waits for the person to start its first wave, so even this costs no\n * AI credits.\n */\nexport function AiSiteImportStart({ orgId, orgSlug, hostId, host, user, pendingSite, onBack, leave, generative }: AiSiteImportStartProps) {\n const router = useRouter()\n const userRef = useRef(user)\n userRef.current = user\n const [step, setStep] = useState<Step>('address')\n const [address, setAddress] = useState('')\n const [claim, setClaim] = useState<AiSiteImportClaim | null>(null)\n const [notice, setNotice] = useState<string | null>(null)\n const [busy, setBusy] = useState(false)\n // A site already verified skips the proof step, and Back skips it too.\n const [proved, setProved] = useState(false)\n // Keep my site or Improve it (AGL-4152): Improve it, with its wording, unless the person picks otherwise.\n const [finish, setFinish] = useState<AiSiteImportFinishField>(() => ({ ...AI_SITE_IMPORT_DEFAULT_CHOICE }))\n\n const claimIt = useCallback(async () => {\n setBusy(true)\n setNotice(null)\n const answer = await postAiSiteOwnership(userRef.current, { orgId, action: 'claim', domain: address })\n setBusy(false)\n if (!answer.claim) {\n setNotice(answer.message ?? 'That address could not be used.')\n return\n }\n setClaim(answer.claim)\n setProved(!answer.claim.current)\n setStep(answer.claim.current ? 'read' : 'prove')\n }, [orgId, address])\n\n const read = useCallback(async () => {\n if (!claim?.current) return\n setBusy(true)\n setNotice(null)\n try {\n const choice = aiSiteImportFieldChoice(finish)\n const requestJob = (siteId: string | null, check: boolean) =>\n authorizedFetch(userRef.current, '/api/ai/jobs', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n orgId,\n hostId: siteId,\n kind: AI_SITE_IMPORT_KIND,\n brief: `Bring in ${claim.domain}`,\n inputs: {\n [AI_SITE_IMPORT_DOMAIN_INPUT]: claim.domain,\n [AI_SITE_IMPORT_FINISH_INPUT]: choice.finish,\n [AI_SITE_IMPORT_WORDING_INPUT]: choice.wording,\n },\n ...(check ? { check: true } : {}),\n }),\n })\n const refused = async (response: Response): Promise<Record<string, unknown> | null> => {\n const payload = (await response.json().catch(() => null)) as Record<string, unknown> | null\n if (response.ok) return payload ?? {}\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(locked ? lockdownRefusalText(locked) : String(payload?.['error'] ?? 'Your site could not be read. Try again.'))\n return null\n }\n let site = { hostId, host, orgSlug }\n if (!hostId && pendingSite) {\n // Asked before the site exists, so a refusal creates nothing (AGL-3859).\n if (!pendingSite.created && !(await refused(await requestJob(null, true)))) return\n // A site brought in starts in preview unless the person switched it\n // off (AGL-4086): its pages arrive here before anyone has looked.\n const made = await pendingSite.create({ start: 'import' })\n if ('error' in made) {\n setNotice(made.error)\n if (made.address) onBack()\n return\n }\n site = { hostId: made.hostId, host: made.host, orgSlug: made.orgSlug || orgSlug }\n }\n if (!site.hostId) return\n const payload = await refused(await requestJob(site.hostId, false))\n const job = (payload?.['job'] as AiJobSummary | undefined) ?? null\n if (!job) {\n if (payload) setNotice('Your site could not be read. Try again.')\n return\n }\n publishAiJob(job)\n const href = aiSiteBuildHref(site.orgSlug, site.host, job.id)\n if (href) {\n leave?.()\n router.push(href)\n }\n } catch {\n setNotice('Your site could not be read. Try again.')\n } finally {\n setBusy(false)\n }\n }, [claim, finish, orgId, hostId, host, orgSlug, pendingSite, onBack, leave, router])\n\n const back = () => {\n setNotice(null)\n if (step === 'address') onBack()\n else if (step === 'prove') setStep('address')\n else setStep(proved ? 'prove' : 'address')\n }\n\n return (\n <Stack spacing={3} component=\"section\" aria-label=\"Bring my site\" data-start-area=\"import\">\n {notice && <Alert severity=\"info\">{notice}</Alert>}\n {step === 'address' && (\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {'Your current website'}\n </Typography>\n <HelpTip {...AI_SITE_IMPORT_HELP.address} />\n </Stack>\n <TextField\n label=\"Website address\"\n placeholder=\"example.com\"\n value={address}\n autoFocus\n onChange={(event) => setAddress(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && address.trim() && !busy) {\n event.preventDefault()\n void claimIt()\n }\n }}\n helperText=\"The address people type to reach your site today. You prove it is yours next.\"\n />\n </Stack>\n )}\n {step === 'prove' && claim && (\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {'Prove it is yours'}\n </Typography>\n <HelpTip {...AI_SITE_IMPORT_HELP.prove} />\n </Stack>\n <AiSiteOwnershipProof orgId={orgId} user={user} claim={claim} onClaim={setClaim} />\n </Stack>\n )}\n {step === 'read' && claim && (\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {`Bring in ${claim.domain}`}\n </Typography>\n <HelpTip {...AI_SITE_IMPORT_HELP.waves} />\n </Stack>\n <Box component=\"ul\" sx={{ m: 0, pl: 3, '& li': { mb: 1 } }}>\n <Typography component=\"li\" variant=\"body2\">\n {`AglynBot reads your whole site, home page first, as many pages as your plan includes: your main pages first, then collections such as blog posts.`}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {`You see what was found, what could not be read and why, and what each wave of up to ${AI_SITE_IMPORT_WAVE_PAGES} pages costs before anything is built. Reading your site uses no AI credits.`}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {'If your home page cannot be read, nothing is planned and no AI credits are used. You are told why, and you check again once it can be.'}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {'Every page comes across with its sections, columns, cards, icons, pictures, tables, tabs and forms, finished the way you choose below. You review each wave and start the next yourself.'}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {'Each wave lands in your new site’s preview, where only you and your team can see it, until you make the site public. A site not in preview keeps its pages as drafts. Your current site is not changed.'}\n </Typography>\n </Box>\n {/* Keep my site or Improve it (AGL-4152), above the preview control. */}\n <AiSiteImportFinish\n value={finish}\n onChange={setFinish}\n wordingCredits={aiSiteImportWordingCreditsText(null)}\n help={AI_SITE_IMPORT_HELP.finish}\n disabled={busy}\n generative={generative === true}\n />\n {/* Start in preview (AGL-4086), for a site this creates: on unless\n the person switches it off. */}\n {!hostId && pendingSite && !pendingSite.created\n ? pendingSite.previewControl?.('import')\n : null}\n </Stack>\n )}\n <Stack direction=\"row\" spacing={1} sx={{ justifyContent: 'space-between' }}>\n <Button onClick={back} disabled={busy}>\n {'Back'}\n </Button>\n {step === 'address' && (\n <Button variant=\"contained\" disabled={busy || !address.trim()} onClick={() => void claimIt()}>\n {busy ? 'Checking…' : 'Next'}\n </Button>\n )}\n {step === 'prove' && (\n <Button variant=\"contained\" disabled={!claim?.current} onClick={() => setStep('read')}>\n {'Next'}\n </Button>\n )}\n {step === 'read' && (\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy || !claim?.current}\n onClick={() => void read()}\n startIcon={<MdiIcon path={mdiWebSync.path} />}\n >\n {busy ? 'Starting…' : 'Read my site'}\n </Button>\n )}\n </Stack>\n </Stack>\n )\n}\n\nexport default AiSiteImportStart\n"],"names":["lockdownRefusalText","parseLockdownRefusal","pluginDocsHelp","mdiWebSync","HelpTip","MdiIcon","authorizedFetch","Alert","Box","Button","Stack","TextField","Typography","useRouter","useCallback","useRef","useState","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_DOMAIN_INPUT","AI_SITE_IMPORT_FINISH_INPUT","AI_SITE_IMPORT_KIND","AI_SITE_IMPORT_WAVE_PAGES","AI_SITE_IMPORT_WORDING_INPUT","aiSiteImportFieldChoice","aiSiteImportWordingCreditsText","aiSiteBuildHref","publishAiJob","AiSiteImportFinish","AiSiteOwnershipProof","postAiSiteOwnership","AI_SITE_IMPORT_HELP","address","anchor","excerpt","prove","finish","waves","turnedAway","AiSiteImportStart","orgId","orgSlug","hostId","host","user","pendingSite","onBack","leave","generative","router","userRef","current","step","setStep","setAddress","claim","setClaim","notice","setNotice","busy","setBusy","proved","setProved","setFinish","claimIt","answer","action","domain","message","read","choice","requestJob","siteId","check","method","headers","body","JSON","stringify","kind","brief","inputs","wording","refused","response","payload","json","catch","ok","locked","status","String","site","created","made","create","start","error","job","href","id","push","back","spacing","component","aria-label","data-start-area","severity","direction","sx","alignItems","variant","label","placeholder","value","autoFocus","onChange","event","target","onKeyDown","key","trim","preventDefault","helperText","onClaim","m","pl","mb","wordingCredits","help","disabled","previewControl","justifyContent","onClick","size","startIcon","path"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAA6B,eAAc;AAE7F,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,OAAO,EAAEC,OAAO,QAAQ,uBAAsB;AACvD,SAASC,eAAe,QAA+B,2CAA0C;AACjG,SAASC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAe;AAChF,SAASC,SAAS,QAAQ,kBAAiB;AAC3C,SAASC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAErD,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,yBAAyB,EACzBC,4BAA4B,QACvB,6BAAyB;AAChC,SACEC,uBAAuB,EACvBC,8BAA8B,QAGzB,kCAA8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,KAAC1C;wBACCqG,SAAQ;wBACRuB,MAAK;wBACLJ,UAAUvE,QAAQ,EAACJ,yBAAAA,MAAOJ,OAAO;wBACjCkF,SAAS,IAAM,KAAKhE;wBACpBkE,yBAAW,KAACjI;4BAAQkI,MAAMpI,WAAWoI,IAAI;;kCAExC7E,OAAO,cAAc;;;;;;AAMlC;AAEA,eAAepB,kBAAiB"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-site-import-start.component.tsx"],"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'use client'\n\nimport { lockdownRefusalText, parseLockdownRefusal, PLATFORM_BRAND_NAME } from '@aglyn/aglyn'\nimport type { ConsolePendingSite } from '@aglyn/aglyn/plugin-manager/feature-plugins'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport { mdiWebSync } from '@aglyn/shared-data-mdi'\nimport { HelpTip, MdiIcon } from '@aglyn/shared-ui-jsx'\nimport { authorizedFetch, type MaybeTokenSource } from '@aglyn/shared-util-http/authorized-token'\nimport { Alert, Box, Button, Stack, TextField, Typography } from '@mui/material'\nimport { useRouter } from 'next/navigation'\nimport { useCallback, useRef, useState } from 'react'\nimport type { AiJobSummary } from '../model/ai-jobs.types'\nimport {\n AI_SITE_IMPORT_DEFAULT_CHOICE,\n AI_SITE_IMPORT_DOMAIN_INPUT,\n AI_SITE_IMPORT_FINISH_INPUT,\n AI_SITE_IMPORT_KIND,\n AI_SITE_IMPORT_WAVE_PAGES,\n AI_SITE_IMPORT_WORDING_INPUT,\n} from '../model/ai-site-import'\nimport {\n aiSiteImportFieldChoice,\n aiSiteImportWordingCreditsText,\n type AiSiteImportClaim,\n type AiSiteImportFinishField,\n} from '../model/ai-site-import-view'\nimport { aiSiteBuildHref } from './ai-job-links'\nimport { publishAiJob } from './ai-jobs-store'\nimport { AiSiteImportFinish } from './ai-site-import-finish.component'\nimport { AiSiteOwnershipProof, postAiSiteOwnership } from './ai-site-ownership-proof.component'\n\n/** Each part of the flow links its own section of the Bring my site guide. */\nexport const AI_SITE_IMPORT_HELP = {\n address: pluginDocsHelp('aiImport', {\n anchor: '#your-current-website',\n excerpt: 'The address people type to reach your site today. You prove it is yours next, so only a site you own can be brought in.',\n }),\n prove: pluginDocsHelp('aiImport', {\n anchor: '#prove-it-is-yours',\n excerpt: 'Add a DNS record, add a tag to your home page, or get a code at an address at your domain. Any one is enough.',\n }),\n finish: pluginDocsHelp('aiImport', {\n anchor: '#keep-or-improve',\n excerpt: 'Keep my site keeps your pages laid out as they are, every word as you wrote it. Improve it redesigns each page around your brand, and can improve the wording of your main pages too. You can change it before each wave.',\n }),\n waves: pluginDocsHelp('aiImport', {\n anchor: '#waves',\n excerpt: 'Your main pages come in first, then each collection, such as blog posts, ten pages at a time. You review each wave and start the next yourself.',\n }),\n turnedAway: pluginDocsHelp('aiImport', {\n anchor: '#turned-away',\n excerpt: 'Allow AglynBot in your site’s bot protection or firewall settings, then choose Check again. Reading your site again uses no AI credits.',\n }),\n}\n\ntype Step = 'address' | 'prove' | 'read'\n\nexport interface AiSiteImportStartProps {\n orgId: string\n orgSlug: string | null\n hostId: string | null\n host: string | null\n user: MaybeTokenSource\n /** The site being created by \"Create site\", when it does not exist yet (AGL-3761). */\n pendingSite?: ConsolePendingSite\n /** Back to how the site starts. */\n onBack: () => void\n /** The dialog closes before the job's page opens. */\n leave?: () => void\n /** A generative Improve it is on for this workspace (AGL-4152): its words for the choice. */\n generative?: boolean\n}\n\n/**\n * \"Bring my site\" (AGL-3976): the address of the site the person has now,\n * the proof that it is theirs, what happens next, and how the new site should\n * look: Keep my site or Improve it (AGL-4152), Improve it preselected with its\n * wording switch on — then the site is read and its waves planned, nothing\n * built, on the import job's own page, where the choice can change before\n * each wave.\n *\n * Nothing is created until \"Read my site\": the site in Create site is made\n * then, empty, and the import job is started on it. The job reads the site\n * and waits for the person to start its first wave, so even this costs no\n * AI credits.\n */\nexport function AiSiteImportStart({ orgId, orgSlug, hostId, host, user, pendingSite, onBack, leave, generative }: AiSiteImportStartProps) {\n const router = useRouter()\n const userRef = useRef(user)\n userRef.current = user\n const [step, setStep] = useState<Step>('address')\n const [address, setAddress] = useState('')\n const [claim, setClaim] = useState<AiSiteImportClaim | null>(null)\n const [notice, setNotice] = useState<string | null>(null)\n const [busy, setBusy] = useState(false)\n // A site already verified skips the proof step, and Back skips it too.\n const [proved, setProved] = useState(false)\n // Keep my site or Improve it (AGL-4152): Improve it, with its wording, unless the person picks otherwise.\n const [finish, setFinish] = useState<AiSiteImportFinishField>(() => ({ ...AI_SITE_IMPORT_DEFAULT_CHOICE }))\n\n const claimIt = useCallback(async () => {\n setBusy(true)\n setNotice(null)\n const answer = await postAiSiteOwnership(userRef.current, { orgId, action: 'claim', domain: address })\n setBusy(false)\n if (!answer.claim) {\n setNotice(answer.message ?? 'That address could not be used.')\n return\n }\n setClaim(answer.claim)\n setProved(!answer.claim.current)\n setStep(answer.claim.current ? 'read' : 'prove')\n }, [orgId, address])\n\n const read = useCallback(async () => {\n if (!claim?.current) return\n setBusy(true)\n setNotice(null)\n try {\n const choice = aiSiteImportFieldChoice(finish)\n const requestJob = (siteId: string | null, check: boolean) =>\n authorizedFetch(userRef.current, '/api/ai/jobs', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n orgId,\n hostId: siteId,\n kind: AI_SITE_IMPORT_KIND,\n brief: `Bring in ${claim.domain}`,\n inputs: {\n [AI_SITE_IMPORT_DOMAIN_INPUT]: claim.domain,\n [AI_SITE_IMPORT_FINISH_INPUT]: choice.finish,\n [AI_SITE_IMPORT_WORDING_INPUT]: choice.wording,\n },\n ...(check ? { check: true } : {}),\n }),\n })\n const refused = async (response: Response): Promise<Record<string, unknown> | null> => {\n const payload = (await response.json().catch(() => null)) as Record<string, unknown> | null\n if (response.ok) return payload ?? {}\n const locked = parseLockdownRefusal(response.status, payload)\n setNotice(locked ? lockdownRefusalText(locked) : String(payload?.['error'] ?? 'Your site could not be read. Try again.'))\n return null\n }\n let site = { hostId, host, orgSlug }\n if (!hostId && pendingSite) {\n // Asked before the site exists, so a refusal creates nothing (AGL-3859).\n if (!pendingSite.created && !(await refused(await requestJob(null, true)))) return\n // A site brought in starts in preview unless the person switched it\n // off (AGL-4086): its pages arrive here before anyone has looked.\n const made = await pendingSite.create({ start: 'import' })\n if ('error' in made) {\n setNotice(made.error)\n if (made.address) onBack()\n return\n }\n site = { hostId: made.hostId, host: made.host, orgSlug: made.orgSlug || orgSlug }\n }\n if (!site.hostId) return\n const payload = await refused(await requestJob(site.hostId, false))\n const job = (payload?.['job'] as AiJobSummary | undefined) ?? null\n if (!job) {\n if (payload) setNotice('Your site could not be read. Try again.')\n return\n }\n publishAiJob(job)\n const href = aiSiteBuildHref(site.orgSlug, site.host, job.id)\n if (href) {\n leave?.()\n router.push(href)\n }\n } catch {\n setNotice('Your site could not be read. Try again.')\n } finally {\n setBusy(false)\n }\n }, [claim, finish, orgId, hostId, host, orgSlug, pendingSite, onBack, leave, router])\n\n const back = () => {\n setNotice(null)\n if (step === 'address') onBack()\n else if (step === 'prove') setStep('address')\n else setStep(proved ? 'prove' : 'address')\n }\n\n return (\n <Stack spacing={3} component=\"section\" aria-label=\"Bring my site\" data-start-area=\"import\">\n {notice && <Alert severity=\"info\">{notice}</Alert>}\n {step === 'address' && (\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {'Your current website'}\n </Typography>\n <HelpTip {...AI_SITE_IMPORT_HELP.address} />\n </Stack>\n <TextField\n label=\"Website address\"\n placeholder=\"example.com\"\n value={address}\n autoFocus\n onChange={(event) => setAddress(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && address.trim() && !busy) {\n event.preventDefault()\n void claimIt()\n }\n }}\n helperText=\"The address people type to reach your site today. You prove it is yours next.\"\n />\n </Stack>\n )}\n {step === 'prove' && claim && (\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {'Prove it is yours'}\n </Typography>\n <HelpTip {...AI_SITE_IMPORT_HELP.prove} />\n </Stack>\n <AiSiteOwnershipProof orgId={orgId} user={user} claim={claim} onClaim={setClaim} />\n </Stack>\n )}\n {step === 'read' && claim && (\n <Stack spacing={2}>\n <Stack direction=\"row\" spacing={0.5} sx={{ alignItems: 'center' }}>\n <Typography variant=\"subtitle1\" component=\"h2\">\n {`Bring in ${claim.domain}`}\n </Typography>\n <HelpTip {...AI_SITE_IMPORT_HELP.waves} />\n </Stack>\n <Box component=\"ul\" sx={{ m: 0, pl: 3, '& li': { mb: 1 } }}>\n <Typography component=\"li\" variant=\"body2\">\n {`AglynBot reads your whole site, home page first, as many pages as your plan includes: your main pages first, then collections such as blog posts.`}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {`You see what was found, what could not be read and why, and what each wave of up to ${AI_SITE_IMPORT_WAVE_PAGES} pages costs before anything is built. Reading your site uses no AI credits.`}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {'If your home page cannot be read, nothing is planned and no AI credits are used. You are told why, and you check again once it can be.'}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {'Every page comes across with its sections, columns, cards, icons, pictures, tables, tabs and forms, finished the way you choose below. You review each wave and start the next yourself.'}\n </Typography>\n <Typography component=\"li\" variant=\"body2\">\n {'Each wave lands in your new site’s preview, where only you and your team can see it, until you make the site public. A site not in preview keeps its pages as drafts. Your current site is not changed.'}\n </Typography>\n </Box>\n {/* Keep my site or Improve it (AGL-4152), above the preview control. */}\n <AiSiteImportFinish\n value={finish}\n onChange={setFinish}\n wordingCredits={aiSiteImportWordingCreditsText(null, generative === true ? { generative: true } : {})}\n help={AI_SITE_IMPORT_HELP.finish}\n disabled={busy}\n generative={generative === true}\n />\n {/* Start in preview (AGL-4086), for a site this creates: on unless\n the person switches it off. */}\n {!hostId && pendingSite && !pendingSite.created\n ? pendingSite.previewControl?.('import')\n : null}\n </Stack>\n )}\n <Stack direction=\"row\" spacing={1} sx={{ justifyContent: 'space-between' }}>\n <Button onClick={back} disabled={busy}>\n {'Back'}\n </Button>\n {step === 'address' && (\n <Button variant=\"contained\" disabled={busy || !address.trim()} onClick={() => void claimIt()}>\n {busy ? 'Checking…' : 'Next'}\n </Button>\n )}\n {step === 'prove' && (\n <Button variant=\"contained\" disabled={!claim?.current} onClick={() => setStep('read')}>\n {'Next'}\n </Button>\n )}\n {step === 'read' && (\n <Button\n variant=\"contained\"\n size=\"large\"\n disabled={busy || !claim?.current}\n onClick={() => void read()}\n startIcon={<MdiIcon path={mdiWebSync.path} />}\n >\n {busy ? 'Starting…' : 'Read my site'}\n </Button>\n )}\n </Stack>\n </Stack>\n )\n}\n\nexport default AiSiteImportStart\n"],"names":["lockdownRefusalText","parseLockdownRefusal","pluginDocsHelp","mdiWebSync","HelpTip","MdiIcon","authorizedFetch","Alert","Box","Button","Stack","TextField","Typography","useRouter","useCallback","useRef","useState","AI_SITE_IMPORT_DEFAULT_CHOICE","AI_SITE_IMPORT_DOMAIN_INPUT","AI_SITE_IMPORT_FINISH_INPUT","AI_SITE_IMPORT_KIND","AI_SITE_IMPORT_WAVE_PAGES","AI_SITE_IMPORT_WORDING_INPUT","aiSiteImportFieldChoice","aiSiteImportWordingCreditsText","aiSiteBuildHref","publishAiJob","AiSiteImportFinish","AiSiteOwnershipProof","postAiSiteOwnership","AI_SITE_IMPORT_HELP","address","anchor","excerpt","prove","finish","waves","turnedAway","AiSiteImportStart","orgId","orgSlug","hostId","host","user","pendingSite","onBack","leave","generative","router","userRef","current","step","setStep","setAddress","claim","setClaim","notice","setNotice","busy","setBusy","proved","setProved","setFinish","claimIt","answer","action","domain","message","read","choice","requestJob","siteId","check","method","headers","body","JSON","stringify","kind","brief","inputs","wording","refused","response","payload","json","catch","ok","locked","status","String","site","created","made","create","start","error","job","href","id","push","back","spacing","component","aria-label","data-start-area","severity","direction","sx","alignItems","variant","label","placeholder","value","autoFocus","onChange","event","target","onKeyDown","key","trim","preventDefault","helperText","onClaim","m","pl","mb","wordingCredits","help","disabled","previewControl","justifyContent","onClick","size","startIcon","path"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAA6B,eAAc;AAE7F,SAASC,cAAc,QAAQ,mCAAkC;AACjE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,OAAO,EAAEC,OAAO,QAAQ,uBAAsB;AACvD,SAASC,eAAe,QAA+B,2CAA0C;AACjG,SAASC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAe;AAChF,SAASC,SAAS,QAAQ,kBAAiB;AAC3C,SAASC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAErD,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,yBAAyB,EACzBC,4BAA4B,QACvB,6BAAyB;AAChC,SACEC,uBAAuB,EACvBC,8BAA8B,QAGzB,kCAA8B;AACrC,SAASC,eAAe,QAAQ,oBAAgB;AAChD,SAASC,YAAY,QAAQ,qBAAiB;AAC9C,SAASC,kBAAkB,QAAQ,uCAAmC;AACtE,SAASC,oBAAoB,EAAEC,mBAAmB,QAAQ,yCAAqC;AAE/F,4EAA4E,GAC5E,OAAO,MAAMC,sBAAsB;IACjCC,SAAS7B,eAAe,YAAY;QACl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kCAExC7E,OAAO,cAAc;;;;;;AAMlC;AAEA,eAAepB,kBAAiB"}
@@ -195,10 +195,19 @@ export declare function aiSiteImportLogoHoldsName(input: {
195
195
  alt: string;
196
196
  siteName: string;
197
197
  }): boolean;
198
+ /** How a redesigned header sizes its logo (AGL-4152): the width it reads at, and the heights the header's bar holds it between. */
199
+ export declare const AI_SITE_IMPORT_LOGO_SCALE: {
200
+ readonly width: 150;
201
+ readonly least: 32;
202
+ readonly most: 56;
203
+ };
198
204
  /**
199
205
  * The height a redesigned header draws its logo at (AGL-4152), a Besigner field
200
- * like any: a mark about square a little taller, a wordmark held to a width the
201
- * row has room for, and neither under what reads on a phone.
206
+ * like any. A logo reads by its width, as a designer sizes one: about
207
+ * `AI_SITE_IMPORT_LOGO_SCALE.width` across, never taller than the bar holds on
208
+ * a phone, and never so short a long wordmark's letters stop reading. A lockup
209
+ * of a mark and stacked words (about twice as wide as tall) then stands as tall
210
+ * as the bar allows, where a fixed 40px drew it the size of a menu label.
202
211
  */
203
212
  export declare function aiSiteImportLogoHeight(aspect: number | null): string;
204
213
  /** A tile's fill and its icon as theme roles (AGL-4139): on a filled tile of the brand's or the second color, the icon in that color's own ink. */
@@ -218,6 +227,13 @@ export declare function aiSiteImportFrameColorRole(hex: string | null, kind: 'fi
218
227
  export declare function aiSiteImportFrameJob(job: AiJob, state: AiSiteImportState, wave: AiSiteImportWave, items: readonly AiJobItemLedger[]): AiJob;
219
228
  /** What the site says of itself (AGL-4152): the home page's description and facts and the pages it brings in, the same bytes on every page. */
220
229
  export declare function aiSiteImportSiteLines(state: AiSiteImportState): string[];
230
+ /**
231
+ * The lines of a wave's other pages, as far as they are read (AGL-4152): a
232
+ * fact one of them says is no invention. What the site's pages said as their
233
+ * wave read them comes first (`said`): a page's read is emptied once it is in,
234
+ * so an earlier page's lines would otherwise be gone by the next page.
235
+ */
236
+ export declare function aiSiteImportWaveLines(state: AiSiteImportState, page: AiSiteImportPage): string[];
221
237
  /** The page brought in, as its page job carries it: its lines, its photos, and the pages its links may go to (AGL-4084). */
222
238
  export declare function aiSiteImportDocumentFor(state: AiSiteImportState, page: AiSiteImportPage): AiSiteImportDocument | null;
223
239
  /** One page's job: a page job's plan of one screen, its sections the old page's own, its words carried as they are. */
@@ -567,14 +567,22 @@ const delivered = (items, slot)=>items.some((row)=>row.slot === slot && (row.sta
567
567
  const name = key(input.siteName);
568
568
  return input.aspect >= 1.4 && !!name && key(input.alt).includes(name);
569
569
  }
570
+ /** How a redesigned header sizes its logo (AGL-4152): the width it reads at, and the heights the header's bar holds it between. */ export const AI_SITE_IMPORT_LOGO_SCALE = {
571
+ width: 150,
572
+ least: 32,
573
+ most: 56
574
+ };
570
575
  /**
571
576
  * The height a redesigned header draws its logo at (AGL-4152), a Besigner field
572
- * like any: a mark about square a little taller, a wordmark held to a width the
573
- * row has room for, and neither under what reads on a phone.
577
+ * like any. A logo reads by its width, as a designer sizes one: about
578
+ * `AI_SITE_IMPORT_LOGO_SCALE.width` across, never taller than the bar holds on
579
+ * a phone, and never so short a long wordmark's letters stop reading. A lockup
580
+ * of a mark and stacked words (about twice as wide as tall) then stands as tall
581
+ * as the bar allows, where a fixed 40px drew it the size of a menu label.
574
582
  */ export function aiSiteImportLogoHeight(aspect) {
575
- const WIDEST = 200;
583
+ const { width, least, most } = AI_SITE_IMPORT_LOGO_SCALE;
576
584
  if (!aspect) return '40px';
577
- return `${Math.round(Math.max(28, Math.min(aspect <= 1.25 ? 48 : 40, WIDEST / aspect)))}px`;
585
+ return `${Math.round(Math.max(least, Math.min(most, width / aspect)))}px`;
578
586
  }
579
587
  /** A menu entry that asks a visitor to act, which a redesigned header's button may take where the source draws none (AGL-4152). */ const ACTION_ENTRY = /\b(?:book|contact|estimate|quote|schedule|appointment|visit|reserve|get started|call)\b/i;
580
588
  /**
@@ -736,9 +744,17 @@ const delivered = (items, slot)=>items.some((row)=>row.slot === slot && (row.sta
736
744
  ...state.pages.filter((page)=>!page.refused).map((page)=>`Page: ${page.title} (${page.path})`)
737
745
  ].filter((line)=>typeof line === 'string' && !!line.trim());
738
746
  }
739
- /** The lines of a wave's other pages, as far as they are read (AGL-4152): a fact one of them says is no invention. */ function aiSiteImportWaveLines(state, page) {
740
- const out = [];
741
- let chars = 0;
747
+ /**
748
+ * The lines of a wave's other pages, as far as they are read (AGL-4152): a
749
+ * fact one of them says is no invention. What the site's pages said as their
750
+ * wave read them comes first (`said`): a page's read is emptied once it is in,
751
+ * so an earlier page's lines would otherwise be gone by the next page.
752
+ */ export function aiSiteImportWaveLines(state, page) {
753
+ var _state_said;
754
+ const out = [
755
+ ...(_state_said = state.said) != null ? _state_said : []
756
+ ];
757
+ let chars = out.reduce((sum, line)=>sum + line.length, 0);
742
758
  for (const other of state.pages){
743
759
  var _ref;
744
760
  var _other_read;
@@ -1670,7 +1686,7 @@ export function createAiJobImportStep(deps = {}) {
1670
1686
  // A page whose rewrite was refused keeps its words, and its row says so (AGL-4152).
1671
1687
  if (page && outcome.wording === 'kept' && page.wording === 'improved') current = aiSiteImportWordsKept(current, slot);
1672
1688
  // How its redesign came out (AGL-4152): what its row says, what it added and what it shows.
1673
- if (page && outcome.redesign) current = aiSiteImportRedesignOf(current, slot, outcome.redesign.status, outcome.redesign.added, outcome.redesign.pictures);
1689
+ if (page && outcome.redesign) current = aiSiteImportRedesignOf(current, slot, outcome.redesign.status, outcome.redesign.added, outcome.redesign.pictures, outcome.redesign.missed);
1674
1690
  const spent = aiUnitSpend(outcome);
1675
1691
  const stopped = aiUnitFailure(slot, outcome);
1676
1692
  if ((stopped == null ? void 0 : stopped.status) === 'running') return _extends({}, spent, {